Package gate

Examples of gate.Corpus


      }
      // otherwise, the document is already adopted by this datastore so we
      // silently ignore this.
    } else if(lr instanceof CorpusImpl) {
      // only a transient, empty corpus can be adopted!!!
      Corpus corpus = (Corpus)lr;
      if(corpus.getDataStore() != null) {
        throw new PersistenceException(
          "Cannot adopt corpus "+corpus.getName()+
          " which belongs to datastore "+corpus.getDataStore().getName());
      }
      if(corpus.size() != 0) {
        throw new PersistenceException(
          "Cannot adopt corpus "+corpus.getName()+
          " which is non empty, number of documents contained: "+
          corpus.size());
      }
      // since this is a valid corpus, we adopt it by returning new
      // DocumentSubsetCorpus which has the original corpus as a parent
      FeatureMap parms = Factory.newFeatureMap();
      parms.put("jdbcCorpus", ourCorpus);
      try {
        Resource newCorpus = Factory.createResource(
          "at.ofai.gate.virtualcorpus.JDBCSubsetCorpus", parms,
          corpus.getFeatures(), corpus.getName());
        lr = (LanguageResource)newCorpus;
      } catch (ResourceInstantiationException ex) {
        throw new PersistenceException(
          "Could not adopt corpus "+corpus.getName(),ex);
      }
    } else {
      throw new PersistenceException("Cannot adopt LR: "+lr.getName());
    }
    return lr;
View Full Code Here


      }
      // otherwise, the document is already adopted by this datastore so we
      // silently ignore this.
    } else if(lr instanceof CorpusImpl) {
      // only a transient, empty corpus can be adopted!!!
      Corpus corpus = (Corpus)lr;
      if(corpus.getDataStore() != null) {
        throw new PersistenceException(
          "Cannot adopt corpus "+corpus.getName()+
          " which belongs to datastore "+corpus.getDataStore().getName());
      }
      if(corpus.size() != 0) {
        throw new PersistenceException(
          "Cannot adopt corpus "+corpus.getName()+
          " which is non empty, number of documents contained: "+
          corpus.size());
      }
      // since this is a valid corpus, we adopt it by returning new
      // DocumentSubsetCorpus which has the original corpus as a parent
      FeatureMap parms = Factory.newFeatureMap();
      parms.put("directoryCorpus", ourCorpus);
      try {
        Resource newCorpus = Factory.createResource("at.ofai.gate.virtualcorpus.DirectorySubsetCorpus", parms, corpus.getFeatures(), corpus.getName());
        lr = (LanguageResource)newCorpus;
      } catch (ResourceInstantiationException ex) {
        throw new PersistenceException("Could not adopt corpus "+corpus.getName(),ex);
      }
    } else {
      throw new PersistenceException("Cannot adopt LR: "+lr.getName());
    }
    return lr;
View Full Code Here

  public void extractData(String sequenceType, String elementType,
      String labelType) throws ExecutionException,
      InvalidOffsetException, ResourceInstantiationException {

    // run the application on the document
    Corpus corpus = Factory.newCorpus("Edlin Corpus");
    corpus.add(document);
    pipeline.setCorpus(corpus);
    pipeline.execute();
    Factory.deleteResource(corpus);
    Factory.deleteResource(pipeline);
View Full Code Here

  public void label(String sequenceType, String elementType, String labelType)
  throws ExecutionException, InvalidOffsetException,
  ResourceInstantiationException {

    // run the application on the document
    Corpus corpus = Factory.newCorpus("Edlin Corpus");
    corpus.add(document);
    pipeline.setCorpus(corpus);
    pipeline.execute();
    Factory.deleteResource(corpus);
    Factory.deleteResource(pipeline);
View Full Code Here

  public void extractData(String sequenceType, String elementType,
      String labelType) throws ExecutionException,
      InvalidOffsetException, ResourceInstantiationException {
   
    // run the application on the document
    Corpus corpus = Factory.newCorpus("Edlin Corpus");
    corpus.add(document);
    pipeline.setCorpus(corpus);
    pipeline.execute();
    Factory.deleteResource(corpus);
    Factory.deleteResource(pipeline);
View Full Code Here

    //specify noun and verb chunk types
    String nChunkType = "NounChunk";
    String vChunkType = "VerbChunk";
   
    // run the application on the document
    Corpus corpus = Factory.newCorpus("Edlin Corpus");
    corpus.add(document);
    pipeline.setCorpus(corpus);
    pipeline.execute();
    Factory.deleteResource(corpus);
    Factory.deleteResource(pipeline);
   
View Full Code Here

    String locType = "Location";
    String orgType = "Organisation";
    String perType = "Person";

    // run the application on the document
    Corpus corpus = Factory.newCorpus("Edlin Corpus");
    corpus.add(document);
    pipeline.setCorpus(corpus);
    pipeline.execute();
    Factory.deleteResource(corpus);
    Factory.deleteResource(pipeline);
View Full Code Here

  public void label(String sequenceType, String elementType, String labelType)
      throws ExecutionException, InvalidOffsetException,
      ResourceInstantiationException {

    // run the application on the document
    Corpus corpus = Factory.newCorpus("Edlin Corpus");
    corpus.add(document);
    pipeline.setCorpus(corpus);
    pipeline.execute();
    Factory.deleteResource(corpus);
    Factory.deleteResource(pipeline);
View Full Code Here

TOP

Related Classes of gate.Corpus

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.