我想知道是否有人可以向我解释下面的代码行是什么?Java:While循环中嵌入的Equals语句
while((sample = samples.read()) != null)
是否先设置sample
等于samples
下一行,然后进行检查,以确保它不是空的?
这是一个更普遍的问题,但如果任何人有一个很好的OpenNLP教程,我也会很感激。
这里是将其全部方法:
public static Dictionary buildNGramDictionary(ObjectStream samples, int cutoff) throws IOException {
NGramModel ngramModel = new NGramModel();
POSSample sample;
while((sample = samples.read()) != null) {
String[] words = sample.getSentence();
if (words.length > 0)
ngramModel.add(new StringList(words), 1, 1);
}
ngramModel.cutoff(cutoff, Integer.MAX_VALUE);
return ngramModel.toDictionary(true);
}
更高的优先级是的,这正是它的作用。除了设置LHS之外,'='操作还是评估RHS的值。 – biziclop 2012-07-12 20:14:34