|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdasher.CDasherComponent
dasher.CLanguageModel
dasher.CPPMLanguageModel
public class CPPMLanguageModel
Subclass of LanguageModel which implements Prediction by Partial Match. For information on the algorithm and its implementation, see (http://www.compression-links.info/PPM).
For the general contract obeyed by LanguageModel methods, see the documentation of CLanguageModel.
| Nested Class Summary | |
|---|---|
(package private) class |
CPPMLanguageModel.CAddSymReturnValue
Small struct for use by CPPMLanguageModel's AddSymbol method. |
(package private) class |
CPPMLanguageModel.CPPMContext
Class representing a context which contains information relevant to the PPM model. |
(package private) class |
CPPMLanguageModel.CPPMnode
Node in PPM's prediction trie. |
| Field Summary | |
|---|---|
boolean |
bUpdateExclusion
|
private long |
lpAlpha
|
private long |
lpBeta
|
double |
m_dBackOffConstat
|
int |
m_iMaxOrder
|
CPPMLanguageModel.CPPMnode |
m_Root
|
CPPMLanguageModel.CPPMContext |
m_RootContext
|
int |
NodesAllocated
|
| Fields inherited from class dasher.CLanguageModel |
|---|
m_Alphabet, nullContext |
| Fields inherited from class dasher.CDasherComponent |
|---|
m_EventHandler, m_SettingsStore |
| Constructor Summary | |
|---|---|
CPPMLanguageModel(CEventHandler EventHandler,
CSettingsStore SettingsStore,
CSymbolAlphabet SymbolAlphabet)
|
|
| Method Summary | |
|---|---|
private void |
AddSymbol(CPPMLanguageModel.CPPMContext context,
int sym)
|
private CPPMLanguageModel.CAddSymReturnValue |
AddSymbolToNode(CPPMLanguageModel.CPPMnode Node,
int sym,
int updatein)
|
CContextBase |
CloneContext(CContextBase Input)
Clones a given context; changes to one clone must not effect the state of the other. |
CContextBase |
CreateEmptyContext()
Creates an empty context |
void |
dumpString(java.lang.String str,
int pos,
int len)
Diagnostic method; prints a given String starting at pos and with length len. |
void |
dumpSymbol(int sym)
Diagnostic method; prints a given symbol. |
void |
EnterSymbol(CContextBase c,
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 norm)
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. |
void |
HandleEvent(CEvent Event)
Ignores all events |
void |
LearnSymbol(CContextBase c,
int Symbol)
Modifies the supplied context, appending a given symbol. |
void |
ReleaseContext(CContextBase release)
Releases a given context; if the LanguageModel is keeping track of them internally or doing allocation work, it should release their storage. |
| Methods inherited from class dasher.CLanguageModel |
|---|
GetSize, isRemote, SymbolAlphabet |
| Methods inherited from class dasher.CDasherComponent |
|---|
GetBoolParameter, GetLongParameter, GetParameterName, GetParameterType, GetStringParameter, InsertEvent, SetBoolParameter, SetLongParameter, SetStringParameter, UnregisterComponent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public CPPMLanguageModel.CPPMContext m_RootContext
public CPPMLanguageModel.CPPMnode m_Root
public int m_iMaxOrder
public double m_dBackOffConstat
public int NodesAllocated
public boolean bUpdateExclusion
private long lpAlpha
private long lpBeta
| Constructor Detail |
|---|
public CPPMLanguageModel(CEventHandler EventHandler,
CSettingsStore SettingsStore,
CSymbolAlphabet SymbolAlphabet)
| Method Detail |
|---|
public void HandleEvent(CEvent Event)
CLanguageModel
HandleEvent in class CLanguageModelEvent - Event received.public int GetMemory()
CLanguageModel
GetMemory in class CLanguageModel
public long[] GetProbs(CContextBase context,
long norm)
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
private void AddSymbol(CPPMLanguageModel.CPPMContext context,
int sym)
public void EnterSymbol(CContextBase c,
int Symbol)
CLanguageModelThe model should not alter its predictions based upon this entry.
EnterSymbol in class CLanguageModelc - Context to modifySymbol - Symbol to enter
public void LearnSymbol(CContextBase c,
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 CLanguageModelc - Context to modifySymbol - Symbol to enterpublic void dumpSymbol(int sym)
sym - Symbol to print
public void dumpString(java.lang.String str,
int pos,
int len)
str - String to printpos - Position to start printinglen - Number of characters to print
private CPPMLanguageModel.CAddSymReturnValue AddSymbolToNode(CPPMLanguageModel.CPPMnode Node,
int sym,
int updatein)
public CContextBase CreateEmptyContext()
CLanguageModel
CreateEmptyContext in class CLanguageModelpublic CContextBase CloneContext(CContextBase Input)
CLanguageModel
CloneContext in class CLanguageModelInput - Context to clone
public void ReleaseContext(CContextBase release)
CLanguageModel
ReleaseContext in class CLanguageModelrelease - Context to release
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||