uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Eckart de Castilho (JIRA)" <...@uima.apache.org>
Subject [jira] [Updated] (UIMA-3403) selectPreceding() does not return preceding for last annotation
Date Sat, 02 Nov 2013 12:07:17 GMT

     [ https://issues.apache.org/jira/browse/UIMA-3403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Richard Eckart de Castilho updated UIMA-3403:
---------------------------------------------

    Affects Version/s: 2.0.0uimaFIT

> selectPreceding() does not return preceding for last annotation
> ---------------------------------------------------------------
>
>                 Key: UIMA-3403
>                 URL: https://issues.apache.org/jira/browse/UIMA-3403
>             Project: UIMA
>          Issue Type: Bug
>          Components: uimaFIT
>    Affects Versions: 2.0.0uimaFIT
>            Reporter: Torsten Zesch
>             Fix For: 2.0.1uimaFIT
>
>
> selectPreceding() does not return the preceding element for the last element in the CAS
if one is looking for a different annotation type than the anchor.
> See the test below.
> If the anchor is a token and I want the preceding tokens, everything is fine, but when
I use a token anchor to get the preceding lemmas, no lemma is returned for the last token
in the CAS.
> Offset are exactly the same so the behaviour is unexpected.
> {noformat}
> @Test
>     public void test() 
>         throws Exception 
>     {
>         String testDocument = "This is a test document .\nIt is quite short .\n";
>         AnalysisEngine engine = AnalysisEngineFactory.createEngine(NoOpAnnotator.class);
>         JCas jcas = engine.newJCas();
>         TokenBuilder<Token, Sentence> tb = TokenBuilder.create(Token.class, Sentence.class);
>         tb.buildTokens(jcas, testDocument);
>         engine.process(jcas);
>         
>         for (Token token : JCasUtil.select(jcas, Token.class)) {
>             Lemma lemma = new Lemma(jcas, token.getBegin(), token.getEnd());
>             lemma.addToIndexes();          
>         }
>         for (Token token : JCasUtil.select(jcas, Token.class)) {
> //            try {
> //                List<Token> previous = JCasUtil.selectPreceding(Token.class,
token, 1);
> //                System.out.println(previous.get(0).getCoveredText());
> //            }
> //            catch (IndexOutOfBoundsException e) {
> //                System.out.println(token);
> //            }
>             try {
>                 List<Lemma> previous = JCasUtil.selectPreceding(Lemma.class, token,
1);
>                 System.out.println(previous.get(0).getCoveredText());
>             }
>             catch (IndexOutOfBoundsException e) {
>                 System.out.println(token);
>             }
>         }
>     }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message