String language = tcas.getDocumentLanguage();
public void configure(CAS aCas) throws AnalysisEngineProcessException { try { language = aCas.getDocumentLanguage(); super.configure(); } catch (IOException e) { throw new AnalysisEngineProcessException(e); } }
if (tokens.get(0).getCAS().getDocumentLanguage().equals("en")) { wordnet = uby.getLexiconByName("WordNet"); } else if (tokens.get(0).getCAS().getDocumentLanguage().equals("de")) { wordnet = uby.getLexiconByName("GermaNet");
public void process(CAS aCAS) throws AnalysisEngineProcessException { // get handle to CAS view containing XML document CAS xmlCas = aCAS.getView("xmlDocument"); InputStream xmlStream = xmlCas.getSofa().getSofaDataStream(); // parse with detag handler DetagHandler handler = new DetagHandler(); try { SAXParser parser = parserFactory.newSAXParser(); parser.parse(xmlStream, handler); } catch (Exception e) { throw new AnalysisEngineProcessException(e); } // create the plain text view and set its document text CAS plainTextView = aCAS.createView("plainTextDocument"); plainTextView.setDocumentText(handler.getDetaggedText()); plainTextView.setDocumentLanguage(aCAS.getView("_InitialView").getDocumentLanguage()); // Index the SourceDocumentInformation object, if there is one, in the new sofa. // This is needed by the SemanticSearchCasIndexer Iterator iter = xmlCas.getAnnotationIndex(sourceDocInfoType).iterator(); if (iter.hasNext()) { FeatureStructure sourceDocInfoFs = (FeatureStructure) iter.next(); plainTextView.getIndexRepository().addFS(sourceDocInfoFs); } }
public void process(AbstractCas aCAS) throws AnalysisEngineProcessException { if (!mCasInterface.isAssignableFrom(aCAS.getClass())) { throw new AnalysisEngineProcessException( AnalysisEngineProcessException.INCORRECT_CAS_INTERFACE, new Object[] { mCasInterface, aCAS.getClass() }); } // check if type system changed; if so, notify Annotator checkTypeSystemChange(aCAS); // do proper typecasts and call process method try { if (mAnnotator instanceof TextAnnotator) { CAS cas = (CAS) aCAS; ResultSpecification rs = getResultSpecForLanguage(cas.getDocumentLanguage()); rs.setTypeSystem(cas.getTypeSystem()); ((TextAnnotator) mAnnotator).process(cas, rs); } else if (mAnnotator instanceof JTextAnnotator) { JCas jcas = (JCas) aCAS; ResultSpecification rs = getResultSpecForLanguage(jcas.getDocumentLanguage()); rs.setTypeSystem(jcas.getTypeSystem()); ((JTextAnnotator) mAnnotator).process(jcas, rs); } else if (mAnnotator instanceof GenericAnnotator) { mDefaultResultSpecification.setTypeSystem(((CAS) aCAS).getTypeSystem()); ((GenericAnnotator) mAnnotator).process((CAS) aCAS, mDefaultResultSpecification); } } catch (AnnotatorProcessException e) { throw new AnalysisEngineProcessException(e); } }
Class<?> type = env.getVariableType(var); NumberFormat nf = null; String locale = annotation.getCAS().getDocumentLanguage(); if (localeExpr != null) { locale = localeExpr.getStringValue(context, stream);
String documentLanguage = Language.normalize(cas.getDocumentLanguage());
public void read() throws Exception { CollectionReader xmiReader = CollectionReaderFactory.createReader(XmiReader.class, ResourceCollectionReaderBase.PARAM_SOURCE_LOCATION, testFolder.getRoot().getPath(), ResourceCollectionReaderBase.PARAM_PATTERNS, new String[] { ResourceCollectionReaderBase.INCLUDE_PREFIX + "*.xmi" }); CAS cas = CasCreationUtils.createCas(createTypeSystemDescription(), null, null); xmiReader.getNext(cas); String refText = readFileToString(new File("src/test/resources/texts/latin.txt")); assertEquals(refText, cas.getDocumentText()); assertEquals("latin", cas.getDocumentLanguage()); }
String language = tcas.getDocumentLanguage();
language = aCAS.getDocumentLanguage();
if (token.getCAS().getDocumentLanguage().equals("en")) { wordnet = uby.getLexiconByName("WordNet"); } else if (language.equals("en")) { wordnet = uby.getLexiconByName("WordNet"); } else if (token.getCAS().getDocumentLanguage().equals("de")) { wordnet = uby.getLexiconByName("GermaNet"); } else if (language.equals("de")) {