You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@opennlp.apache.org by Benedict Holland <be...@gmail.com> on 2017/10/03 18:27:16 UTC
List of names training name finder
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
Re: List of names training name finder
Posted by Benedict Holland <be...@gmail.com>.
Oh this is an excellent start. Also, it will allow us to at least start
getting sentences that contain these selected names to grow the ME model.
Thank you so much!
~Ben
On Tue, Oct 3, 2017 at 2:45 PM, Dan Russ <da...@gmail.com> wrote:
> 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 <
> benedict.m.holland@gmail.com> 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
>
>
Re: List of names training name finder
Posted by Dan Russ <da...@gmail.com>.
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 <be...@gmail.com> 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