|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdasher.CNodeManager
dasher.CAlphabetManager
dasher.CRemoteAlphabetManager
public class CRemoteAlphabetManager
This is part of an experiment with remote language modelling. It is designed for use with the CRemotePPM language model.
This class is designed to allow us to update nodes asynchronously whilst using as much of Dasher's existing code as possible. Historically, the task would go:
My new schema is: When asked to populate a node, we note the details of the request and place it in a queue. We directly notify the language model of the requirement, supplying the model-calculated normalisation constant, the generation of which has been refactored out into a seperate function, getNonUniformNorm(int iNorm).
When the reply comes back, we apply the model's post-processing by calling AdjustProbs(long[] probs), which again used to be a part of the getProbs sequence but is now a seperate function so that the model *can* do its modifications on probabilities which come from elsewhere. The main codepath has been modified so that it calls the appropriate refactored functions, also increasing code readability.
| Nested Class Summary | |
|---|---|
(package private) class |
CRemoteAlphabetManager.PendingPopulate
Struct describing a pending PopulateChildrenWithSymbol |
| Field Summary | |
|---|---|
private java.util.Queue<CRemoteAlphabetManager.PendingPopulate> |
pendingPopulates
Queue of requests pending with the remote server |
| Fields inherited from class dasher.CAlphabetManager |
|---|
ContSymbol, ConvertSymbol, m_Alphabet, m_Colours, m_DisplayText, m_LanguageModel, m_Model, SPSymbol |
| Fields inherited from class dasher.CNodeManager |
|---|
m_iID |
| Constructor Summary | |
|---|---|
CRemoteAlphabetManager(CDasherModel model,
CLanguageModel langmodel)
Create a new RemoteAlphabetManager which uses a given Model and LanguageModel to produce probabilities. |
|
| Method Summary | |
|---|---|
void |
PopulateChildrenWithSymbol(CDasherNode Node,
int iExistingSymbol,
CDasherNode ExistingChild)
Override of CAlphabetManager's PopulateChildrenWithSymbol method. |
void |
probsArrived(long[] probs)
Called by the LanguageModel when a request sent to the remote language modelling server responds to a request. |
| Methods inherited from class dasher.CAlphabetManager |
|---|
ClearNode, GetRoot, Output, PopulateChildren, PopulateChildrenWithSymbol, RebuildParent, Ref, Undo, Unref, WaitForChildren |
| Methods inherited from class dasher.CNodeManager |
|---|
Enter, GetID, Leave |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.util.Queue<CRemoteAlphabetManager.PendingPopulate> pendingPopulates
| Constructor Detail |
|---|
public CRemoteAlphabetManager(CDasherModel model,
CLanguageModel langmodel)
model - Model which knows how to mangle probabilitieslangmodel - LanguageModel which produces probabilities| Method Detail |
|---|
public void PopulateChildrenWithSymbol(CDasherNode Node,
int iExistingSymbol,
CDasherNode ExistingChild)
Requests that our remote language model should produce probabilities appropriate to this Node and returns without actually populating the Node's children.
The population itself will be performed when our asynchronous request completes; at this point, probsArrived() will be called.
PopulateChildrenWithSymbol in class CAlphabetManagerNode - Node whose children we are to populateiExistingSymbol - Symbol of the Node's existing child, if anyExistingChild - Pre-existing child of the Node we are to
populate, if any. Null if none.public void probsArrived(long[] probs)
This will perform the actual population by calling the ordinary AlphabetManager's PopulateChildrenWithSymbol method.
probsArrived in interface ProbsListenerprobs - Probabilities received
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||