Package org.predict4all.nlp.words.model
Class TagWord
- java.lang.Object
-
- org.predict4all.nlp.words.model.AbstractWord
-
- org.predict4all.nlp.words.model.TagWord
-
- All Implemented Interfaces:
Word
public class TagWord 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
-
-
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
getNGramTagId()
byte
getType()
String
getWord()
boolean
isNGramTag()
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, getEquivalenceClassId, getID, getLastUseDate, getNGramTag, getProbFactor, getUsageCount, incrementUsageCount, isEquivalenceClass, isForceInvalid, isForceValid, isModifiedBySystem, isModifiedByUser, isModifiedByUserOrSystem, isUserWord, setForceInvalid, setForceValid, setModifiedBySystem, setModifiedByUser, setProbFactor, toString
-
-
-
-
Constructor Detail
-
TagWord
public TagWord(Tag tag)
-
-
Method Detail
-
getNGramTagId
public byte getNGramTagId()
- Specified by:
getNGramTagId
in interfaceWord
- Overrides:
getNGramTagId
in classAbstractWord
- Returns:
- the ngram tag id represented by this word (only if
Word.isNGramTag()
)
-
isNGramTag
public boolean isNGramTag()
- Specified by:
isNGramTag
in interfaceWord
- Overrides:
isNGramTag
in classAbstractWord
- Returns:
- true if this word is
TagWord
instance
-
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
)
-
getType
public byte getType()
- Returns:
- the byte to save this word type (using TYPE_EQUIVALENCE_CLASS, TYPE_NGRAM_TAG, etc...)
Used inWordFileInputStream
andWordFileOutputStream
-
-