Package org.apache.uima.cas.impl

Examples of org.apache.uima.cas.impl.CASSerializer


      // Set the document text
      // gs.setLocalSofaData("das bier ist gut");
      gerTcas.setDocumentText("das bier ist gut");

      // Test multiple Sofas across binary serialization
      CASSerializer cs = Serialization.serializeNoMetaData(cas);
      cas = Serialization.createCAS(casMgr, cs);

      // Add a new Sofa
      // SofaID_impl fid = new SofaID_impl();
      // fid.setSofaID("FrenchDocument");
View Full Code Here


      AFrame responseFrame = (AFrame) mVinciClient.sendAndReceive(requestFrame, mTimeout);

      // deserialize CAS from response frame
      byte[] responseCasBytes = responseFrame.fgetTrueBinary("BinaryCAS");
      CASSerializer responseSerializer = (CASSerializer) SerializationUtils
              .deserialize(responseCasBytes);
      ((CASImpl) cas).reinit(responseSerializer);

      // also read annotation time and enter into AnalysisEngineManagementMBean
      int annotationTime = responseFrame.fgetInt(Constants.ANNOTATION_TIME);
View Full Code Here

      // Set the document text
      // gs.setLocalSofaData("das bier ist gut");
      gerTcas.setDocumentText("das bier ist gut");

      // Test multiple Sofas across binary serialization
      CASSerializer cs = Serialization.serializeNoMetaData(cas);
      cas = Serialization.createCAS(casMgr, cs);

      // Add a new Sofa
      // SofaID_impl fid = new SofaID_impl();
      // fid.setSofaID("FrenchDocument");
View Full Code Here

      casImpl.reset();

      // 1. deserialize CAS

      CASSerializer serializer = new CASSerializer();
      // set serialization data
      serializer.heapArray = heapArray;
      serializer.fsIndex = fsIndex;
      serializer.stringTable = stringTable;

      serializer.byteHeapArray = aByteHeapArray;
      serializer.shortHeapArray = aShortHeapArray;
      serializer.longHeapArray = aLongHeapArray;

      casImpl.reinit(serializer);

      // 2. create result spec
      if (ae != null) {

        ResultSpecification rs = ae.createResultSpecification();
        for (int i = 0; i < resultSpecTypes.length; ++i) {
          // allAnnotatorFeatures is not considere here! (TODO)
          rs
                  .addResultType(casImpl.getTypeSystemImpl().getType(resultSpecTypes[i]).getName(),
                          false);
        }
        for (int i = 0; i < resultSpecFeatures.length; ++i) {
          rs.addResultFeature(casImpl.getTypeSystemImpl().getFeature(resultSpecFeatures[i])
                  .getName());
        }
        // 3. call process with cas
        ae.process(casImpl, rs);

      } else if (cc != null) {
        // 3. call process with tcas or cas
        if (requiresTCas && sofaNum == 0) {
          result = 1;
          exceptionString = "This CasConsumer expects a View, but the Sofa from which to construct one is not specified.";
        } else if (sofaNum > 0) {
          CAS view = casImpl.getView(sofaNum);
          cc.processCas(view);
        } else {
          cc.processCas(casImpl);
        }
      }
      // 4. deserialize CAS again
      CASSerializer deSerializer = Serialization.serializeCAS(casImpl);

      saveSerializedCAS(deSerializer);

    } catch (Exception exc) {
      result = 1;
View Full Code Here

    // create FS
    createExampleFS(cas);

    // serialize
    CASSerializer cs = Serialization.serializeNoMetaData(cas);

    // reset
    cas.reset();

    // deserialize
View Full Code Here

      // Set the document text
      // gs.setLocalSofaData("das bier ist gut");
      gerJcas.setDocumentText("das bier ist gut");

      // Test multiple Sofas across binary serialization
      CASSerializer cs = Serialization.serializeNoMetaData(cas);
      cas = Serialization.createCAS(casMgr, cs);

      // Add a new Sofa
      // id.setSofaID("FrenchDocument");
      // Sofa fs = new Sofa(jcas, id, "text");
View Full Code Here

    try {
      resetJNI();

      if (!casIsEmpty) {
        CASSerializer casSerializerIn = Serialization.serializeCAS(cas);
        /**
         * fillCASJNI(casSerializerIn.heapArray, casSerializerIn.fsIndex,
         * casSerializerIn.stringTable);
         */

 
View Full Code Here

    try {
      hasNext = hasNextSegmentJNI();
      // get the CAS data of the original input CAS.
      if (!hasNext) {
        CASSerializer casSerializerOut = new CASSerializer();
        // per document data
        serializeCASJNI(true);
        casSerializerOut.heapMetaData = null;
        casSerializerOut.heapArray = (int[]) getSerializedDataJNI(FSHEAP);
        casSerializerOut.fsIndex = (int[]) getSerializedDataJNI(INDEXEDFSS);
View Full Code Here

      // get the CAS data of CAS produce by segmenter component.
      if (hasNext) {

        nextSegmentJNI();
        CASSerializer casSerializerOut = new CASSerializer();
        // per document data
        serializeSegmentJNI(true);
        casSerializerOut.heapMetaData = null;
        casSerializerOut.heapArray = (int[]) getSerializedSegmentDataJNI(FSHEAP);
        casSerializerOut.fsIndex = (int[]) getSerializedSegmentDataJNI(INDEXEDFSS);
View Full Code Here

    final int numDocs = docs.size();
    final int max = 30;
    int docCount = 0;
    long overallTime = System.currentTimeMillis();
    int numTok, numSent;
    CASSerializer cs;
    while (docCount < max) {
      for (int i = 0; i < numDocs && docCount < max; i++) {
        // System.out.println("Processing document: " + i);
        // Set document text in first CAS.
        cas.setDocumentText((String) docs.get(i));
View Full Code Here

TOP

Related Classes of org.apache.uima.cas.impl.CASSerializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.