Class OpenNLPNameFinder

  • All Implemented Interfaces:

    public class OpenNLPNameFinder
    extends Object
    implements NERecogniser
    An implementation of NERecogniser that finds names in text using Open NLP Model. This implementation works with only one entity type. For chain this name finder instances, see OpenNLPNERecogniser
    • Constructor Detail

      • OpenNLPNameFinder

        public OpenNLPNameFinder​(String nameType,
                                 String nerModelPath)
        Creates OpenNLP name finder
        nameType - the entity type recognised by the given NER model
        nerModelPath - path to ner model
    • Method Detail

      • 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
        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
        set of entity types/classes
      • tokenize

        public static String[] tokenize​(String text)
      • 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
        text - text with possibly contains names
        map of entityType -> set of names
      • findNames

        public Map<String,​Set<String>> findNames​(String[] tokens)
        finds names from given array of tokens
        tokens - the tokens array
        map of EntityType -> set of entity names