Package edu.stanford.nlp.sequences

Examples of edu.stanford.nlp.sequences.PlainTextDocumentReaderAndWriter


        }

        int outputStyle = PlainTextDocumentReaderAndWriter.asIntOutputFormat(config.getOutputFormat());
        if (config.getSGML()) {
          // this uses NER codebase technology to read/write SGML-ish files
          PlainTextDocumentReaderAndWriter readerAndWriter = new PlainTextDocumentReaderAndWriter();
          ObjectBank<List<CoreLabel>> ob = new ObjectBank<List<CoreLabel>>(new ReaderIteratorFactory(br), readerAndWriter);
          PrintWriter pw = new PrintWriter(writer);
          for (List<CoreLabel> sentence : ob) {
            Sentence<CoreLabel> s = new Sentence<CoreLabel>(sentence);
            numWords += s.length();
            Sentence<TaggedWord> taggedSentence = MaxentTagger.tagSentence(s);
            Iterator<CoreLabel> origIter = sentence.iterator();
            for (TaggedWord tw : taggedSentence) {
              CoreLabel cl = origIter.next();
              cl.set(CoreAnnotations.AnswerAnnotation.class, tw.tag());
            }
            readerAndWriter.printAnswers(sentence, pw, outputStyle, true);
          }
        } else {
          //Now we do everything through the doc preprocessor
          List<List<? extends HasWord>> document;
          if ((config.getTagInside() != null && !config.getTagInside().equals(""))) {
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.sequences.PlainTextDocumentReaderAndWriter

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.