AlexPoint/OpenNlp

Name entity recognition not working correct for second call

juergenr opened this issue · 0 comments

When calling nameFinder.GetNames(models, "in 2005"); the second time, the tags are missing or the whole tagging is corrupted.
The first time is working fine, the second using an total different input is working in most cases - but not the same or some similar sentence!

A dirty work-a-round is to recreate the Beam in the Find method of the MaximumEntropyNameFinder.

MaximumEntropyNameFinder.cs:
public virtual string[] Find(string[] tokens, IDictionary previousTags)
{
       //Dirty hack to fix an error for a repeated call 
       mBeam = new NameBeamSearch(this, mBeamSize, mContextGenerator, mModel, mBeamSize); 

       mBestSequence = mBeam.BestSequence(tokens, new object[]{previousTags});
       return mBestSequence.Outcomes.ToArray();
}

May be you can correct the issue, I do not really understand what went wrong.