Class RegexNameFinder

  • All Implemented Interfaces:
    TokenNameFinder

    public final class RegexNameFinder
    extends java.lang.Object
    implements TokenNameFinder
    Name finder based on a series of regular expressions.
    • Constructor Summary

      Constructors 
      Constructor Description
      RegexNameFinder​(java.util.Map<java.lang.String,​java.util.regex.Pattern[]> regexMap)  
      RegexNameFinder​(java.util.regex.Pattern[] patterns)
      Deprecated.
      RegexNameFinder​(java.util.regex.Pattern[] patterns, java.lang.String type)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clearAdaptiveData()
      Forgets all adaptive data which was collected during previous calls to one of the find methods.
      Span[] find​(java.lang.String text)
      NEW.
      Span[] find​(java.lang.String[] tokens)
      Generates name tags for the given sequence, typically a sentence, returning token spans for any identified names.
      java.util.regex.Pattern[] getmPatterns()  
      java.lang.String getsType()  
      void setmPatterns​(java.util.regex.Pattern[] mPatterns)  
      void setsType​(java.lang.String sType)  
      • Methods inherited from class java.lang.Object

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

      • RegexNameFinder

        public RegexNameFinder​(java.util.Map<java.lang.String,​java.util.regex.Pattern[]> regexMap)
      • RegexNameFinder

        public RegexNameFinder​(java.util.regex.Pattern[] patterns,
                               java.lang.String type)
    • Method Detail

      • find

        public Span[] find​(java.lang.String[] tokens)
        Description copied from interface: TokenNameFinder
        Generates name tags for the given sequence, typically a sentence, returning token spans for any identified names.
        Specified by:
        find in interface TokenNameFinder
        Parameters:
        tokens - an array of the tokens or words of the sequence, typically a sentence.
        Returns:
        an array of spans for each of the names identified.
      • find

        public Span[] find​(java.lang.String text)
        NEW. This method removes the need for tokenization, but returns the Span with character indices, rather than word.
        Parameters:
        text -
        Returns:
      • clearAdaptiveData

        public void clearAdaptiveData()
        Description copied from interface: TokenNameFinder
        Forgets all adaptive data which was collected during previous calls to one of the find methods. This method is typical called at the end of a document.
        Specified by:
        clearAdaptiveData in interface TokenNameFinder
      • getmPatterns

        public java.util.regex.Pattern[] getmPatterns()
      • setmPatterns

        public void setmPatterns​(java.util.regex.Pattern[] mPatterns)
      • getsType

        public java.lang.String getsType()
      • setsType

        public void setsType​(java.lang.String sType)