|
Thilo and Marshall, Thanks for sharing the tip. Indeed it would be a good idea to add this little example to the documentation. A quick comment about the Iterator methods. I had a problem with the following piece of code: while (wordFormIterator.hasNext()){ WordForm wf = (WordForm)wordFormIterator.next(); if (wf.getBegin()==token.getBegin() && wf.getEnd()==token.getEnd()){ liste.add(wf); } else { // move back wordFormIterator.moveToPrevious(); return liste; } } The last element of the iterator was never accessible because hasNext() returned false despite the fact that there WAS an element left in there. moveToPrevious had been previously called on this iterator. Should not hasNext() return true even if the cursor has been moved forward or backward within the iterator? Or is the use of the legacy methods (hasNext(), next()) incompatible with the moveTo* methods? Thanks Julien To be a bit more explicit, here's some code that will determine how many tokens the longest sentence in the document contains. It's a silly example, but it illustrates the concept. Maybe this should go in the docs. Note: I have not actually run this code, it may not work immediately ;-) |
- Re: Why XmiCasSerializer is slow Eddie Epstein
- Re: Why XmiCasSerializer is slow Adam Lally
- Re: Why XmiCasSerializer is slow Marshall Schor
- Re: Why XmiCasSerializer is slow Thilo Goetz
- Re: Why XmiCasSerializer is slow [EMAIL PROTECTED]
- Re: Why XmiCasSerializer is slow Marshall Schor
- Re: Why XmiCasSerializer is slow Thilo Goetz
- get all the annotations located between two... Julien Nioche
- Re: get all the annotations located bet... Marshall Schor
- Re: get all the annotations locate... Thilo Goetz
- Iterators: problem when using ... Julien Nioche
- Re: Iterators: problem when us... Thilo Goetz
