Package org.predict4all.nlp.words.model
Class EquivalenceClassWord
- java.lang.Object
-
- org.predict4all.nlp.words.model.AbstractWord
-
- org.predict4all.nlp.words.model.EquivalenceClassWord
-
- All Implemented Interfaces:
Word
public class EquivalenceClassWord extends AbstractWord
-
-
Field Summary
-
Fields inherited from interface org.predict4all.nlp.words.model.Word
TYPE_EQUIVALENCE_CLASS, TYPE_NGRAM_TAG, TYPE_SIMPLE, TYPE_USER_WORD
-
-
Constructor Summary
Constructors Constructor Description EquivalenceClassWord(EquivalenceClass equivalenceClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Word
clone(int newId)
Create a clone of this word.
This allow duplication existing word, an new id should be provided.byte
getEquivalenceClassId()
byte
getType()
String
getWord()
boolean
isValidForSaving()
boolean
isValidToBePredicted(PredictionParameter predictionParameter)
To check if this word can be displayed as a prediction result.
This typically return true for original words, but can be sensible to computation for user words.
This can also return true/false regardingWord.isForceInvalid()
orWord.isForceValid()
Also, user word are valid for prediction regardingPredictionParameter.getMinUseCountToValidateNewWord()
-
Methods inherited from class org.predict4all.nlp.words.model.AbstractWord
getEquivalenceClass, getID, getLastUseDate, getNGramTag, getNGramTagId, getProbFactor, getUsageCount, incrementUsageCount, isEquivalenceClass, isForceInvalid, isForceValid, isModifiedBySystem, isModifiedByUser, isModifiedByUserOrSystem, isNGramTag, isUserWord, setForceInvalid, setForceValid, setModifiedBySystem, setModifiedByUser, setProbFactor, toString
-
-
-
-
Constructor Detail
-
EquivalenceClassWord
public EquivalenceClassWord(EquivalenceClass equivalenceClass)
-
-
Method Detail
-
isValidForSaving
public boolean isValidForSaving()
- Specified by:
isValidForSaving
in interfaceWord
- Overrides:
isValidForSaving
in classAbstractWord
- Returns:
- true if this world should be saved (in both original and user dictionary)
-
isValidToBePredicted
public boolean isValidToBePredicted(PredictionParameter predictionParameter)
Description copied from interface:Word
To check if this word can be displayed as a prediction result.
This typically return true for original words, but can be sensible to computation for user words.
This can also return true/false regardingWord.isForceInvalid()
orWord.isForceValid()
Also, user word are valid for prediction regardingPredictionParameter.getMinUseCountToValidateNewWord()
- Specified by:
isValidToBePredicted
in interfaceWord
- Overrides:
isValidToBePredicted
in classAbstractWord
- Parameters:
predictionParameter
- the prediction parameter, could be use to validate the word- Returns:
- true if the word can be displayed in prediction result
-
getWord
public String getWord()
- Returns:
- this word "word" ! Can sometimes be null if the word represent a concept more than a real word (e.g.
EquivalenceClassWord
orTagWord
)
-
getEquivalenceClassId
public byte getEquivalenceClassId()
- Specified by:
getEquivalenceClassId
in interfaceWord
- Overrides:
getEquivalenceClassId
in classAbstractWord
- Returns:
- the equivalence class id represented by this word (only if
Word.isEquivalenceClass()
)
-
getType
public byte getType()
- Returns:
- the byte to save this word type (using TYPE_EQUIVALENCE_CLASS, TYPE_NGRAM_TAG, etc...)
Used inWordFileInputStream
andWordFileOutputStream
-
-