google-code-export / uimafit

Automatically exported from code.google.com/p/uimafit
2 stars 1 forks source link

move methods from Cleartk AnnotationRetrieval to JCasUtil #32

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
There are a number of convenience methods here:

http://code.google.com/p/cleartk/source/browse/trunk/ClearTK-framework/src/main/
java/org/cleartk/util/AnnotationRetrieval.java

Many of these would naturally sit in the JCasUtil class.  We can move/borrow 
whatever code that may be of use to uimaFIT and merge it with the code you're 
working on as we see fit.  If I remember right, our unit tests for these 
methods had a number of tricky edge cases and so it might be worth refactoring 
some of those tests to work with whatever api ends up in uimaFIT regardless of 
whether any of the code in AnnotationRetrieval ends up being useful.  

When we move the methods we should rename them so that they fit better into the 
select* naming convention used in JCasUtil - e.g. selectCovered, 
selectCovering, selectOverlapping, selectRightOverlapping, 
selectLeftOverlapping, selectBefore, selectAfter, selectLeftAdjacent, 
selectRightAdjacent, etc.

Original issue reported on code.google.com by pvogren@gmail.com on 2 Jul 2010 at 4:44

GoogleCodeExporter commented 9 years ago
It may be wise to have these methods as a JCas variant in JCasUtil and as a 
pure CAS variant in CasUtil - cf. JCasUtil/CasUtil.selectPreceeding().

Original comment by richard.eckart on 3 Jan 2011 at 4:20

GoogleCodeExporter commented 9 years ago

Original comment by pvogren@gmail.com on 4 Jan 2011 at 12:14

GoogleCodeExporter commented 9 years ago
I've briefly looked at AnnotationRetrieval, but I didn't immediately see if 
there is still something there that is not yet covered by JCasUtil and CasUtil. 
Is there anything in particular that you would like to migrate or have 
re-implemented in uimaFIT?

Original comment by richard.eckart on 16 Mar 2011 at 11:57

GoogleCodeExporter commented 9 years ago
Some of those methods aren't used, but of the ones that are, it looks like 
we're still missing the methods for selecting annotations that exactly match a 
span, and for selecting the first and last annotations from a window:

getAnnotations(..., true) -> selectMatching(jCas, Class<T>, Annotation)
getAnnotations(..., true) -> selectMatching(jCas, Class<T>, int, int)
getMatchingAnnotation -> selectSingleMatching(jCas, Class<T>, Annotation)
getMatchingAnnotation -> selectSingleMatching(jCas, Class<T>, int, int)
getFirstAnnotation -> selectFirstCovered(jCas, Class<T>, Annotation)
getLastAnnotation -> selectLastCovered(jCas, Class<T>, Annotation)

For the selectSingleMatching methods, they should probably throw exceptions 
like selectSingle does (rather than returning null like I think they currently 
do).

Original comment by steven.b...@gmail.com on 17 Mar 2011 at 7:08

GoogleCodeExporter commented 9 years ago

Original comment by richard.eckart on 18 Mar 2011 at 4:11

GoogleCodeExporter commented 9 years ago
These issues are candidates for version 1.3.0.

Original comment by richard.eckart on 7 May 2011 at 5:31

GoogleCodeExporter commented 9 years ago
I upgraded ClearTK to UimaFIT 1.2.0. Here are the methods that I wanted more 
than once:

List<T> selectMatching(JCas jCas, Class<T> selectedType, Annotation annotation)
T selectSingleMatching(JCas jCas, Class<T> selectedType, Annotation annotation)

For that latter one, I have at least one use case where I actually want 
something like selectZeroOrOneMatching, where an exception is thrown for 2 or 
more found, but I get null back for if there were 0.  Perhaps if we go the 
Issue 65 route, we could end up with something like:

SQLCAS.from(jCas).selectMatching(type, annotation).zeroOrOne()
SQLCAS.from(jCas).selectCovered(type, annotation).single()
SQLCAS.from(jCas).select(type).atIndex(4)

Original comment by steven.b...@gmail.com on 9 May 2011 at 3:46

GoogleCodeExporter commented 9 years ago

Original comment by richard.eckart on 4 Jan 2012 at 10:51

GoogleCodeExporter commented 9 years ago

Original comment by richard.eckart on 5 Jul 2012 at 4:02

GoogleCodeExporter commented 9 years ago

Original comment by richard.eckart on 7 Jan 2013 at 4:51

GoogleCodeExporter commented 9 years ago

Original comment by richard.eckart on 25 Aug 2013 at 8:17