Hi Ben,
I am not sure this is what you want, but there is a DictionaryNameFinder
class in OpenNLP that looks for instances of names in text. It is not a
statistical name finder though. I have attached a watered down example.
Notice that “Frank” is left out (not in the dictionary).
import opennlp.tools.dictionary.Dictionary;
import opennlp.tools.namefind.DictionaryNameFinder;
import opennlp.tools.tokenize.WhitespaceTokenizer;
import opennlp.tools.util.Span;
import opennlp.tools.util.StringList;
public class MyDictionaryNameFinder {
public MyDictionaryNameFinder() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
Dictionary dictionary = new Dictionary();
dictionary.put(new StringList("Daniel"));
dictionary.put(new StringList("Al"));
dictionary.put(new StringList("Bob"));
String sent="Daniel and Al e-mailed Bob and Frank the plans.";
DictionaryNameFinder nf = new DictionaryNameFinder(dictionary);
String[] tokens=WhitespaceTokenizer.INSTANCE.tokenize(sent);
Span[] nameSpans=nf.find(tokens);
String[] names = Span.spansToStrings(nameSpans, tokens);
for (int i=0;i<names.length;i++) {
System.out.println(nameSpans[i] +" "+ names[i]);
}
}
}
[0..1) default Daniel
[2..3) default Al
[4..5) default Bob
> On Oct 3, 2017, at 2:27 PM, Benedict Holland <[email protected]>
> wrote:
>
> Hello all,
>
> We are attempting to develop a model with a list of names. We have a long
> and comprehensive list of names but very little text surrounding them. We
> have some text that we can tag, though not much. Is it possible to create a
> name finding model using a simple list like this or do we have to
> absolutely have text?
>
> Thanks,
> ~Ben