You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

The language detector stage uses OpenNLP (https://opennlp.apache.org/) and its language detector model to identify the language of a text block.

It can detect 103 languages outputting ISO 639-3 language codes. (https://opennlp.apache.org/news/model-langdetect-183.html)

It is important to note that the model works better with longer texts that have at least 2 sentences. So it is important to configure this stage earlier in the pipeline and before tokenizing the text.


Operates On:  Lexical Items with TEXT_BLOCK flag.

Configuration Parameters

No configuration parameters are needed. 


Example Configuration
{
 "type":"LangDetectorStage",
}



Example Output

As you can see the first sentence is tagged with "LANG_ENG" and the second sentence with "LANG_SPA". For this case a sentence breaker stage was configured before the language detector stage. This way language identification could happen at sentence level.



Output Flags

Lex-Item Flags:

  • TEXT_BLOCK - Flags all text blocks produced by the SimpleReader
  • LANG_??? - Flags all text blocks where a language was identified. Notice '???' at the end of the Flag. This is replaced by a ISO 3 letter language code. For example, if Spanish is detected, 3 letter code is SPA, then Flag will be "LANG_SPA"

Vertex Flags:

  • none


  • No labels