Java Code Examples for org.apache.uima.UIMAException
The following examples show how to use
org.apache.uima.UIMAException. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: baleen Source File: SelectorTest.java License: Apache License 2.0 | 6 votes |
@Test public void testPseudoContains() throws UIMAException { Node<Structure> doc = createStructure( "<div><p>The Rain.</p> <p class=light>The <i>rain</i>.</p> <p>Rain, the.</p></div>"); Nodes<Structure> ps1 = doc.select("Paragraph:contains(Rain)"); assertEquals(3, ps1.size()); Nodes<Structure> ps2 = doc.select("Paragraph:contains(the rain)"); assertEquals(2, ps2.size()); assertEquals("The Rain.", ps2.first().text()); assertEquals("The rain.", ps2.last().text()); Nodes<Structure> ps3 = doc.select("Paragraph:contains(the Rain):has(Style)"); assertEquals(1, ps3.size()); assertEquals("The rain.", ps3.first().text()); Nodes<Structure> ps5 = doc.select(":contains(rain)"); assertEquals(5, ps5.size()); // Section, Paragraph, Paragraph, Style, Paragraph }
Example 2
Source Project: bluima Source File: Launcher.java License: Apache License 2.0 | 6 votes |
/** * @param args * the relative path to a pipeline file. If none provided, lists * all available pipelines and asks the user to make a choice. * Then launches the pipeline. */ public static void main(String[] args) throws IOException, UIMAException, ParseException { // no pipeline --> list and ask if (args == null || args.length == 0) { String home = System.getProperty("basedir"); listPipelinesAndAsk(new File(home + "/pipelines")); } // pipeline provided --> run it else if (args.length > 0) { List<String> cliArgs = new ArrayList<String>(); for (int i = 1; i < args.length; i++) { cliArgs.add(args[i]); } runPipeline(new File(args[0]), cliArgs); } else { System.err.println("Please provide a script file"); } }
Example 3
Source Project: baleen Source File: PrintTest.java License: Apache License 2.0 | 6 votes |
@Test public void testRelations() throws UIMAException { final Person s = new Person(jCas); s.setValue("source"); final Location t = new Location(jCas); t.setValue("target"); final Relation r = new Relation(jCas); r.setSource(s); r.setTarget(t); r.setRelationshipType("check"); r.addToIndexes(); SimplePipeline.runPipeline(jCas, AnalysisEngineFactory.createEngine(Relations.class)); }
Example 4
Source Project: baleen Source File: StructuralAnnotationsTest.java License: Apache License 2.0 | 6 votes |
@Test public void testArticle() throws UIMAException { final JCas jCas = JCasSingleton.getJCasInstance(); final StructuralAnnotations sa = new StructuralAnnotations(); final Map<String, Class<?>> expectedArticle = new HashMap<>(); expectedArticle.put("Sheet", Sheet.class); expectedArticle.put("Slide", Slide.class); expectedArticle.put("Page", Page.class); expectedArticle.put("Another", Page.class); for (final Map.Entry<String, Class<?>> e : expectedArticle.entrySet()) { final Element anchor = new Element(Tag.valueOf("article"), ""); anchor.attr("class", e.getKey()); final AnnotationCollector collector = new AnnotationCollector(); sa.map(jCas, anchor, collector); if (e.getValue() != null) { assertTrue(e.getValue().isInstance(collector.getAnnotations().get(0))); } else { assertNull(collector.getAnnotations()); } } }
Example 5
Source Project: baleen Source File: DocumentGraphFactoryTest.java License: Apache License 2.0 | 6 votes |
@Test public void testDocumentGraphWithTypeFiltering() throws UIMAException { Set<Class<? extends Entity>> typeClasses = TypeUtils.getTypeClasses(Entity.class, Person.class.getSimpleName()); DocumentGraphOptions options = DocumentGraphOptions.builder().withTypeClasses(typeClasses).build(); DocumentGraphFactory factory = createfactory(options); JCas jCas = JCasFactory.createJCas(); JCasTestGraphUtil.populateJcas(jCas); Graph graph = factory.create(jCas); assertEquals(2, graph.traversal().V().hasLabel(REFERENCE_TARGET).count().next().intValue()); assertEquals(1, graph.traversal().V().hasLabel(EVENT).count().next().intValue()); assertEquals(3, graph.traversal().V().hasLabel(MENTION).count().next().intValue()); assertEquals(1, graph.traversal().V().hasLabel(RELATION).count().next().intValue()); assertEquals(3, graph.traversal().E().hasLabel(MENTION_OF).count().next().intValue()); assertEquals(2, graph.traversal().E().hasLabel(PARTICIPANT_IN).count().next().intValue()); assertNoDocumentNode(graph); assertNoRelationEdges(graph); assertEquals(7, IteratorUtils.count(graph.vertices())); assertEquals(7, IteratorUtils.count(graph.edges())); }
Example 6
Source Project: baleen Source File: Html5Test.java License: Apache License 2.0 | 6 votes |
@Test public void testCreateExternalIdFile() throws UIMAException { AnalysisEngine consumer = AnalysisEngineFactory.createEngine( Html5.class, TypeSystemSingleton.getTypeSystemDescriptionInstance(), Html5.PARAM_OUTPUT_FOLDER, outputFolder.getPath(), Html5.PARAM_USE_EXTERNAL_ID, true, Html5.PARAM_CONTENT_HASH_AS_ID, false); jCas.setDocumentText("Hello World!"); DocumentAnnotation da = (DocumentAnnotation) jCas.getDocumentAnnotationFs(); da.setSourceUri("hello.txt"); consumer.process(jCas); File f = new File( outputFolder, "734cad14909bedfafb5b273b6b0eb01fbfa639587d217f78ce9639bba41f4415.html"); assertTrue(f.exists()); }
Example 7
Source Project: uima-uimaj Source File: AnnotationViewerDialog.java License: Apache License 2.0 | 6 votes |
/** * Displays an error message to the user. * * @param aThrowable * Throwable whose message is to be displayed. */ public void displayError(Throwable aThrowable) { aThrowable.printStackTrace(); String message = aThrowable.toString(); // For UIMAExceptions or UIMARuntimeExceptions, add cause info. // We have to go through this nonsense to support Java 1.3. // In 1.4 all exceptions can have a cause, so this wouldn't involve // all of this typecasting. while ((aThrowable instanceof UIMAException) || (aThrowable instanceof UIMARuntimeException)) { if (aThrowable instanceof UIMAException) { aThrowable = ((UIMAException) aThrowable).getCause(); } else if (aThrowable instanceof UIMARuntimeException) { aThrowable = ((UIMARuntimeException) aThrowable).getCause(); } if (aThrowable != null) { message += ("\nCausedBy: " + aThrowable.toString()); } } displayError(message); }
Example 8
Source Project: baleen Source File: Html5Test.java License: Apache License 2.0 | 6 votes |
@Test public void testCreateFile() throws UIMAException { AnalysisEngine consumer = AnalysisEngineFactory.createEngine( Html5.class, TypeSystemSingleton.getTypeSystemDescriptionInstance(), Html5.PARAM_OUTPUT_FOLDER, outputFolder.getPath()); jCas.setDocumentText("Hello World!"); DocumentAnnotation da = (DocumentAnnotation) jCas.getDocumentAnnotationFs(); da.setSourceUri("hello.txt"); consumer.process(jCas); File f = new File(outputFolder, "hello.txt.html"); assertTrue(f.exists()); }
Example 9
Source Project: baleen Source File: SentenceFactoryTest.java License: Apache License 2.0 | 6 votes |
@Test public void canCreateSentenceFromAnnotations() throws UIMAException { JCas jCas = JCasFactory.createJCas(); addWordTokens(jCas); SentenceFactory factory = new SentenceFactory(jCas); List<OdinSentence> sentences = factory.create(); assertEquals(1, sentences.size()); Sentence sentence = sentences.get(0); assertEquals( ImmutableSet.of("This", "is", "a", "sentence", "."), ImmutableSet.copyOf(sentence.words())); assertTrue(Arrays.equals(new int[] {0, 5, 8, 10, 18}, sentence.startOffsets())); assertTrue(Arrays.equals(new int[] {4, 7, 9, 18, 19}, sentence.endOffsets())); assertEquals( ImmutableSet.of("this", "is", "a", "lemma", "."), ImmutableSet.copyOf(sentence.lemmas().get())); assertEquals( ImmutableSet.of("DT", "VBZ", "DT", "NN", "."), ImmutableSet.copyOf(sentence.tags().get())); }
Example 10
Source Project: baleen Source File: JsonJCasConverterTest.java License: Apache License 2.0 | 6 votes |
@Test public void testDeserializeBlacklist() throws IOException, UIMAException { List<Class<? extends BaleenAnnotation>> blackList = ImmutableList.<Class<? extends BaleenAnnotation>>of(Person.class); final JsonJCasConverter serializer = createConverter(); final JsonJCasConverter deserializer = createConverter(Collections.emptyList(), blackList); JCasSerializationTester testUtil = new JCasSerializationTester(); final String json = serializer.serialise(testUtil.getIn()); deserializer.deserialise(testUtil.getOut(), json); testUtil.assertTopLevel(); testUtil.assertLocationMatches(); assertFalse(JCasUtil.exists(testUtil.getOut(), Person.class)); }
Example 11
Source Project: inception Source File: ExternalRecommenderIntegrationTest.java License: Apache License 2.0 | 6 votes |
private List<CAS> loadData(Dataset ds, File ... files) throws UIMAException, IOException { CollectionReader reader = createReader(Conll2002Reader.class, Conll2002Reader.PARAM_PATTERNS, files, Conll2002Reader.PARAM_LANGUAGE, ds.getLanguage(), Conll2002Reader.PARAM_COLUMN_SEPARATOR, Conll2002Reader.ColumnSeparators.TAB.getName(), Conll2002Reader.PARAM_HAS_TOKEN_NUMBER, true, Conll2002Reader.PARAM_HAS_HEADER, true, Conll2002Reader.PARAM_HAS_EMBEDDED_NAMED_ENTITY, true); List<CAS> casList = new ArrayList<>(); while (reader.hasNext()) { // Add the CasMetadata type to the CAS List<TypeSystemDescription> typeSystems = new ArrayList<>(); typeSystems.add(createTypeSystemDescription()); typeSystems.add(CasMetadataUtils.getInternalTypeSystem()); JCas cas = JCasFactory.createJCas(mergeTypeSystems(typeSystems)); reader.getNext(cas.getCas()); casList.add(cas.getCas()); } return casList; }
Example 12
Source Project: inception Source File: RemoteStringMatchingNerRecommender.java License: Apache License 2.0 | 6 votes |
public String predict(String aPredictionRequestJson) throws IOException, UIMAException, SAXException, RecommendationException { PredictionRequest request = deserializePredictionRequest(aPredictionRequestJson); CAS cas = deserializeCas(request.getDocument().getXmi(), request.getTypeSystem()); // Only work on real annotations, not on predictions Type predictedType = CasUtil.getType(cas, recommender.getLayer().getName()); Feature feature = predictedType.getFeatureByBaseName(FEATURE_NAME_IS_PREDICTION); for (AnnotationFS fs : CasUtil.select(cas, predictedType)) { if (fs.getBooleanValue(feature)) { cas.removeFsFromIndexes(fs); } } recommendationEngine.predict(context, cas); return buildPredictionResponse(cas); }
Example 13
Source Project: uima-uimaj Source File: AnnotationViewerMain.java License: Apache License 2.0 | 6 votes |
/** * Displays an error message to the user. * * @param aThrowable * Throwable whose message is to be displayed. */ public void displayError(Throwable aThrowable) { aThrowable.printStackTrace(); String message = aThrowable.toString(); // For UIMAExceptions or UIMARuntimeExceptions, add cause info. // We have to go through this nonsense to support Java 1.3. // In 1.4 all exceptions can have a cause, so this wouldn't involve // all of this typecasting. while ((aThrowable instanceof UIMAException) || (aThrowable instanceof UIMARuntimeException)) { if (aThrowable instanceof UIMAException) { aThrowable = ((UIMAException) aThrowable).getCause(); } else if (aThrowable instanceof UIMARuntimeException) { aThrowable = ((UIMARuntimeException) aThrowable).getCause(); } if (aThrowable != null) { message += ("\nCausedBy: " + aThrowable.toString()); } } displayError(message); }
Example 14
Source Project: inception Source File: NamedEntityLinkerTest.java License: Apache License 2.0 | 6 votes |
private List<CAS> loadData(Dataset ds, File ... files) throws UIMAException, IOException { CollectionReader reader = createReader( Conll2002Reader.class, Conll2002Reader.PARAM_PATTERNS, files, Conll2002Reader.PARAM_LANGUAGE, ds.getLanguage(), Conll2002Reader.PARAM_COLUMN_SEPARATOR, Conll2002Reader.ColumnSeparators.TAB.getName(), Conll2002Reader.PARAM_HAS_TOKEN_NUMBER, true, Conll2002Reader.PARAM_HAS_HEADER, true, Conll2002Reader.PARAM_HAS_EMBEDDED_NAMED_ENTITY, true); List<CAS> casList = new ArrayList<>(); while (reader.hasNext()) { JCas cas = JCasFactory.createJCas(); reader.getNext(cas.getCas()); casList.add(cas.getCas()); } return casList; }
Example 15
Source Project: baleen Source File: StructuralAnnotationsTest.java License: Apache License 2.0 | 6 votes |
@Test public void testMain() throws UIMAException { final JCas jCas = JCasSingleton.getJCasInstance(); final StructuralAnnotations sa = new StructuralAnnotations(); final Map<String, Class<?>> expectedMain = new HashMap<>(); expectedMain.put("Document", Document.class); expectedMain.put("SlideShow", SlideShow.class); expectedMain.put("SpreadSheet", SpreadSheet.class); expectedMain.put("Another", Document.class); for (final Map.Entry<String, Class<?>> e : expectedMain.entrySet()) { final Element anchor = new Element(Tag.valueOf("main"), ""); anchor.attr("class", e.getKey()); final AnnotationCollector collector = new AnnotationCollector(); sa.map(jCas, anchor, collector); if (e.getValue() != null) { assertTrue(e.getValue().isInstance(collector.getAnnotations().get(0))); } else { assertNull(collector.getAnnotations()); } } }
Example 16
Source Project: bluima Source File: OpenNlpHelperTest.java License: Apache License 2.0 | 5 votes |
@Test public void testSentenceSplitter() throws UIMAException { String text = "First sentence. Second sentence!"; Pair offsets[] = { new Pair(0, 15), new Pair(16, 32) }; // Run the splitter annotator on `text` JCas jCas = UimaTests.getTestCas(text); runPipeline(jCas, OpenNlpHelper.getSentenceSplitter()); Collection<Sentence> collection = JCasUtil.select(jCas, Sentence.class); Sentence sentences[] = new Sentence[collection.size()]; collection.toArray(sentences); // Make sure the number of sentences and their offsets are corrects assertEquals(sentences.length, offsets.length); for (int i = 0; i < offsets.length; ++i) { Sentence sentence = sentences[i]; Pair offset = offsets[i]; assertEquals(sentence.getBegin(), offset.a); assertEquals(sentence.getEnd(), offset.b); } // Test it on more complex sentences String sentence1 = "Terminologies which lack semantic connectivity hamper the effective search in biomedical fact databases and document retrieval systems."; String sentence2 = "We here focus on the integration of two such isolated resources, the term lists from the protein fact database UNIPROT and the indexing vocabulary MESH from the bibliographic database MEDLINE."; text = String.format("%s %s", sentence1, sentence2); jCas = UimaTests.getTestCas(text); runPipeline(jCas, OpenNlpHelper.getSentenceSplitter()); collection = JCasUtil.select(jCas, Sentence.class); assertEquals(2, collection.size()); Iterator<Sentence> it = collection.iterator(); assertEquals(it.next().getCoveredText(), sentence1); assertEquals(it.next().getCoveredText(), sentence2); }
Example 17
Source Project: webanno Source File: AnnotationSchemaServiceImpl.java License: Apache License 2.0 | 5 votes |
/** * Load the contents from the source CAS, upgrade it to the target type system and write the * results to the target CAS. An in-place upgrade can be achieved by using the same CAS as * source and target. */ @Override public void upgradeCas(CAS aSourceCas, CAS aTargetCas, TypeSystemDescription aTargetTypeSystem) throws UIMAException, IOException { CasStorageSession.get().assertWritingPermitted(aTargetCas); // Save source CAS type system (do this early since we might do an in-place upgrade) TypeSystem sourceTypeSystem = aSourceCas.getTypeSystem(); // Save source CAS contents ByteArrayOutputStream serializedCasContents = new ByteArrayOutputStream(); CAS realSourceCas = getRealCas(aSourceCas); // UIMA-6162 Workaround: synchronize CAS during de/serialization synchronized (((CASImpl) realSourceCas).getBaseCAS()) { serializeWithCompression(realSourceCas, serializedCasContents, sourceTypeSystem); } // Re-initialize the target CAS with new type system CAS realTargetCas = getRealCas(aTargetCas); // UIMA-6162 Workaround: synchronize CAS during de/serialization synchronized (((CASImpl) realTargetCas).getBaseCAS()) { CAS tempCas = CasFactory.createCas(aTargetTypeSystem); CASCompleteSerializer serializer = serializeCASComplete((CASImpl) tempCas); deserializeCASComplete(serializer, (CASImpl) realTargetCas); // Leniently load the source CAS contents into the target CAS CasIOUtils.load(new ByteArrayInputStream(serializedCasContents.toByteArray()), getRealCas(aTargetCas), sourceTypeSystem); } }
Example 18
Source Project: baleen Source File: StructureNodesTest.java License: Apache License 2.0 | 5 votes |
@Test public void eq() throws UIMAException { String h = "<p>Hello<p>there<p>world"; Node<Structure> doc = createStructure(h); assertEquals("there", doc.select("Paragraph").eq(1).text()); assertEquals("there", doc.select("Paragraph").get(1).text()); }
Example 19
Source Project: webanno Source File: ImportExportServiceImpl.java License: Apache License 2.0 | 5 votes |
@Override public File exportCasToFile(CAS aCas, SourceDocument aDocument, String aFileName, FormatSupport aFormat, boolean aStripExtension) throws IOException, UIMAException { return exportCasToFile(aCas, aDocument, aFileName, aFormat, aStripExtension, null); }
Example 20
Source Project: baleen Source File: OpenNLPTest.java License: Apache License 2.0 | 5 votes |
@Override public void beforeTest() throws UIMAException { super.beforeTest(); ExternalResourceDescription tokensDesc = ExternalResourceFactory.createNamedResourceDescription("tokens", SharedOpenNLPModel.class); ExternalResourceDescription sentencesDesc = ExternalResourceFactory.createNamedResourceDescription( "sentences", SharedOpenNLPModel.class); ExternalResourceDescription posDesc = ExternalResourceFactory.createNamedResourceDescription("posTags", SharedOpenNLPModel.class); ExternalResourceDescription chunksDesc = ExternalResourceFactory.createNamedResourceDescription( "phraseChunks", SharedOpenNLPModel.class); AnalysisEngineDescription descLanguage = AnalysisEngineFactory.createEngineDescription( uk.gov.dstl.baleen.annotators.language.OpenNLP.class, "tokens", tokensDesc, "sentences", sentencesDesc, "posTags", posDesc, "phraseChunks", chunksDesc); aeLanguage = AnalysisEngineFactory.createEngine(descLanguage); String text = "This is a mention of John Smith visiting Thomas Brown at the United Nations in New York on the afternoon of February 10th, 2014."; jCas.setDocumentText(text); }
Example 21
Source Project: ambiverse-nlu Source File: DocumentProcessor.java License: Apache License 2.0 | 5 votes |
private ProcessedDocument process(JCas jcas) throws UIMAException, IOException, ClassNotFoundException, EntityLinkingDataAccessException, MissingSettingException, NoSuchMethodException, UnprocessableDocumentException { if (!canProcess(jcas.getDocumentText())) { AidaDocumentSettings md = selectSingle(jcas, AidaDocumentSettings.class); throw new UnprocessableDocumentException( "Document " + md.getDocumentId() + " cannot be processed"); //Add id reference check what to do with collections } AnalysisEngine ae = PipelinesHolder.getAnalyisEngine(type); ae.process(jcas); ProcessedDocument pd = OutputUtils.generateProcessedPutputfromJCas(jcas); return pd; }
Example 22
Source Project: baleen Source File: GenericVehicleTest.java License: Apache License 2.0 | 5 votes |
@Test public void testMultipleSentences() throws UIMAException { jCas.setDocumentText( "It was red. Hovercraft was the password. A blue satellite was the future."); createSentences(jCas); createWordTokens(jCas); processJCas(); assertAnnotations( 2, Vehicle.class, new TestVehicle(0, "Hovercraft", "OTHER"), new TestVehicle(1, "blue satellite", "SPACE")); }
Example 23
Source Project: baleen Source File: MetaTagTest.java License: Apache License 2.0 | 5 votes |
@Test public void testNameContent() throws UIMAException { JCas jCas = JCasSingleton.getJCasInstance(); MetaTags mt = new MetaTags(); Element element = new Element(Tag.valueOf("meta"), ""); element.attr("name", "key"); element.attr("content", "value"); AnnotationCollector collector = new AnnotationCollector(); mt.map(jCas, element, collector); Metadata annotation = (Metadata) collector.getAnnotations().get(0); assertEquals("key", annotation.getKey()); assertEquals("value", annotation.getValue()); }
Example 24
Source Project: baleen Source File: AbstractRdfDocumentGraphConsumer.java License: Apache License 2.0 | 5 votes |
@Override public void doInitialize(UimaContext aContext) throws ResourceInitializationException { outputDocument = true; try { TypeSystem typeSystem = JCasFactory.createJCas().getTypeSystem(); OwlSchemaFactory schemaFactory = new OwlSchemaFactory(namespace, typeSystem, Arrays.asList(ignoreProperties)); documentOntology = schemaFactory.createDocumentOntology(); } catch (CASRuntimeException | UIMAException e) { throw new ResourceInitializationException(e); } super.doInitialize(aContext); }
Example 25
Source Project: bluima Source File: Pipeline.java License: Apache License 2.0 | 5 votes |
public void run(JCas jCas) throws UIMAException, IOException { try { JcasPipelineBuilder builder = new JcasPipelineBuilder(jCas); build(builder); builder.process(); } catch (Exception e) { throw new UIMAException(e); } }
Example 26
Source Project: baleen Source File: JCasMetadataTest.java License: Apache License 2.0 | 5 votes |
@Before public void setUp() throws UIMAException { JCas jCas = JCasFactory.createJCas(); addMetadata(jCas, KEY1, VALUE1); addMetadata(jCas, KEY2, VALUE2); addMetadata(jCas, KEY2, VALUE3); metadata = new JCasMetadata(jCas); }
Example 27
Source Project: ambiverse-nlu Source File: UimaPOSTagger.java License: Apache License 2.0 | 5 votes |
public static void main(String[] args) throws MissingSettingException, ClassNotFoundException, IOException, UnprocessableDocumentException, EntityLinkingDataAccessException, NoSuchMethodException, UIMAException { if (args.length != 3) { System.out.println("Usage: de.mpg.mpi_inf.ambiversenlu.nlu.entitylinking.uima.customComponents.aes.UimaPOSTagger <tsv source> <language - 3 code> <destination>"); return; } EntityLinkingManager.init(); new UimaPOSTagger().run(args[1], args[0], args[2]); }
Example 28
Source Project: uima-uimafit Source File: CollectionReaderFactoryExternalResourceTest.java License: Apache License 2.0 | 5 votes |
@Test public void testAutoExternalResourceBinding() throws UIMAException, IOException { CollectionReader reader = createReader( TestReader.class, TestReader.PARAM_RESOURCE, createResourceDescription(TestExternalResource.class, TestExternalResource.PARAM_VALUE, TestExternalResource.EXPECTED_VALUE)); reader.hasNext(); }
Example 29
Source Project: baleen Source File: SelectorTest.java License: Apache License 2.0 | 5 votes |
@Test public void testPseudoGreaterThan() throws UIMAException { Node<Structure> doc = createStructure("<div><p>One</p><p>Two</p><p>Three</p></div><div><p>Four</p>"); Nodes<Structure> ps = doc.select("Section Paragraph:gt(0)"); assertEquals(2, ps.size()); assertEquals("Two", ps.get(0).text()); assertEquals("Three", ps.get(1).text()); }
Example 30
Source Project: bluima Source File: LanguageDetectionAnnotatorTest.java License: Apache License 2.0 | 5 votes |
private Object getLang(String testSentence) throws UIMAException { JCas jCas = getTestCas(testSentence); AnalysisEngine ae = createEngine(LanguageDetectionAnnotator.class, LanguageDetectionAnnotator.MIN_TEXT_LENGTH, 1); ae.process(jCas); return jCas.getDocumentLanguage(); }