Package opennlp.tools.namefind
Class RegexNameFinder
java.lang.Object
opennlp.tools.namefind.RegexNameFinder
- All Implemented Interfaces:
- TokenNameFinder
A 
TokenNameFinder implementation based on a series of regular expressions.- 
Constructor SummaryConstructorsConstructorDescriptionRegexNameFinder(Map<String, Pattern[]> regexMap) Initializes aRegexNameFinderinstance.RegexNameFinder(Pattern[] patterns, String type) Initializes aRegexNameFinderinstance.
- 
Method SummaryModifier and TypeMethodDescriptionvoidForgets all adaptive data which was collected during previous calls to one of the find methods.Span[]Findsspanswith character indices, rather than word.Span[]Generates name tags for the given sequence, typically a sentence, returningtoken spansfor any identified names.Pattern[]voidsetMatchingPatterns(Pattern[] mPatterns) voidsetSpanType(String sType) 
- 
Constructor Details- 
RegexNameFinderInitializes aRegexNameFinderinstance.
- 
RegexNameFinderInitializes aRegexNameFinderinstance.- Parameters:
- patterns- The- patternsto use. Must not be- nulland not be empty.
- type- The type to use.
- Throws:
- IllegalArgumentException- Thrown if- patternswere- nullor empty.
 
 
- 
- 
Method Details- 
findDescription copied from interface:TokenNameFinderGenerates name tags for the given sequence, typically a sentence, returningtoken spansfor any identified names.- Specified by:
- findin interface- TokenNameFinder
- Parameters:
- tokens- An array of the tokens or words of the sequence, typically a sentence.
- Returns:
- An array of spansfor each of the names identified.
 
- 
findFindsspanswith character indices, rather than word.- Parameters:
- text- The text to use.
- Returns:
- A Spanrepresenting the annotations.
 
- 
clearAdaptiveDatapublic void clearAdaptiveData()Description copied from interface:TokenNameFinderForgets all adaptive data which was collected during previous calls to one of the find methods.Note: This method should typically be called at the end of the processing of a document. - Specified by:
- clearAdaptiveDatain interface- TokenNameFinder
 
- 
getMatchingPatterns- Returns:
- Retrieves the matching patternsused.
 
- 
setMatchingPatterns- Parameters:
- mPatterns- The- matching patternsto be set.
 
- 
getSpanType- Returns:
- Retrieves the Spantype used.
 
- 
setSpanType- Parameters:
- sType- Sets a (different)- Spantype.
 
 
-