当前位置: 首页>>代码示例>>Java>>正文


Java TypeSystemDescription类代码示例

本文整理汇总了Java中org.apache.uima.resource.metadata.TypeSystemDescription的典型用法代码示例。如果您正苦于以下问题:Java TypeSystemDescription类的具体用法?Java TypeSystemDescription怎么用?Java TypeSystemDescription使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TypeSystemDescription类属于org.apache.uima.resource.metadata包,在下文中一共展示了TypeSystemDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildConceptMapperAggregate

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
private static AnalysisEngineDescription buildConceptMapperAggregate(List<String> paramValues,
		TypeSystemDescription tsd, File dictionaryFile, Class<? extends Annotation> spanFeatureStructureClass)
		throws UIMAException, IOException {

	CaseMatchParamValue caseMatchParamValue = getCaseMatchParamValue(paramValues);
	SearchStrategyParamValue searchStrategyParamValue = getSearchStrategyParamValue(paramValues);
	Class<? extends Stemmer> stemmerClass = getStemmerClass(paramValues);
	String[] stopwordList = getStopWordList(paramValues);
	boolean orderIndependentLookup = getOrderIndependentLookup(paramValues);
	boolean findAllMatches = getFindAllMatches(paramValues);
	// boolean replaceCommaWithAnd = getReplaceCommaWithAnd(paramValues);
	boolean replaceCommaWithAnd = false; // this parameter doesn't appear to be enabled in
											// ConceptMapper

	return ConceptMapperAggregateFactory.getOffsetTokenizerConceptMapperAggregateDescription(tsd, dictionaryFile,
			caseMatchParamValue, searchStrategyParamValue, spanFeatureStructureClass, stemmerClass, stopwordList,
			orderIndependentLookup, findAllMatches, replaceCommaWithAnd);
}
 
开发者ID:UCDenver-ccp,项目名称:ccp-nlp,代码行数:19,代码来源:ConceptMapperPermutationFactory.java

示例2: buildConceptMapperDescription

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
/**
 * Returns an {@link AnalysisEngineDescription} initialized using the input configuration data.
 * The base of the description is loaded from the ConceptMapperOffsetTokenizer.xml descriptor
 * file that is part of the ConceptMapper distribution. Parameter settings in that file are
 * overridden by those set in the input configuration data.
 * 
 * @param tsd
 * @param configurationData
 * @return
 * @throws UIMAException
 * @throws IOException
 */
public static AnalysisEngineDescription buildConceptMapperDescription(TypeSystemDescription tsd,
		Object[] configurationData) throws UIMAException, IOException {
	AnalysisEngineDescription description = AnalysisEngineFactory.createAnalysisEngineDescription(
			CONCEPT_MAPPER_DESCRIPTOR_PATH, configurationData);
	TypeSystemDescription cmTypeSystem = description.getAnalysisEngineMetaData().getTypeSystem();

	/*
	 * The ConceptMapper Descriptor defines the uima.tt.TokenAnnotation type so we extract it
	 * and add it to the input type system
	 */
	TypeDescription tokenAnnotationTypeDesc = cmTypeSystem.getType("uima.tt.TokenAnnotation");
	List<TypeDescription> types = new ArrayList<TypeDescription>(Arrays.asList(tsd.getTypes()));
	types.add(tokenAnnotationTypeDesc);

	TypeSystemDescription tsdToUse = TypeSystemDescriptionFactory.createTypeSystemDescription();
	tsdToUse.setTypes(types.toArray(new TypeDescription[types.size()]));
	description.getAnalysisEngineMetaData().setTypeSystem(tsdToUse);
	return description;
}
 
开发者ID:UCDenver-ccp,项目名称:ccp-nlp,代码行数:32,代码来源:ConceptMapperFactory.java

