Class SimpleWord

    • Field Detail

      • word

        protected final String word
      • probFactor

        protected double probFactor
      • modifiedByUser

        protected boolean modifiedByUser
      • modifiedBySystem

        protected boolean modifiedBySystem
      • forceValid

        protected boolean forceValid
      • forceInvalid

        protected boolean forceInvalid
    • Constructor Detail

      • SimpleWord

        protected SimpleWord​(int id,
                             String word)
      • SimpleWord

        protected SimpleWord​(int id,
                             String word,
                             boolean modifiedByUser,
                             boolean modifiedBySystem,
                             double probFactor,
                             boolean forceInvalid,
                             boolean forceValid)
    • Method Detail

      • 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 or TagWord)
      • 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
        Overrides:
        getProbFactor in class AbstractWord
        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
        Overrides:
        setProbFactor in class AbstractWord
        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
        Overrides:
        isModifiedByUser in class AbstractWord
        Returns:
        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
        Overrides:
        isModifiedBySystem in class AbstractWord
        Returns:
        modification by system 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
        Overrides:
        setModifiedByUser in class AbstractWord
        Parameters:
        modified - modification by user 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
        Overrides:
        isForceValid in class AbstractWord
        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
        Overrides:
        setForceValid in class AbstractWord
        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
        Overrides:
        isForceInvalid in class AbstractWord
        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
        Overrides:
        setForceInvalid in class AbstractWord
        Parameters:
        forceInvalid - force invalid enabled
        modificationByUser - true indicates that the modification was done by the user and not the system
      • createModified

        public static SimpleWord createModified​(int id,
                                                String word,
                                                boolean modifiedByUser,
                                                boolean modifiedBySystem,
                                                double probFactor,
                                                boolean forceInvalid,
                                                boolean forceValid)
      • clone

        public Word clone​(int newId)
        Description copied from interface: Word
        Create a clone of this word.
        This allow duplication existing word, an new id should be provided.
        Parameters:
        newId - the word new id
        Returns:
        a clone of this word, with the new id