Class RegexNameFinder
java.lang.Object
opennlp.tools.namefind.RegexNameFinder
- All Implemented Interfaces:
opennlp.tools.namefind.TokenNameFinder
A
TokenNameFinder implementation based on a series of regular expressions.-
Constructor Summary
ConstructorsConstructorDescriptionRegexNameFinder(Map<String, Pattern[]> regexMap) Initializes aRegexNameFinderinstance.RegexNameFinder(Pattern[] patterns, String type) Initializes aRegexNameFinderinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidopennlp.tools.util.Span[]Findsspanswith character indices, rather than word.opennlp.tools.util.Span[]Pattern[]voidsetMatchingPatterns(Pattern[] mPatterns) voidsetSpanType(String sType)
-
Constructor Details
-
RegexNameFinder
-
RegexNameFinder
Initializes aRegexNameFinderinstance.- Parameters:
patterns- Thepatternsto use. Must not benulland not be empty.type- The type to use.- Throws:
IllegalArgumentException- Thrown ifpatternswerenullor empty.
-
-
Method Details
-
find
- Specified by:
findin interfaceopennlp.tools.namefind.TokenNameFinder
-
find
Findsspanswith character indices, rather than word.- Parameters:
text- The text to use.- Returns:
- A
Spanrepresenting the annotations.
-
clearAdaptiveData
public void clearAdaptiveData()- Specified by:
clearAdaptiveDatain interfaceopennlp.tools.namefind.TokenNameFinder
-
getMatchingPatterns
- Returns:
- Retrieves the
matching patternsused.
-
setMatchingPatterns
- Parameters:
mPatterns- Thematching patternsto be set.
-
getSpanType
- Returns:
- Retrieves the
Spantype used.
-
setSpanType
- Parameters:
sType- Sets a (different)Spantype.
-