On 15.12.14 14:11, Michael Sokolov wrote:
I'm not sure, but is it necessary to set positionIncAttr to 1 when there
are *not* any lemmas found?  I think the usual pattern is to call
clearAttributes() at the start of incrementToken

It is set to 0 only if there are stems/lemmas found:
if (!terms.isEmpty()) {
  positionAttr.setPositionIncrement(0);

The terms list will only contain entries if there are lemmas found.

But maybe I should empty this list before I return true, just like this?

if (!terms.isEmpty()) {
  termAtt.setEmpty().append(terms.poll());
  positionAttr.setPositionIncrement(0);
  terms.clear();
  return true;
} else if ...

Reply via email to