Examples for using Apache UIMA in a java program
Asked Answered
C

2

6

I have been searching for examples of using Apache UIMA in a java program. Are there examples on how to use the example Annotators in a Java program ?

Corie answered 15/5, 2011 at 14:24 Comment(0)
J
6

If you want to use UIMA directly into Java code, you might want to have a look at uimafit, because it eases the use of UIMA from within Java. Here is a quick example to use the example Annotator (source)

public class RoomNumberAnnotatorPipeline {

        public static void main(String[] args) throws UIMAException {
                String text = "The meeting was moved from Yorktown 01-144 to Hawthorne 1S-W33.";
                TypeSystemDescription tsd = createTypeSystemDescription(
                                "org.uimafit.examples.tutorial.type.RoomNumber");
                JCas jCas = createJCas(tsd);
                jCas.setDocumentText(text);

                AnalysisEngine analysisEngine = createPrimitive(RoomNumberAnnotator.class, tsd);
                analysisEngine.process(jCas);

                for (RoomNumber roomNumber : select(jCas, RoomNumber.class)) {
                        System.out.println(roomNumber.getCoveredText() + "\tbuilding = "
                                        + roomNumber.getBuilding());
                }
        }
}
Jez answered 19/12, 2011 at 8:59 Comment(2)
a little late, but one shortcoming is uimafit doesn't support pear packages.Brucie
@Brucie try with groups.google.com/forum/?fromgroups=#!topic/uimafit-users/…Jez
F
3

Yes there are examples provided in UIMA SDK. You need to read developers guide here how to view the source in Eclipse.UIMA Tutorial and Dev Guide. Look at section 1.1.3 and Chapter 3.

Fanny answered 19/5, 2011 at 22:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.