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


Java WLData类代码示例

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


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

示例1: getNext

import eu.clarin.weblicht.wlfxb.xb.WLData; //导入依赖的package包/类
@Override
public void getNext(JCas aJCas)
    throws IOException, CollectionException
{
    Resource res = nextFile();
    initCas(aJCas, res);

    InputStream is = null;
    try {
        is = new BufferedInputStream(res.getInputStream());
        WLData wLData = WLDObjector.read(is);
        TextCorpus aCorpusData = wLData.getTextCorpus();
        convertToCas(aJCas, aCorpusData);
    }
    catch (WLFormatException e) {
        throw new CollectionException(e);
    }
    finally {
        closeQuietly(is);

    }
}
 
开发者ID:webanno,项目名称:webanno,代码行数:23,代码来源:TcfReader.java

示例2: casToTcfWriter

import eu.clarin.weblicht.wlfxb.xb.WLData; //导入依赖的package包/类
/**
 * Create TCF File from scratch
 * 
 * @param aJCas
 *            the JCas.
 * @param aOs
 *            the output stream.
 * @throws WLFormatException
 *             if a TCF problem occurs.
 */
public void casToTcfWriter(JCas aJCas, OutputStream aOs)
    throws WLFormatException
{
    // create TextCorpus object, specifying its language from the aJcas Object
    TextCorpusStored textCorpus = new TextCorpusStored(aJCas.getDocumentLanguage());

    // create text annotation layer and add the string of the text into the layer
    textCorpus.createTextLayer().addText(aJCas.getDocumentText());

    write(aJCas, textCorpus);

    // write the annotated data object into the output stream
    WLData wldata = new WLData(textCorpus);
    WLDObjector.write(wldata, aOs);
}
 
开发者ID:webanno,项目名称:webanno,代码行数:26,代码来源:TcfWriter.java

示例3: close

import eu.clarin.weblicht.wlfxb.xb.WLData; //导入依赖的package包/类
@Override
public void close() throws IOException {
    try {
        JAXBContext context = JAXBContext.newInstance(WLData.class);
        Marshaller marshaller = context.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
        marshaller.marshal(new WLData(corpus), corpusWriter);
    } catch (JAXBException e) {
        throw new IOException(e.getMessage());
    }
    corpusWriter.close();
}
 
开发者ID:weblicht,项目名称:conll-utils,代码行数:13,代码来源:TCFWriter.java

示例4: read

import eu.clarin.weblicht.wlfxb.xb.WLData; //导入依赖的package包/类
public static WLData read(InputStream inputStream) throws WLFormatException {
    WLData data = null;
    try {
        JAXBContext context = JAXBContext.newInstance(WLData.class);
        Unmarshaller unmarshaller = context.createUnmarshaller();
        data = ((WLData) unmarshaller.unmarshal(inputStream));
    } catch (JAXBException e) {
        throw new WLFormatException(e.getMessage(), e);
    }
    return data;
}
 
开发者ID:weblicht,项目名称:wlfxb,代码行数:12,代码来源:WLDObjector.java

示例5: testWrite_File

import eu.clarin.weblicht.wlfxb.xb.WLData; //导入依赖的package包/类
@Test
public void testWrite_File() throws Exception {
    System.out.println("write");
    File file = testFolder.newFile(OUTPUT_FILE_1);
    WLData data = createWLTestData();
    WLDObjector.write(data, file);
}
 
开发者ID:weblicht,项目名称:wlfxb,代码行数:8,代码来源:WLDObjector2Test.java

示例6: testRead

import eu.clarin.weblicht.wlfxb.xb.WLData; //导入依赖的package包/类
private void testRead(InputStream is) throws Exception {
    System.out.println("read");
    WLData wld = WLDObjector.read(is);
    System.out.println(" --- " + wld.getMetaData());
    System.out.println(" --- " + wld.getExternalData());
    System.out.println(" --- " + wld.getTextCorpus());
    System.out.println(" --- " + wld.getLexicon());
}
 
开发者ID:weblicht,项目名称:wlfxb,代码行数:9,代码来源:WLDObjector2Test.java

示例7: createWLTestData

import eu.clarin.weblicht.wlfxb.xb.WLData; //导入依赖的package包/类
private WLData createWLTestData() {
    MetaData md = createTestMetadata();
    TextCorpusStored tc = createTestTextCorpus();
    ExternalDataStored ed = createTestExternalData();
    WLData data = new WLData(md, ed, tc);
    return data;
}
 
开发者ID:weblicht,项目名称:wlfxb,代码行数:8,代码来源:WLDObjector2Test.java

示例8: testWrite_File

import eu.clarin.weblicht.wlfxb.xb.WLData; //导入依赖的package包/类
@Test
public void testWrite_File() throws Exception {
    System.out.println("write");
    File file = testFolder.newFile(OUTPUT_FILE_1);
    WLData data = createWLTestData();
    WLDObjector.write(data, file, true);
}
 
开发者ID:weblicht,项目名称:wlfxb,代码行数:8,代码来源:WLDObjectorEmptyLayersTest.java

示例9: testWriteUsingMinimumNsPrefixes_File

