Package org.apache.ctakes.typesystem.type.structured

Examples of org.apache.ctakes.typesystem.type.structured.DocumentID


  public static class DocumentIDAnnotator extends JCasAnnotator_ImplBase {

    @Override
    public void process(JCas jCas) throws AnalysisEngineProcessException {
      String documentID = new File(ViewURIUtil.getURI(jCas)).getName();
      DocumentID documentIDAnnotation = new DocumentID(jCas);
      documentIDAnnotation.setDocumentID(documentID);
      documentIDAnnotation.addToIndexes();
    }
View Full Code Here


  public static class DocumentIDAnnotator extends JCasAnnotator_ImplBase {

    @Override
    public void process(JCas jCas) throws AnalysisEngineProcessException {
      String documentID = new File(ViewURIUtil.getURI(jCas)).getPath();
      DocumentID documentIDAnnotation = new DocumentID(jCas);
      documentIDAnnotation.setDocumentID(documentID);
      documentIDAnnotation.addToIndexes();
    }
View Full Code Here

    for (String knowtatorTextDirectoryPath : args) {
      File knowtatorTextDirectory = new File(knowtatorTextDirectoryPath);
      for (File textFile : knowtatorTextDirectory.listFiles()) {
        JCas jCas = engine.newJCas();
        jCas.setDocumentText(Files.toString(textFile, Charsets.US_ASCII));
        DocumentID documentID = new DocumentID(jCas);
        documentID.setDocumentID(textFile.toURI().toString());
        documentID.addToIndexes();
        engine.process(jCas);
        documentID.setDocumentID(textFile.getName());
        xWriter.process(jCas);
      }
    }

  }
View Full Code Here

                    // No CAS Initiliazer, so set document text ourselves.
                    // put document in CAS (assume CAS)
                    cas.getJCas().setDocumentText(document);
                }

                DocumentID docIdAnnot = new DocumentID(cas
                        .getJCas());
                docIdAnnot.setDocumentID(getDocumentID(rs));
                docIdAnnot.addToIndexes();

                logger.info("Reading document with ID="
                        + docIdAnnot.getDocumentID());
            } catch (Exception e)
            {
                logger.error("CasInitializer failed to process document: ");
                logger.error(document);
                throw e;
View Full Code Here

          fileInputStream.close();
     
       
    }

    DocumentID documentIDAnnotation = new DocumentID(jCas);
    documentIDAnnotation.setDocumentID(filename);
    documentIDAnnotation.addToIndexes();

   
    this.completed += 1;
  }
View Full Code Here

 
  NegExAnnotation a = list.get(i);
  i++;

  jCas.setDocumentText(a.sentenceText);
  DocumentID documentID = new DocumentID(jCas);
  documentID.setDocumentID("doc" + a.lineNumber);
  documentID.addToIndexes();
  EventMention ia = new EventMention(jCas);
  ia.setBegin(Integer.parseInt(a.begin));
  ia.setEnd(Integer.parseInt(a.end));
  if (!skipReadingValuesJustReadText) ia.setPolarity(Integer.parseInt(a.polarity));
  ia.addToIndexes();
View Full Code Here

      int i = knowtatorTextSourceFiles.length;
      LOGGER.info("Processing " + i + " knowtator text source files for this directory.");
      for (File textFile : knowtatorTextSourceFiles) {
        JCas jCas = mipacqReader.newJCas();
        jCas.setDocumentText(Files.toString(textFile, Charsets.US_ASCII));
        DocumentID documentID = new DocumentID(jCas);
        documentID.setDocumentID(textFile.toURI().toString());
        documentID.addToIndexes();
        mipacqReader.process(jCas);
        documentID.setDocumentID(textFile.getName());
        xWriter.process(jCas);
      }
    }

  }
View Full Code Here

      JFSIndexRepository indexes = jcas.getJFSIndexRepository();
     
     FSIterator<TOP> documentIDIterator = indexes.getAllIndexedFS(DocumentID.type);
      if(documentIDIterator.hasNext())
      {
        DocumentID dia = (DocumentID)documentIDIterator.next();
        iv_sb.append(dia.getDocumentID());
      }
      else
      {
        iv_sb.append("Error in CasInitializer(?) NO_DOC_ID");
      }
View Full Code Here

   
    File file = docs[index];
    String fn = file.getName();
    logger.info("Reading file: " + fn);
    fn = fn.substring(0, fn.lastIndexOf('.'));
    DocumentID docId = new DocumentID(jcas);
    docId.setDocumentID(fn);
    docId.addToIndexes();
   
    scanner = new Scanner(file);
    int lineNum = 1;
    int charNum = 0;
    while(scanner.hasNextLine()){
View Full Code Here

    if (iv_logger.isInfoEnabled()) {
       JFSIndexRepository indexes = jcas.getJFSIndexRepository();
       FSIterator<TOP> documentIDIterator = indexes.getAllIndexedFS(DocumentID.type);
      if (documentIDIterator.hasNext()) {
        DocumentID didAnn = (DocumentID) documentIDIterator.next();
        recordID = didAnn.getDocumentID();

        if (iv_logger.isInfoEnabled())
          iv_logger.info("Processing record [" + recordID + "]");
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.ctakes.typesystem.type.structured.DocumentID

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.