Class Morfeusz

java.lang.Object
pl.sgjp.morfeusz.Morfeusz

public class Morfeusz extends 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 Details

    • swigCMemOwn

      protected transient boolean swigCMemOwn
  • Constructor Details

    • Morfeusz

      protected Morfeusz(long cPtr, boolean cMemoryOwn)
  • Method Details

    • getCPtr

      protected static long getCPtr(Morfeusz obj)
    • swigRelease

      protected static long swigRelease(Morfeusz obj)
    • finalize

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

      public void delete()
    • analyseAsIterator

      public ResultsIterator analyseAsIterator(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 List<MorphInterpretation> analyseAsList(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 List<MorphInterpretation> generate(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 List<MorphInterpretation> generate(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 List<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 List<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 List<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(String dictName) throws 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:
      IOException - when IO error occurs when trying to read dictionary
      MorfeuszException - when there is no such dictionary
    • getVersion

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

      public static String getDefaultDictName()
    • getCopyright

      public static 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(String dictName, MorfeuszUsage usage)
      Creates actual instance of Morfeusz class.
      Returns:
      Morfeusz instance
    • createInstance

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

      public String getDictID()
    • getDictCopyright

      public String getDictCopyright()
    • clone

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

      public void setAggl(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 String getAggl()
    • setPraet

      public void setPraet(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 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
    • getCaseHandling

      public CaseHandling getCaseHandling()
    • 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
    • getTokenNumbering

      public TokenNumbering getTokenNumbering()
    • setWhitespaceHandling

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

      public WhitespaceHandling getWhitespaceHandling()
    • getIdResolver

      public IdResolver getIdResolver()
    • _analyseAsIterator

      public pl.sgjp.morfeusz._ResultsIterator _analyseAsIterator(String text)