uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Eckart de Castilho <richard.eck...@gmail.com>
Subject Re: UIMA subiterator
Date Wed, 03 Apr 2013 16:56:06 GMT
Hi Thomas,

subiterators only work properly if type priorities have been configured.
You can either use selectCovered or configure type priorities.

Auto-detection of type priorities is not yet implemented in uimaFIT. See

	https://issues.apache.org/jira/browse/UIMA-2533

Cheers,

-- Richard

Am 03.04.2013 um 12:48 schrieb "Thomas Gruber" <thomas.gruber@econob.com>:

> Hi,
> 
> 
> 
> I have a problem with the subiterator and would appreciate any help on this
> issue. I use uimafit 1.4.0 and uimaj-core 2.4.0
> 
> Subiterator in use is:
> http://uima.apache.org/d/uimaj-2.3.1/api/org/apache/uima/cas/text/Annotation
> Index.html#subiterator%28org.apache.uima.cas.text.AnnotationFS,%20boolean,%2
> 0boolean%29
> 
> 
> 
> I have an annotation "Sentence" which covers a sentence. 
> 
> Then I have an annotation "Value" which covers numerical values in a
> sentence.
> 
> 
> 
> Example: "This is sentence A with no value. This is sentence B with value
> 377." causes 
> 
> -          two "Sentence" annotations: "This is sentence A with no value."
> and "This is sentence B with value 377."
> 
> -          one  "Value" annotation: "377"
> 
> 
> 
> Now, if I want to get all "Value" annotations of each "Sentence", I iterate
> over the "Sentence"-anntotations and then use a subiterator to iterate over
> all "Value"-annotations within this sentence. 
> 
> 
> 
> The problem occurs if I set the "strict" parameter to "false". In this case,
> for the first Sentence the subiterator also returns the value of the second
> sentence, i.e. "377" is returned for the sentence "This is sentence A with
> no value."
> 
> Normally, according to the javadoc, only annotations should returned with
> "annot < b and annot.getBegin() <= b.getBegin() <= annot.getEnd()".
> 
> 
> 
> The (abstracted) code fragment looks as follow:
> 
> 
> 
> Iterator<SentenceAnnotation> it = JCasUtil.iterator(myCAS,
> SentenceAnnotation.class);
> 
> 
> 
> while (it.hasNext()) {
> 
> 
> 
> Sentence sa = it.next();
> 
> 
> 
> Iterator<Value> it3 = JCasUtil.iterator(sa, Value.class, false, false);
> 
> 
> 
>                                while (it3.hasNext()) {
> 
> 
> 
>                                               Value tempAmount =
> it3.next();
> 
> 
> 
>                if (tempAmount.getBegin() > sa.getEnd()) {
> 
>                        System.out.println("
> -------------------------------- ERROR ------------------------- This
> sentence covers a value which is out of bounds!");
> 
>                }
> 
>                                  }
> 
> }
> 
> 
> 
> Thank you in advance. 
> 
> Best regards,
> 
> Thomas


Mime
View raw message