Class AbstractWord

    • Constructor Detail

      • AbstractWord

        public AbstractWord​(int id)
    • Method Detail

      • getID

        public int getID()
        Specified by:
        getID in interface Word
        Returns:
        this word ID : use int as it's the lowest memory foot print primitive to store enough word
      • isNGramTag

        public boolean isNGramTag()
        Specified by:
        isNGramTag in interface Word
        Returns:
        true if this word is TagWord instance
      • getNGramTagId

        public byte getNGramTagId()
        Specified by:
        getNGramTagId in interface Word
        Returns:
        the ngram tag id represented by this word (only if Word.isNGramTag())
      • isUserWord

        public boolean isUserWord()
        Specified by:
        isUserWord in interface Word
        Returns:
        true if this word is UserWord instance
      • isValidForSaving

        public boolean isValidForSaving()
        Specified by:
        isValidForSaving in interface Word
        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 regarding Word.isForceInvalid() or Word.isForceValid() Also, user word are valid for prediction regarding PredictionParameter.getMinUseCountToValidateNewWord()
        Specified by:
        isValidToBePredicted in interface Word
        Parameters:
        predictionParameter - the prediction parameter, could be use to validate the word
        Returns:
        true if the word can be displayed in prediction result
      • getProbFactor

        public double getProbFactor()
        Description copied from interface: Word
        This factor can be used to modify final probabilities of the predictions.
        It will be applied once probabilities are computed to influence result list.
        It is mainly used in a multiplication with the original probability (and then the result list is normalized).
        To only rely on probabilities, the value should be 1.0
        Specified by:
        getProbFactor in interface Word
        Returns:
        the prob factor
      • setProbFactor

        public void setProbFactor​(double factor,
                                  boolean modificationByUser)
        Description copied from interface: Word
        This factor can be used to modify final probabilities of the predictions.
        It will be applied once probabilities are computed to influence result list.
        It is mainly used in a multiplication with the original probability (and then the result list is normalized).
        To only rely on probabilities, the value should be 1.0
        Specified by:
        setProbFactor in interface Word
        Parameters:
        factor - the prob factor
        modificationByUser - true indicates that the modification was done by the user and not the system
      • isModifiedByUser

        public boolean isModifiedByUser()
        Description copied from interface: Word
        Indicate that this word was modified by the user (e.g. calling a modification method with modificationByUser parameter to true)
        Specified by:
        isModifiedByUser in interface Word
        Returns:
        modification by user flag
      • setModifiedByUser

        public void setModifiedByUser​(boolean modified)
        Description copied from interface: Word
        To manually set modification by user flag
        Specified by:
        setModifiedByUser in interface Word
        Parameters:
        modified - modification by user flag
      • isModifiedBySystem

        public boolean isModifiedBySystem()
        Description copied from interface: Word
        Indicate that this word was modified by the system (e.g. calling a modification method with modificationByUser parameter to false)
        Specified by:
        isModifiedBySystem in interface Word
        Returns:
        modification by system flag
      • setModifiedBySystem

        public void setModifiedBySystem​(boolean modifiedBySystem)
        Description copied from interface: Word
        To manually set modification by system flag
        Specified by:
        setModifiedBySystem in interface Word
        Parameters:
        modifiedBySystem - modification by system flag
      • isForceValid

        public boolean isForceValid()
        Description copied from interface: Word
        To force that this word become valid, mostly use on UserWord to ignore validation.
        Specified by:
        isForceValid in interface Word
        Returns:
        force valid enabled
      • setForceValid

        public void setForceValid​(boolean forceValid,
                                  boolean modificationByUser)
        Description copied from interface: Word
        To force that this word become valid, mostly use on UserWord to ignore validation.
        Specified by:
        setForceValid in interface Word
        Parameters:
        forceValid - force valid enabled
        modificationByUser - true indicates that the modification was done by the user and not the system
      • isForceInvalid

        public boolean isForceInvalid()
        Description copied from interface: Word
        To force that this word is invalid.
        In fact, this method allow removal of a word from prediction result : words can't be removed from dictionary as they can be used in ngrams, but having forceInvalid true has the same effect than removing a word.
        Specified by:
        isForceInvalid in interface Word
        Returns:
        force invalid enabled
      • setForceInvalid

        public void setForceInvalid​(boolean forceInvalid,
                                    boolean modificationByUser)
        Description copied from interface: Word
        To force that this word is invalid.
        In fact, this method allow removal of a word from prediction result : words can't be removed from dictionary as they can be used in ngrams, but having forceInvalid true has the same effect than removing a word.
        Specified by:
        setForceInvalid in interface Word
        Parameters:
        forceInvalid - force invalid enabled
        modificationByUser - true indicates that the modification was done by the user and not the system
      • getUsageCount

        public int getUsageCount()
        Specified by:
        getUsageCount in interface Word
        Returns:
        the number of times this word was seen "used" in user text.
        This count is update by WordPredictor when training the dynamic model.
      • incrementUsageCount

        public void incrementUsageCount()
        Description copied from interface: Word
        To increase the "usage" count of this word
        Specified by:
        incrementUsageCount in interface Word