Tabnine Logo
TextReader
Code IndexAdd Tabnine to your IDE (free)

How to use
TextReader
in
de.tudarmstadt.ukp.dkpro.core.io.text

Best Java code snippets using de.tudarmstadt.ukp.dkpro.core.io.text.TextReader (Showing top 5 results out of 315)

origin: de.tudarmstadt.ukp.dkpro.core/de.tudarmstadt.ukp.dkpro.core.io.text-asl

  @Override
  public void getNext(CAS aJCas)
    throws IOException, CollectionException
  {
    Resource res = nextFile();
    initCas(aJCas, res);

    try (InputStream is = new BufferedInputStream(
        CompressionUtils.getInputStream(res.getLocation(), res.getInputStream()))) {
      String text;

      if (ENCODING_AUTO.equals(sourceEncoding)) {
        CharsetDetector detector = new CharsetDetector();
        text = IOUtils.toString(detector.getReader(is, null));
      }
      else {
        text = IOUtils.toString(is, sourceEncoding);
      }
      
      aJCas.setDocumentText(text);        
    }
  }
}
origin: dkpro/dkpro-tc

@Override
public void initialize(UimaContext context) throws ResourceInitializationException
{
  super.initialize(context);
  goldLabelMap = new HashMap<String, List<String>>();
  try {
    URL resourceUrl = ResourceUtils.resolveLocation(goldLabelFile, this, context);
    for (String line : FileUtils.readLines(new File(resourceUrl.toURI()), "utf-8")) {
      String[] parts = line.split(" ");
      if (parts.length < 2) {
        throw new IOException("Wrong file format in line: " + line);
      }
      String fileId = parts[0].split("/")[1];
      List<String> labels = new ArrayList<String>();
      for (int i = 1; i < parts.length; i++) {
        labels.add(parts[i]);
      }
      goldLabelMap.put(fileId, labels);
    }
  }
  catch (IOException e) {
    throw new ResourceInitializationException(e);
  }
  catch (URISyntaxException ex) {
    throw new ResourceInitializationException(ex);
  }
}
origin: dkpro/dkpro-tc

@Override
public void getNext(CAS aCAS) throws IOException, CollectionException
{
  super.getNext(aCAS);
  JCas jcas;
  try {
    jcas = aCAS.getJCas();
  }
  catch (CASException e) {
    throw new CollectionException();
  }
  for (String outcomeValue : getTextClassificationOutcomes(jcas)) {
    TextClassificationOutcome outcome = new TextClassificationOutcome(jcas);
    outcome.setOutcome(outcomeValue);
    outcome.addToIndexes();
  }
}
origin: de.tudarmstadt.ukp.dkpro.tc/de.tudarmstadt.ukp.dkpro.tc.core-asl

  @Override
  public void getNext(CAS aCAS)
    throws IOException, CollectionException
  {
    super.getNext(aCAS);
    
    JCas jcas;
    try {
      jcas = aCAS.getJCas();
    }
    catch (CASException e) {
      throw new CollectionException();
    }

    TextClassificationOutcome outcome = new TextClassificationOutcome(jcas);
    outcome.setOutcome(getTextClassificationOutcome(jcas));
    outcome.addToIndexes();
  }
}
origin: de.tudarmstadt.ukp.dkpro.tc/de.tudarmstadt.ukp.dkpro.tc.core-asl

  @Override
  public void getNext(CAS aCAS)
    throws IOException, CollectionException
  {
    super.getNext(aCAS);
    
    JCas jcas;
    try {
      jcas = aCAS.getJCas();
    }
    catch (CASException e) {
      throw new CollectionException();
    }

    for (String outcomeValue : getTextClassificationOutcomes(jcas)) {
      TextClassificationOutcome outcome = new TextClassificationOutcome(jcas);
      outcome.setOutcome(outcomeValue);
      outcome.addToIndexes();
    }
  }
}
de.tudarmstadt.ukp.dkpro.core.io.textTextReader

Javadoc

UIMA collection reader for plain text files.

Most used methods

  • getNext
  • initCas
  • initialize
  • nextFile

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onCreateOptionsMenu (Activity)
  • getApplicationContext (Context)
  • getSharedPreferences (Context)
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now