|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdasher.CDasherComponent
dasher.CLanguageModel
dasher.CRemotePPM
public class CRemotePPM
Implements the client side of a remote language model. Whilst named RemotePPM, there is no reason why the remote side shouldn't operate some different language model.
For details on the server required, see the website at www.smowton.net/chris
For details of the PPM Language model see CPPMLanguageModel
For details of the general contract of a language model, see CLanguageModel.
| Nested Class Summary | |
|---|---|
(package private) class |
CRemotePPM.CloneContextOp
|
(package private) class |
CRemotePPM.CreateEmptyContextOp
|
(package private) class |
CRemotePPM.EnterSymbolOp
|
(package private) class |
CRemotePPM.GetProbsOp
|
(package private) class |
CRemotePPM.MessageDispatcherThread
|
(package private) class |
CRemotePPM.MessageListenerThread
|
(package private) class |
CRemotePPM.ReleaseContextOp
|
(package private) class |
CRemotePPM.RemotePPMContext
|
(package private) class |
CRemotePPM.RemotePPMOperation
|
(package private) static class |
CRemotePPM.RemotePPMOperationType
|
| Field Summary | |
|---|---|
private CRemotePPM.MessageDispatcherThread |
dispatch
|
private java.util.LinkedList<ProbsListener> |
eventListeners
|
private int |
lastHandle
|
private java.util.LinkedList<CRemotePPM.RemotePPMOperation> |
pendingMessageQueue
|
| Fields inherited from class dasher.CLanguageModel |
|---|
m_Alphabet, nullContext |
| Fields inherited from class dasher.CDasherComponent |
|---|
m_EventHandler, m_SettingsStore |
| Constructor Summary | |
|---|---|
CRemotePPM(CEventHandler EventHandler,
CSettingsStore SettingsStore,
CSymbolAlphabet SymbolAlphabet)
|
|
| Method Summary | |
|---|---|
CContextBase |
CloneContext(CContextBase Context)
Clones a given context; changes to one clone must not effect the state of the other. |
CContextBase |
CreateEmptyContext()
Creates an empty context |
private void |
enQueueMessage(CRemotePPM.RemotePPMOperation message)
|
void |
EnterSymbol(CContextBase context,
int Symbol)
Modifies the supplied context, appending a given symbol. |
int |
GetMemory()
Get some measure of the memory usage for diagnostic purposes. |
long[] |
GetProbs(CContextBase Context,
long iNorm)
Given a context and a normalisation value to which all probabilities must add up, this should produce an array in which each term corresponds to the relative probability of that symbol coming next. |
private int |
GetUnusedHandle()
|
static void |
intToBytes(byte[] destination,
int input,
int offset)
|
boolean |
isRemote()
Indicates whether this is a remote/asynchronous model with respect to returning probabilities. |
void |
LearnSymbol(CContextBase context,
int Symbol)
Modifies the supplied context, appending a given symbol. |
static void |
longToBytes(byte[] destination,
long input,
int offset)
|
void |
notifyNetworkFailure(int errorCode)
|
void |
ProbsArrived(long[] probs)
|
void |
PromptForProbs(CContextBase Context,
long iNorm)
|
void |
RegisterProbsListener(ProbsListener it)
|
void |
ReleaseContext(CContextBase Context)
Releases a given context; if the LanguageModel is keeping track of them internally or doing allocation work, it should release their storage. |
void |
transmitMessages(java.io.OutputStream out)
|
void |
UnregisterComponent()
Unregisters this component with the EventHandler, preventing the receipt of any further events, though new ones can still be dispatched. |
| Methods inherited from class dasher.CLanguageModel |
|---|
GetSize, HandleEvent, SymbolAlphabet |
| Methods inherited from class dasher.CDasherComponent |
|---|
GetBoolParameter, GetLongParameter, GetParameterName, GetParameterType, GetStringParameter, InsertEvent, SetBoolParameter, SetLongParameter, SetStringParameter |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private int lastHandle
private CRemotePPM.MessageDispatcherThread dispatch
private java.util.LinkedList<CRemotePPM.RemotePPMOperation> pendingMessageQueue
private java.util.LinkedList<ProbsListener> eventListeners
| Constructor Detail |
|---|
public CRemotePPM(CEventHandler EventHandler,
CSettingsStore SettingsStore,
CSymbolAlphabet SymbolAlphabet)
| Method Detail |
|---|
public static void intToBytes(byte[] destination,
int input,
int offset)
public static void longToBytes(byte[] destination,
long input,
int offset)
public CContextBase CloneContext(CContextBase Context)
CLanguageModel
CloneContext in class CLanguageModelContext - Context to clone
public CContextBase CreateEmptyContext()
CLanguageModel
CreateEmptyContext in class CLanguageModel
public void EnterSymbol(CContextBase context,
int Symbol)
CLanguageModelThe model should not alter its predictions based upon this entry.
EnterSymbol in class CLanguageModelcontext - Context to modifySymbol - Symbol to enterpublic int GetMemory()
CLanguageModel
GetMemory in class CLanguageModel
public void PromptForProbs(CContextBase Context,
long iNorm)
public void ProbsArrived(long[] probs)
public void RegisterProbsListener(ProbsListener it)
public long[] GetProbs(CContextBase Context,
long iNorm)
CLanguageModelThe indices assigned to symbols should match those in the SymbolAlphabet we're working with.
The size of the array returned should be equal to the number of symbols in our current alphabet.
GetProbs in class CLanguageModel
public void LearnSymbol(CContextBase context,
int Symbol)
CLanguageModelThe model should learn from this if it can in order to make better predictions in future.
If the model is not capable of learning, this should behave precisely as EnterSymbol.
LearnSymbol in class CLanguageModelcontext - Context to modifySymbol - Symbol to enterpublic void ReleaseContext(CContextBase Context)
CLanguageModel
ReleaseContext in class CLanguageModelContext - Context to releaseprivate int GetUnusedHandle()
private void enQueueMessage(CRemotePPM.RemotePPMOperation message)
public void transmitMessages(java.io.OutputStream out)
public boolean isRemote()
CLanguageModel
isRemote in class CLanguageModelpublic void UnregisterComponent()
CDasherComponent
UnregisterComponent in class CDasherComponentpublic void notifyNetworkFailure(int errorCode)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||