Package pl.sgjp.morfeusz
Class Morfeusz
- java.lang.Object
-
- pl.sgjp.morfeusz.Morfeusz
-
public class Morfeusz extends java.lang.ObjectPerforms 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 Summary
Fields Modifier and Type Field Description protected booleanswigCMemOwn
-
Constructor Summary
Constructors Modifier Constructor Description protectedMorfeusz(long cPtr, boolean cMemoryOwn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description pl.sgjp.morfeusz._ResultsIterator_analyseAsIterator(java.lang.String text)ResultsIteratoranalyseAsIterator(java.lang.String text)Analyze given text and return the results as iterator.java.util.List<MorphInterpretation>analyseAsList(java.lang.String text)Analyze given text and return the results as list.Morfeuszclone()static MorfeuszcreateInstance()Creates actual instance of Morfeusz class.static MorfeuszcreateInstance(java.lang.String dictName)Creates actual instance of Morfeusz class.static MorfeuszcreateInstance(java.lang.String dictName, MorfeuszUsage usage)Creates actual instance of Morfeusz class.static MorfeuszcreateInstance(MorfeuszUsage usage)Creates actual instance of Morfeusz class.voiddelete()protected voidfinalize()java.util.List<MorphInterpretation>generate(java.lang.String lemma)Perform morphological synthesis on a given lemma.java.util.List<MorphInterpretation>generate(java.lang.String lemma, int tagnum)Perform morphological synthesis on a given lemma.java.lang.StringgetAggl()java.util.List<java.lang.String>getAvailableAgglOptions()Get list of possible agglutination rules.java.util.List<java.lang.String>getAvailablePraetOptions()Get list of possible past-tense segmentation rules.CaseHandlinggetCaseHandling()static java.lang.StringgetCopyright()protected static longgetCPtr(Morfeusz obj)static java.lang.StringgetDefaultDictName()java.lang.StringgetDictCopyright()java.lang.StringgetDictID()static java.util.List<java.lang.String>getDictionarySearchPaths()Get list of paths for dictionaries searching.IdResolvergetIdResolver()java.lang.StringgetPraet()TokenNumberinggetTokenNumbering()static java.lang.StringgetVersion()Returns a string containing library version.WhitespaceHandlinggetWhitespaceHandling()voidsetAggl(java.lang.String aggl)Set aggl segmentation option value.voidsetCaseHandling(CaseHandling caseHandling)Set case handling.voidsetDictionary(java.lang.String dictName)Set dictionary to be used with this instance.voidsetPraet(java.lang.String praet)Set praet segmentation option value.voidsetTokenNumbering(TokenNumbering numbering)Set token numbering policy.voidsetWhitespaceHandling(WhitespaceHandling whitespaceHandling)Set whitespace handling.protected static longswigRelease(Morfeusz obj)
-
-
-
Method Detail
-
getCPtr
protected static long getCPtr(Morfeusz obj)
-
swigRelease
protected static long swigRelease(Morfeusz obj)
-
finalize
protected void finalize()
- Overrides:
finalizein classjava.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 analysedtagnum- 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.IOExceptionSet 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 dictionaryMorfeuszException- 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:
clonein classjava.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
-
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(java.lang.String text)
-
-