Class OpenNLPNERecogniser

java.lang.Object
org.apache.tika.parser.ner.opennlp.OpenNLPNERecogniser
All Implemented Interfaces:
NERecogniser

public class OpenNLPNERecogniser extends Object implements NERecogniser
This implementation of NERecogniser chains an array of OpenNLPNameFinders for which NER models are available in classpath.

The following models are scanned during initialization via class loader.:

Entity TypePath
"PERSON" "ner-person.bin"
"LOCATION""ner-location.bin"
"ORGANIZATION""ner-organization.bin"
"TIME""ner-time.bin"
"DATE""ner-date.bin"
"PERCENT""ner-percentage.bin"
"MONEY""ner-money.bin"
See Also:
  • Field Details

  • Constructor Details

    • OpenNLPNERecogniser

      public OpenNLPNERecogniser()
      Creates a default chain of Name finders using default OpenNLP recognizers
    • OpenNLPNERecogniser

      public OpenNLPNERecogniser(Map<String,String> models)
      Creates a chain of Named Entity recognisers
      Parameters:
      models - map of entityType -> model path NOTE: the model path should be known to class loader.
  • Method Details

    • isAvailable

      public boolean isAvailable()
      Description copied from interface: NERecogniser
      checks if this Named Entity recogniser is available for service
      Specified by:
      isAvailable in interface NERecogniser
      Returns:
      true if this recogniser is ready to recognise, false otherwise
    • getEntityTypes

      public Set<String> getEntityTypes()
      Description copied from interface: NERecogniser
      gets a set of entity types whose names are recognisable by this
      Specified by:
      getEntityTypes in interface NERecogniser
      Returns:
      set of entity types/classes
    • recognise

      public Map<String,Set<String>> recognise(String text)
      Description copied from interface: NERecogniser
      call for name recognition action from text
      Specified by:
      recognise in interface NERecogniser
      Parameters:
      text - text with possibly contains names
      Returns:
      map of entityType -> set of names