Package pl.sgjp.morfeusz
Class Morfeusz
- java.lang.Object
-
- pl.sgjp.morfeusz.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 Summary
Fields Modifier and Type Field Description protected boolean
swigCMemOwn
-
Constructor Summary
Constructors Modifier Constructor Description protected
Morfeusz(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)
ResultsIterator
analyseAsIterator(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.Morfeusz
clone()
static Morfeusz
createInstance()
Creates actual instance of Morfeusz class.static Morfeusz
createInstance(java.lang.String dictName)
Creates actual instance of Morfeusz class.static Morfeusz
createInstance(java.lang.String dictName, MorfeuszUsage usage)
Creates actual instance of Morfeusz class.static Morfeusz
createInstance(MorfeuszUsage usage)
Creates actual instance of Morfeusz class.void
delete()
protected void
finalize()
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.String
getAggl()
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.CaseHandling
getCaseHandling()
static java.lang.String
getCopyright()
protected static long
getCPtr(Morfeusz obj)
static java.lang.String
getDefaultDictName()
java.lang.String
getDictCopyright()
java.lang.String
getDictID()
static java.util.List<java.lang.String>
getDictionarySearchPaths()
Get list of paths for dictionaries searching.IdResolver
getIdResolver()
java.lang.String
getPraet()
TokenNumbering
getTokenNumbering()
static java.lang.String
getVersion()
Returns a string containing library version.WhitespaceHandling
getWhitespaceHandling()
void
setAggl(java.lang.String aggl)
Set aggl segmentation option value.void
setCaseHandling(CaseHandling caseHandling)
Set case handling.void
setDictionary(java.lang.String dictName)
Set dictionary to be used with this instance.void
setPraet(java.lang.String praet)
Set praet segmentation option value.void
setTokenNumbering(TokenNumbering numbering)
Set token numbering policy.void
setWhitespaceHandling(WhitespaceHandling whitespaceHandling)
Set whitespace handling.
-
-
-
Method Detail
-
getCPtr
protected static long getCPtr(Morfeusz obj)
-
finalize
protected void finalize()
- Overrides:
finalize
in 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.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 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:
clone
in 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)
-
-