示例3: createAnalysisEngineDescription

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
public static AnalysisEngineDescription createAnalysisEngineDescription(TypeSystemDescription tsd,
		SpanComparatorType spanComparatorType, MentionComparatorType mentionComparatorType,
		File evaluationResultsOutputFile, AnnotationGroup goldGroup, AnnotationGroup evalGroup, int maximumComparisonDepth)
		throws ResourceInitializationException {
	return AnalysisEngineFactory.createPrimitiveDescription(SimpleAnnotationComparator_AE.class, tsd,
			PARAM_SPAN_COMPARATOR_TYPE_NAME, spanComparatorType.name(), PARAM_MENTION_COMPARATOR_TYPE_NAME,
			mentionComparatorType.name(), PARAM_ANNOTATION_OUTPUT_FILE,
			(evaluationResultsOutputFile != null) ? evaluationResultsOutputFile.getAbsolutePath() : null,
			PARAM_GOLD_SET_ID, goldGroup.getAnnotationSetID(), PARAM_GOLD_ANNOTATOR_ID, goldGroup.getAnnotatorID(),
			PARAM_GOLD_TYPE_REGEX,
			goldGroup.getAnnotationTypeRegexList().toArray(new String[goldGroup.getAnnotationTypeList().size()]),
			PARAM_EVAL_SET_ID, evalGroup.getAnnotationSetID(), PARAM_EVAL_ANNOTATOR_ID, evalGroup.getAnnotatorID(),
			PARAM_EVAL_TYPE_REGEX,
			evalGroup.getAnnotationTypeRegexList().toArray(new String[evalGroup.getAnnotationTypeList().size()]),
			PARAM_MAX_COMPARISON_DEPTH, maximumComparisonDepth,
			PARAM_CONFIG_FILE, "not/a/real/file"); // config file parameter set b/c it
																// is mandatory, but is never
																// used
}
 
开发者ID:UCDenver-ccp,项目名称:ccp-nlp,代码行数:20,代码来源:SimpleAnnotationComparator_AE.java

示例4: loadXCasFile

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
/**
 * Loads the input XCas file and returns a GenericDocument containing the document text and all
 * annotations.
 * 
 * @param xcasFile
 * @return
 */
public static GenericDocument loadXCasFile(InputStream xcasStream, TypeSystemDescription tsd) throws UIMAException {
	JCas jcas = JCasFactory.createJCas(tsd);
	try {
		XCASDeserializer.deserialize(xcasStream, jcas.getCas());
	} catch (SAXException e) {
		throw new UIMAException(e);
	} catch (IOException e) {
		throw new UIMAException(e);
	}

	GenericDocument gd = new GenericDocument();
	UIMA_Util.swapDocumentInfo(jcas, gd);

	int numAnnotationsInGenericDocument = gd.getAnnotations().size();
	int numAnnotationsInJCas = jcas.getJFSIndexRepository().getAnnotationIndex(CCPTextAnnotation.type).size();
	assert numAnnotationsInGenericDocument == numAnnotationsInJCas : String
			.format("Number of annotations in jcas not equal to the number of annotations in the generic document. %d != %d",
					numAnnotationsInJCas, numAnnotationsInGenericDocument);

	return gd;
}
 
开发者ID:UCDenver-ccp,项目名称:ccp-nlp,代码行数:29,代码来源:XCasUtil.java

示例5: setUp

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	TypeSystemDescription tsd = TypeSystemDescriptionFactory
			.createTypeSystemDescription("edu.ucdenver.ccp.nlp.core.uima.TypeSystem");
	jcas = JCasFactory.createJCas(tsd);

	String docText = "\n<A HREF=\"blah\"> &nbsp;&nbsp;  Annotation text&nbsp;  &nbsp;&nbsp;\n</NOBR>\n\n\n";
	jcas.setDocumentText(docText);

	testAnnotation = new Annotation(jcas);
	testAnnotation.setBegin(0);
	testAnnotation.setEnd(docText.length());
	testAnnotation.addToIndexes();

	testCcpTA = new CCPTextAnnotation(jcas);
	testCcpTA.setBegin(16);
	testCcpTA.setEnd(66);
}
 
