Class OpenNLPNameFinder

  • All Implemented Interfaces:
    NERecogniser

    public class OpenNLPNameFinder
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      OpenNLPNameFinder​(java.lang.String nameType, java.lang.String nerModelPath)
      Creates OpenNLP name finder
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> findNames​(java.lang.String[] tokens)
      finds names from given array of tokens
      java.util.Set<java.lang.String> getEntityTypes()
      gets a set of entity types whose names are recognisable by this
      boolean isAvailable()
      checks if this Named Entity recogniser is available for service
      java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> recognise​(java.lang.String text)
      call for name recognition action from text
      static java.lang.String[] tokenize​(java.lang.String text)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OpenNLPNameFinder

        public OpenNLPNameFinder​(java.lang.String nameType,
                                 java.lang.String nerModelPath)
        Creates OpenNLP name finder
        Parameters:
        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
        Returns:
        true if this recogniser is ready to recognise, false otherwise
      • getEntityTypes

        public java.util.Set<java.lang.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
      • tokenize

        public static java.lang.String[] tokenize​(java.lang.String text)
      • recognise

        public java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> recognise​(java.lang.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
      • findNames

        public java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> findNames​(java.lang.String[] tokens)
        finds names from given array of tokens
        Parameters:
        tokens - the tokens array
        Returns:
        map of EntityType -> set of entity names