Package com.logicaldoc.via
Class NLP
- java.lang.Object
-
- com.logicaldoc.via.NLP
-
public class NLP extends Object
basic operations of Natural Language Processing- Since:
- 7.8
- Author:
- Marco Meschieri - LogicalDOC
-
-
Field Summary
Fields Modifier and Type Field Description static StringCAT_GETDOCstatic StringCAT_SEARCHDOC
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringcategorize(String contents)static LocaledetectLocale(String text)List<NameEntity>find(String contents)static NLPget(Locale locale)static NLPgetByText(String text)LocalegetLocale()voidtrainCategorizer(File trainFile)Trains the categorizer and stores the compiled modelvoidtrainDocumentsFinder(File trainFile)Trains the name finder and stores the compiled model.
-
-
-
Method Detail
-
getLocale
public Locale getLocale()
-
getByText
public static NLP getByText(String text) throws IOException
- Throws:
IOException
-
detectLocale
public static Locale detectLocale(String text) throws IOException
- Throws:
IOException
-
trainCategorizer
public void trainCategorizer(File trainFile) throws IOException
Trains the categorizer and stores the compiled model- Parameters:
trainFile- The training file for the categories- Throws:
IOException- error reading the training files
-
categorize
public String categorize(String contents) throws IOException
- Throws:
IOException
-
trainDocumentsFinder
public void trainDocumentsFinder(File trainFile) throws IOException
Trains the name finder and stores the compiled model.- Parameters:
trainFile- The training file in clear form and natural language- Throws:
opennlp.tools.util.InvalidFormatException- the training files are corruptIOException- error reading the training files
-
find
public List<NameEntity> find(String contents) throws IOException
- Throws:
IOException
-
-