开发者ID:UCDenver-ccp,项目名称:ccp-nlp,代码行数:19,代码来源:UIMA_Annotation_UtilTest.java

示例6: testDontAddDuplicateAnnotations

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
@Test
public void testDontAddDuplicateAnnotations() throws Exception {
	TypeSystemDescription typeSystemDescription = TypeSystemDescriptionFactory
			.createTypeSystemDescription("edu.ucdenver.ccp.nlp.core.uima.TypeSystem");
	JCas jcas = JCasFactory.createJCas(typeSystemDescription);

	/* ________________________________________1_________2_________3_________4_________5 */
	/* ______________________________012345678901234567890123456789012345678901234567890123456789 */
	String proteinConjunctionText = "p53 is activated by proteins ABC-1, CDE-2, and DEF-3.";

	jcas.setDocumentText(proteinConjunctionText);

	/* Now we add some protein annotations */
	UIMA_Annotation_Util.createCCPTextAnnotation(ClassMentionType.PROTEIN.typeName(), new int[] { 0, 3 }, jcas);

	// Create an exact duplicate of this one and try to add
	CCPTextAnnotation ccpTA = UIMA_Annotation_Util.createCCPTextAnnotationNoDups(
			ClassMentionType.PROTEIN.typeName(), new int[] { 0, 3 }, jcas);
	assertNull(ccpTA);

}
 
开发者ID:UCDenver-ccp,项目名称:ccp-nlp,代码行数:22,代码来源:UIMA_Annotation_UtilTest.java

