Create a Simple MOTPipe

You can start by creating a MOTPipe that tokenizes input text and displays the result to the screen.

Important: A pipe is not thread safe. It is better to initialize one pipe for each thread, and to share resources.

This page discusses:

See Also
Perform Language Detection and Word Lemmatization
Explore the Configuration File
Extract Named Entities
Use Case

You create a pipe in Java by using the LinguisticFactory.buildPipe(MOTConfig config) method, or one of the following:

  • LinguisticFactory.buildPipe(String motConfigPath)

  • LinguisticFactory.buildPipe(MOTConfig config, int version)

  • LinguisticFactory.buildPipe(String linguisticConfig, String tokenizationConfigName, List<SemanticProcessor> processors)

  • LinguisticFactory.buildPipe(String linguisticConfig, String tokenizationConfigName, List<SemanticProcessor> processors, int version)

  • LinguisticFactory.buildPipe(String linguisticConfig, String tokenizationConfigName)

  • LinguisticFactory.buildPipe(List<Tokenizer> tokenizers, NormalizerConfig norm, List<SemanticProcessor> processors)

  • LinguisticFactory.buildPipe(List<Tokenizer> tokenizers, NormalizerConfig norm, List<SemanticProcessor> processors, int version)

Use the methods signatures with additional ResourcesContext arguments to share resources between multiple pipes. For example, LinguisticFactory.buildPipe(ResourcesContext ctx, String motConfigPath)

Once created, you must initialize the pipe using its init() method to ensure the loading of the resources. To free resources when the pipe is no longer used, call the release() method.