Package opennlp.tools.namefind
Class RegexNameFinder
- java.lang.Object
 - 
- opennlp.tools.namefind.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 voidclearAdaptiveData()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.StringgetsType()voidsetmPatterns(java.util.regex.Pattern[] mPatterns)voidsetsType(java.lang.String sType) 
 - 
 
- 
- 
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) 
- 
RegexNameFinder
@Deprecated public RegexNameFinder(java.util.regex.Pattern[] patterns)
Deprecated.use constructorRegexNameFinder(Pattern[], String)for single types, and/or constructorRegexNameFinder(Map) 
 - 
 
- 
Method Detail
- 
find
public Span[] find(java.lang.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(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: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 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)
 
 - 
 
 -