Package opennlp.tools.namefind
Class RegexNameFinder
- java.lang.Object
-
- opennlp.tools.namefind.RegexNameFinder
-
- All Implemented Interfaces:
TokenNameFinder
public final class RegexNameFinder extends Object implements TokenNameFinder
Name finder based on a series of regular expressions.
-
-
Constructor Summary
Constructors Constructor Description RegexNameFinder(Map<String,Pattern[]> regexMap)RegexNameFinder(Pattern[] patterns)Deprecated.RegexNameFinder(Pattern[] patterns, String type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearAdaptiveData()Forgets all adaptive data which was collected during previous calls to one of the find methods.Span[]find(String text)NEW.Span[]find(String[] tokens)Generates name tags for the given sequence, typically a sentence, returning token spans for any identified names.Pattern[]getmPatterns()StringgetsType()voidsetmPatterns(Pattern[] mPatterns)voidsetsType(String sType)
-
-
-
Constructor Detail
-
RegexNameFinder
@Deprecated public RegexNameFinder(Pattern[] patterns)
Deprecated.use constructorRegexNameFinder(Pattern[], String)for single types, and/or constructorRegexNameFinder(Map)
-
-
Method Detail
-
find
public Span[] find(String[] tokens)
Description copied from interface:TokenNameFinderGenerates name tags for the given sequence, typically a sentence, returning token spans for any identified names.- Specified by:
findin interfaceTokenNameFinder- 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(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:TokenNameFinderForgets 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:
clearAdaptiveDatain interfaceTokenNameFinder
-
getmPatterns
public Pattern[] getmPatterns()
-
setmPatterns
public void setmPatterns(Pattern[] mPatterns)
-
getsType
public String getsType()
-
setsType
public void setsType(String sType)
-
-