Class RegexNameFinder

Namespace
NOpenNLP.Tools.Namefind
Assembly
NOpenNLP.Tools.dll

Name finder based on a series of regular expressions.

public sealed class RegexNameFinder : ITokenNameFinder
Inheritance
RegexNameFinder
Implements
Inherited Members

Constructors

RegexNameFinder(IDictionary<string, Regex[]>)

public RegexNameFinder(IDictionary<string, Regex[]> regexMap)

Parameters

regexMap IDictionary<string, Regex[]>

RegexNameFinder(Regex[])

Use the RegexNameFinder(Regex[], string?) constructor for single types, and/or the RegexNameFinder(IDictionary<string, Regex[]>) constructor.

[Obsolete]
public RegexNameFinder(Regex[] patterns)

Parameters

patterns Regex[]

RegexNameFinder(Regex[], string?)

public RegexNameFinder(Regex[] patterns, string? type)

Parameters

patterns Regex[]
type string

Properties

Patterns

public Regex[]? Patterns { get; set; }

Property Value

Regex[]

Type

public string? Type { get; set; }

Property Value

string

Methods

ClearAdaptiveData()

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.

public void ClearAdaptiveData()

Find(string)

NEW. This method removes the need for tokenization, but returns the Span with character indices, rather than word.

public Span[] Find(string text)

Parameters

text string

The text to search.

Returns

Span[]

The character-index spans of the matches.

Find(string[])

Generates name tags for the given sequence, typically a sentence, returning token spans for any identified names.

public Span[] Find(string[] tokens)

Parameters

tokens string[]

an array of the tokens or words of the sequence, typically a sentence.

Returns

Span[]

an array of spans for each of the names identified.