Hi,

the recent changes to SenenceDetectorME.train methods break backward compatibility.

In the opennlp-uima package we have some code which calls the train method:
    SentenceModel sentenceModel = SentenceDetectorME.train(language,
        ObjectStreamUtils.createObjectStream(sentenceSamples), true, null);

Since it is passing in null for the dictionary the compiler now doesn't know
which of the two train methods should be called, and therefore produces
this error:
/home/hudson/hudson-slave/workspace/OpenNLP/trunk/opennlp-uima/src/main/java/opennlp/uima/sentdetect/SentenceDetectorTrainer.java:[137,52] reference to train is ambiguous, both method train(java.lang.String,opennlp.tools.util.ObjectStream<opennlp.tools.sentdetect.SentenceSample>,boolean,opennlp.tools.dictionary.Dictionary) in opennlp.tools.sentdetect.SentenceDetectorME and method train(java.lang.String,opennlp.tools.util.ObjectStream<opennlp.tools.sentdetect.SentenceSample>,boolean,opennlp.tools.dictionary.AbbreviationDictionary) in opennlp.tools.sentdetect.SentenceDetectorME match

Since passing null is allowed, we cannot add such a method here.

I also noticed that you added the following method:
train(String languageCode,
      ObjectStream<SentenceSample> samples, boolean useTokenEnd,
      AbbreviationDictionary abbreviations, int cutoff, int iterations)

This should be removed again, because passing of cutoff and iterations is replaced by this new TrainingParameters object. We still have to go through the code and deprecate
all these methods.

Jörn


Reply via email to