示例7: run

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
public void run() throws ResourceInitializationException, ClassNotFoundException {
    @SuppressWarnings("unchecked")
    Class<? extends Annotation> annotationClass = (Class<? extends Annotation>) Class.forName(annotationTypeName);
    if (typeSystemNames == null) {
        typeSystemNames = ImmutableList.of();
    }
    TypeSystemDescription inputTSD = TypeSystemDescriptionFactory.createTypeSystemDescription(
            typeSystemNames.toArray(new String[typeSystemNames.size()]));
    CollectionReaderDescription colReaderDesc = XmiCollectionReader.createDescription(corpusDir, inputTSD);
    JCasIterable corpus = new JCasIterable(colReaderDesc, getNoOpAEDesc());
    for (JCas doc : corpus) {
        for (Annotation anno : JCasUtil.select(doc, annotationClass)) {
            System.out.println(anno.getCoveredText());
        }
    }
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:17,代码来源:PrintAnnotations.java

示例8: run

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
private void run() throws ResourceInitializationException, IOException, SAXException {
    Collection<File> inputFiles =
            FileUtils.listFiles(inputDir, FileFilterUtils.suffixFileFilter(".xml"), null);
    if (inputFiles.isEmpty()) {
        return;
    }
    TypeSystemDescription tsd = TypeSystemDescriptionFactory
            .createTypeSystemDescription(typeSystemDescName);
    CAS cas = CasCreationUtils.createCas(tsd, null, null);
    for (File inputFile : inputFiles) {
        AXMLReader.read(inputFile, cas);
        File outFile = getOutputFile(inputFile);
        OutputStream out = FileUtils.openOutputStream(outFile);
        try {
            XmiCasSerializer.serialize(cas, null, out, true, null);
        } finally {
            out.close();
            cas.reset();
        }
    }
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:22,代码来源:AXML2XMI.java

示例9: test

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
@Test
public void test() throws UIMAException, IOException {
    TypeSystemDescription tsDesc = createTypeSystemDescription("com.textocat.textokit.commons.Commons-TypeSystem");
    CollectionReaderDescription readerDesc =
            CollectionReaderFactory.createReaderDescription(JdbcCollectionReader.class, tsDesc,
                    JdbcCollectionReader.PARAM_DATABASE_URL,
                    "jdbc:hsqldb:mem:jdbc-collection-reader-test;ifexists=true",
                    JdbcCollectionReader.PARAM_USERNAME, "SA",
                    JdbcCollectionReader.PARAM_PASSWORD, "",
                    JdbcCollectionReader.PARAM_DRIVER_CLASS, "org.hsqldb.jdbc.JDBCDriver",
                    JdbcCollectionReader.PARAM_QUERY, "SELECT url, txt FROM doc ORDER BY id OFFSET ? LIMIT ?",
                    JdbcCollectionReader.PARAM_OFFSET_PARAM_INDEX, 1,
                    JdbcCollectionReader.PARAM_LIMIT_PARAM_INDEX, 2,
                    JdbcCollectionReader.PARAM_DOCUMENT_URL_COLUMN, "url",
                    JdbcCollectionReader.PARAM_TEXT_COLUMN, "txt",
                    JdbcCollectionReader.PARAM_BATCH_SIZE, 2,
                    JdbcCollectionReader.PARAM_COUNT_QUERY, "SELECT count(*) FROM doc");
    AnalysisEngineDescription aeDesc = createEngineDescription(AnnotationLogger.class);
    SimplePipeline.runPipeline(readerDesc, aeDesc);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:21,代码来源:JdbcCollectionReaderTest.java

示例10: testGetTypeSystem

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
@Test
public void testGetTypeSystem() throws ResourceInitializationException,
        InvalidXMLException, SAXException, IOException, ParserConfigurationException {
    TypeSystemDescription typeSystem = XmiFileTreeCorpusDAO
            .getTypeSystem(corpusPathString);
    typeSystem.resolveImports();

    Set<String> typeNames = new HashSet<String>();
    for (TypeDescription type : typeSystem.getTypes()) {
        typeNames.add(type.getName());
    }

    assertEquals(Sets.newHashSet(
            "com.textocat.textokit.commons.DocumentMetadata",
            "ru.kfu.itis.issst.evex.Person",
            "ru.kfu.itis.issst.evex.Organization",
            "ru.kfu.itis.issst.evex.Artifact",
            "ru.kfu.itis.issst.evex.Weapon", "ru.kfu.itis.issst.evex.Job",
            "ru.kfu.itis.issst.evex.Time", "ru.kfu.itis.issst.evex.Event",
            "ru.kfu.itis.issst.evex.Die",
            "ru.kfu.itis.issst.evex.StartPosition"), typeNames);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:23,代码来源:XmiFileTreeCorpusDAOTest.java

示例11: createTypeSystem

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
private TypeSystem createTypeSystem() throws IOException, UIMAException {
    TypeSystemDescription tsDesc = null;
    if (typeSystemDescPaths != null && typeSystemDescPaths.length > 0) {
        tsDesc = createTypeSystemDescriptionFromPath(typeSystemDescPaths);
    }
    if (typeSystemDescNames != null && typeSystemDescNames.length > 0) {
        TypeSystemDescription tsDescFromNames = createTypeSystemDescription(
                typeSystemDescNames);
        if (tsDesc != null) {
            tsDesc = mergeTypeSystems(asList(tsDesc, tsDescFromNames));
        } else {
            tsDesc = tsDescFromNames;
        }
    }
    if (tsDesc == null) {
        log.info("TypeSystemDescription will be created using the UIMAFit discovery");
        tsDesc = TypeSystemDescriptionFactory.createTypeSystemDescription();
    }
    CAS dumbCas = CasCreationUtils.createCas(tsDesc, null, null);
    TypeSystem typeSystem = dumbCas.getTypeSystem();
    // printAllTypes();
    return typeSystem;
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:24,代码来源:TypeSystemInitializer.java

示例12: run

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
private void run() throws Exception {
    // make TypeSystemDesc
    TypeSystemDescription tsd = TypeSystemDescriptionFactory
            .createTypeSystemDescriptionFromPath(tsFile.toURI().toString());
    // configure CollectionReader
    CollectionReaderDescription colReaderDesc = CollectionReaderFactory.createReaderDescription(
            BratCollectionReader.class, tsd,
            BratCollectionReader.PARAM_BRAT_COLLECTION_DIR, bratCorpusDir.getPath(),
            BratCollectionReader.PARAM_MAPPING_FACTORY_CLASS,
            AutoBratUimaMappingFactory.class.getName());
    // configure AE
    AnalysisEngineDescription aeDesc = createEngineDescription(XmiWriter.class,
            XmiWriter.PARAM_OUTPUTDIR, outputDir.getPath());

    SimplePipeline.runPipeline(colReaderDesc, aeDesc);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:17,代码来源:B2U.java

示例13: test

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
@Test
public void test() throws Exception {
    TypeSystemDescription tsd = TypeSystemDescriptionFactory
            .createTypeSystemDescription("desc.types.test-TypeSystem");

    CollectionReaderDescription colReaderDesc = CollectionReaderFactory.createReaderDescription(
            XmiCollectionReader.class, tsd,
            XmiCollectionReader.PARAM_INPUTDIR, inputFileXMIDir);

    // configure AE
    XMLInputSource aeDescInput = new XMLInputSource(U2BAggregateDesc);
    AnalysisEngineDescription aeDesc = UIMAFramework.getXMLParser()
            .parseAnalysisEngineDescription(aeDescInput);

    SimplePipeline.runPipeline(colReaderDesc, aeDesc);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:17,代码来源:U2BTest.java

示例14: testReverse

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
@Test
public void testReverse() throws Exception {
    TypeSystemDescription tsd = TypeSystemDescriptionFactory
            .createTypeSystemDescription("desc.types.test-TypeSystem");

    CollectionReaderDescription colReaderDesc = CollectionReaderFactory.createReaderDescription(
            BratCollectionReader.class, tsd,
            BratCollectionReader.PARAM_BRAT_COLLECTION_DIR, inputBratDir,
            BratCollectionReader.PARAM_MAPPING_FACTORY_CLASS,
            ReverseBratUimaMappingFactory.class.getName(),
            ReverseBratUimaMappingFactory.PARAM_U2B_DESC_PATH, U2BTest.U2BAggregateDesc);

    // configure AE
    AnalysisEngineDescription aeDesc = XmiFileWriter.createDescription(
            new File("target/test-brat2uima-output"));

    SimplePipeline.runPipeline(colReaderDesc, aeDesc);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:19,代码来源:B2UTest.java

示例15: testAuto

import org.apache.uima.resource.metadata.TypeSystemDescription; //导入依赖的package包/类
@Test
public void testAuto() throws Exception {
    TypeSystemDescription tsd = TypeSystemDescriptionFactory
            .createTypeSystemDescription("desc.types.brat-news-tutorial-TypeSystem");

    CollectionReaderDescription colReaderDesc = CollectionReaderFactory.createReaderDescription(
            BratCollectionReader.class, tsd,
            BratCollectionReader.PARAM_BRAT_COLLECTION_DIR, "data/brat-news-tutorial",
            BratCollectionReader.PARAM_MAPPING_FACTORY_CLASS,
            AutoBratUimaMappingFactory.class.getName(),
            AutoBratUimaMappingFactory.PARAM_NAMESPACES_TO_SCAN, "ace");

    // configure AE
    AnalysisEngineDescription aeDesc = XmiFileWriter.createDescription(
            new File("target/brat-news-tutorial.xmi"));

    SimplePipeline.runPipeline(colReaderDesc, aeDesc);
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:19,代码来源:B2UTest.java


注:本文中的org.apache.uima.resource.metadata.TypeSystemDescription类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。