Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Examples for using Apache UIMA in a java program

Tags:

java

apache

uima

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 ?

like image 891
Arun R Avatar asked May 15 '11 14:05

Arun R


2 Answers

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());
                }
        }
}
like image 152
Renaud Avatar answered Nov 20 '22 16:11

Renaud


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.

like image 3
Dmitry Avatar answered Nov 20 '22 16:11

Dmitry