當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。