Class Morfeusz


  • public class Morfeusz
    extends java.lang.Object
    Performs morphological analysis (analyse methods) and syntesis (generate methods). It is NOT thread-safe but it is possible to use separate Morfeusz instance for each concurrent thread.
    • Field Detail

      • swigCMemOwn

        protected transient boolean swigCMemOwn
    • Constructor Detail

      • Morfeusz

        protected Morfeusz​(long cPtr,
                           boolean cMemoryOwn)
    • Method Detail

      • getCPtr

        protected static long getCPtr​(Morfeusz obj)
      • finalize

        protected void finalize()
        Overrides:
        finalize in class java.lang.Object
      • delete

        public void delete()
      • analyseAsIterator

        public ResultsIterator analyseAsIterator​(java.lang.String text)
        Analyze given text and return the results as iterator. It does not store results for whole text at once, so may be less memory-consuming for analysis of big texts. NOT THREAD-SAFE (must have exclusive access to this instance).
        Parameters:
        text - text for morphological analysis.
        Returns:
        iterator over morphological analysis results
      • analyseAsList

        public java.util.List<MorphInterpretation> analyseAsList​(java.lang.String text)
        Analyze given text and return the results as list. NOT THREAD-SAFE (must have exclusive access to this instance).
        Parameters:
        text - text for morphological analysis.
        Returns:
        list containing the results of morphological analysis
      • generate

        public java.util.List<MorphInterpretation> generate​(java.lang.String lemma)
        Perform morphological synthesis on a given lemma. NOT THREAD-SAFE (must have exclusive access to this instance).
        Parameters:
        lemma - lemma to be synthesized
        Returns:
        list containing results of the morphological synthesis
        Throws:
        MorfeuszException - when given parameter contains whitespaces
      • generate

        public java.util.List<MorphInterpretation> generate​(java.lang.String lemma,
                                                            int tagnum)
        Perform morphological synthesis on a given lemma. Limit results to interpretations with the specified tag. NOT THREAD-SAFE (must have exclusive access to this instance).
        Parameters:
        lemma - lemma to be analysed
        tagnum - tag number of result interpretations
        Returns:
        list containing results of the morphological synthesis
        Throws:
        MorfeuszException - when given parameter contains whitespaces
      • getDictionarySearchPaths

        public static java.util.List<java.lang.String> getDictionarySearchPaths()
        Get list of paths for dictionaries searching. It is neccessary to modify this list to search for dictionaries under non-default paths. The returned list is NOT THREAD-SAFE (must have exclusive acces to modify it).
        Returns:
        modifiable list of paths
      • getAvailableAgglOptions

        public java.util.List<java.lang.String> getAvailableAgglOptions()
        Get list of possible agglutination rules. NOT THREAD-SAFE (must have exclusive access to this instance).
        Returns:
        modifiable list of paths
      • getAvailablePraetOptions

        public java.util.List<java.lang.String> getAvailablePraetOptions()
        Get list of possible past-tense segmentation rules. NOT THREAD-SAFE (must have exclusive access to this instance).
        Returns:
        modifiable list of paths
      • setDictionary

        public void setDictionary​(java.lang.String dictName)
                           throws java.io.IOException
        Set dictionary to be used with this instance. NOT THREAD-SAFE (must have exclusive access to this instance).
        Parameters:
        dictName - new dictionary name
        Throws:
        java.io.IOException - when IO error occurs when trying to read dictionary
        MorfeuszException - when there is no such dictionary
      • getVersion

        public static java.lang.String getVersion()
        Returns a string containing library version.
        Returns:
        library version string
      • getDefaultDictName

        public static java.lang.String getDefaultDictName()
      • getCopyright

        public static java.lang.String getCopyright()
      • createInstance

        public static Morfeusz createInstance​(MorfeuszUsage usage)
        Creates actual instance of Morfeusz class.
        Returns:
        Morfeusz instance
      • createInstance

        public static Morfeusz createInstance()
        Creates actual instance of Morfeusz class.
        Returns:
        Morfeusz instance
      • createInstance

        public static Morfeusz createInstance​(java.lang.String dictName,
                                              MorfeuszUsage usage)
        Creates actual instance of Morfeusz class.
        Returns:
        Morfeusz instance
      • createInstance

        public static Morfeusz createInstance​(java.lang.String dictName)
        Creates actual instance of Morfeusz class.
        Returns:
        Morfeusz instance
      • getDictID

        public java.lang.String getDictID()
      • getDictCopyright

        public java.lang.String getDictCopyright()
      • clone

        public Morfeusz clone()
        Overrides:
        clone in class java.lang.Object
      • setAggl

        public void setAggl​(java.lang.String aggl)
        Set aggl segmentation option value. NOT THREAD-SAFE (must have exclusive access to this instance).
        Parameters:
        aggl - aggl value
        Throws:
        MorfeuszException - when invalid aggl parameter provided
      • getAggl

        public java.lang.String getAggl()
      • setPraet

        public void setPraet​(java.lang.String praet)
        Set praet segmentation option value. NOT THREAD-SAFE (must have exclusive access to this instance).
        Parameters:
        praet - praet value
        Throws:
        MorfeuszException - when invalid praet parameter provided
      • getPraet

        public java.lang.String getPraet()
      • setCaseHandling

        public void setCaseHandling​(CaseHandling caseHandling)
        Set case handling. NOT THREAD-SAFE (must have exclusive access to this instance).
        Parameters:
        caseHandling - case handling policy
      • setTokenNumbering

        public void setTokenNumbering​(TokenNumbering numbering)
        Set token numbering policy. NOT THREAD-SAFE (must have exclusive access to this instance).
        Parameters:
        numbering - token numbering policy
      • setWhitespaceHandling

        public void setWhitespaceHandling​(WhitespaceHandling whitespaceHandling)
        Set whitespace handling. NOT THREAD-SAFE (must have exclusive access to this instance).
        Parameters:
        whitespaceHandling - whitespace handling policy
      • getIdResolver

        public IdResolver getIdResolver()
      • _analyseAsIterator

        public pl.sgjp.morfeusz._ResultsIterator _analyseAsIterator​(java.lang.String text)