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 String
CAT_GETDOC
static String
CAT_SEARCHDOC
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
categorize(String contents)
static Locale
detectLocale(String text)
List<NameEntity>
find(String contents)
static NLP
get(Locale locale)
static NLP
getByText(String text)
Locale
getLocale()
void
trainCategorizer(File trainFile)
Trains the categorizer and stores the compiled modelvoid
trainDocumentsFinder(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
-
-