import eu.clarin.weblicht.wlfxb.xb.WLData; //导入依赖的package包/类
@Test
public void testWriteUsingMinimumNsPrefixes_File() throws Exception {
    System.out.println("write");
    File file = testFolder.newFile(OUTPUT_FILE_2);
    WLData data = createWLTestData();
    WLDObjector.write(data.getMetaData(), data.getTextCorpus(), file, false);
}
 
开发者ID:weblicht,项目名称:wlfxb,代码行数:8,代码来源:WLDObjectorEmptyLayersTest.java

示例10: testRead

import eu.clarin.weblicht.wlfxb.xb.WLData; //导入依赖的package包/类
private void testRead(InputStream is) throws Exception {
    System.out.println("read");
    WLData wld = WLDObjector.read(is);
    System.out.println(" --- " + wld.getMetaData());
    System.out.println(" --- " + wld.getTextCorpus());
    System.out.println(" --- " + wld.getLexicon());
}
 
开发者ID:weblicht,项目名称:wlfxb,代码行数:8,代码来源:WLDObjectorEmptyLayersTest.java

示例11: testReadWrite

import eu.clarin.weblicht.wlfxb.xb.WLData; //导入依赖的package包/类
@Test
public void testReadWrite() throws Exception {
    InputStream is = this.getClass().getResourceAsStream(INPUT_FILE);
    WLData wld = WLDObjector.read(is);
    WLDObjector.write(wld, testFolder.newFile(OUTPUT_FILE), false);
    InputStream is2 = new FileInputStream(testFolder.newFile(OUTPUT_FILE));
   
    // TODO: can use after equal methods are implemented for TCF components
    //WLData wld2 = WLDObjector.read(is2);
    //Assert.assertEquals("tcf after read->write->read should be equal", wld, wld2);
    
    InputStream is3 = this.getClass().getResourceAsStream(INPUT_FILE);
    TestUtils.assertEqualXml(is3, is2);
}
 
开发者ID:weblicht,项目名称:wlfxb,代码行数:15,代码来源:WLDObjector3Test.java

示例12: testOneWay

import eu.clarin.weblicht.wlfxb.xb.WLData; //导入依赖的package包/类
public void testOneWay(String aInputFile, String aExpectedFile)
    throws Exception
{
    CollectionReaderDescription reader = createReaderDescription(TcfReader.class, 
            TcfReader.PARAM_SOURCE_LOCATION, "src/test/resources/",
            TcfReader.PARAM_PATTERNS, aInputFile);

    AnalysisEngineDescription writer = createEngineDescription(
            TcfWriter.class,
            TcfWriter.PARAM_TARGET_LOCATION, "target/test-output/oneway",
            TcfWriter.PARAM_FILENAME_SUFFIX, ".xml",
            TcfWriter.PARAM_STRIP_EXTENSION, true);

    AnalysisEngineDescription dumper = createEngineDescription(CasDumpWriter.class,
            CasDumpWriter.PARAM_OUTPUT_FILE, "target/test-output/oneway/dump.txt");

    runPipeline(reader, writer, dumper);

    InputStream isReference = new FileInputStream(new File("src/test/resources/"
            + aExpectedFile));

    InputStream isActual = new FileInputStream(new File("target/test-output/oneway/"
            + aInputFile));

    WLData wLDataReference = WLDObjector.read(isReference);
    TextCorpusStored aCorpusDataReference = wLDataReference.getTextCorpus();

    WLData wLDataActual = WLDObjector.read(isActual);
    TextCorpusStored aCorpusDataActual = wLDataActual.getTextCorpus();

    // check if layers maintained
    assertEquals(aCorpusDataReference.getLayers().size(), aCorpusDataActual.getLayers().size());

    // Check if every layers have the same number of annotations
    for (TextCorpusLayer layer : aCorpusDataReference.getLayers()) {
        assertEquals("Layer size mismatch in [" + layer.getClass().getName() + "]",
                layer.size(), getLayer(aCorpusDataActual, layer.getClass()).size());
    }

    XMLAssert.assertXMLEqual(
            new InputSource("src/test/resources/" + aExpectedFile),
            new InputSource(new File("target/test-output/oneway/" + aInputFile).getPath()));
}
 
开发者ID:webanno,项目名称:webanno,代码行数:44,代码来源:TcfReaderWriterTest.java

示例13: write

import eu.clarin.weblicht.wlfxb.xb.WLData; //导入依赖的package包/类
public static void write(WLData wlData, OutputStream outputStream) throws WLFormatException {
    write(wlData.getMetaData(), wlData.getTextCorpus(), outputStream, false);
}
 
开发者ID:weblicht,项目名称:wlfxb,代码行数:4,代码来源:WLDObjector.java

示例14: createWLTestData

import eu.clarin.weblicht.wlfxb.xb.WLData; //导入依赖的package包/类
private WLData createWLTestData() {
    MetaData md = createTestMetadata();
    TextCorpusStored tc = createTestTextCorpus();
    WLData data = new WLData(md, tc);
    return data;
}
 
开发者ID:weblicht,项目名称:wlfxb,代码行数:7,代码来源:WLDObjectorEmptyLayersTest.java


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