我想为印度人的名字训练一个语料库:
class NameTraining
{
public static void TrainNames() throws IOException
{
Charset charset = Charset.forName("UTF-8");
FileReader fileReader = new FileReader("train.txt");
ObjectStream fileStream = new PlainTextByLineStream(fileReader);
ObjectStream sampleStream = new NameSampleDataStream(fileStream);
TokenNameFinderModel model = NameFinderME.train("pt-br", "train", sampleStream, Collections.<String, Object>emptyMap());
NameFinderME nfm = new NameFinderME(model);
}
public static void main(String args[]) throws IOException
{
NameTraining det = new NameTraining();
det.TrainNames();
}
}
我使用以下命令编译它:
javac -cp $(echo lib/*.jar | tr ' ' ':') NameTraining.java -Xlint:unchecked
但是我收到这些错误消息
NameTraining.java:35: warning: [unchecked] unchecked conversion
found : opennlp.tools.util.ObjectStream
required: opennlp.tools.util.ObjectStream<java.lang.String>
ObjectStream sampleStream = new NameSampleDataStream(fileStream);
^
NameTraining.java:36: warning: [unchecked] unchecked conversion
found : opennlp.tools.util.ObjectStream
required: opennlp.tools.util.ObjectStream<opennlp.tools.namefind.NameSample>
TokenNameFinderModel model = NameFinderME.train("pt-br", "train", sampleStream, Collections.<String, Object>emptyMap());
^
2 warnings
我想知道两件事
- 上面的代码对训练是否正确,如果是,那么我如何在训练后检查结果?
- 警告是什么意思?