Examples of InputStreamFactory


Examples of com.google.enterprise.connector.util.InputStreamFactory

      String content = jo.getString(SpiConstants.PROPNAME_CONTENT);
      List<Value> values;
      if (Strings.isNullOrEmpty(content)) {
        values = null;
      } else {
        InputStreamFactory factory =
            InputStreamFactories.fromBase64String(content);
        jo.put(SpiConstants.PROPNAME_CONTENT, factory);
        values = ImmutableList.of(Value.getBinaryValue(factory));
      }
      mapBuilder.put(SpiConstants.PROPNAME_CONTENT, values);
View Full Code Here

Examples of com.google.enterprise.connector.util.InputStreamFactory

  }

  /** Tests BinaryValue constructors - InputStreamFactory. */
  public void testBinaryValueInputStreamFactory() throws Exception {
    testBinaryValue(Value.getBinaryValue(
        new InputStreamFactory() {
          public InputStream getInputStream() {
            return new ByteArrayInputStream(CONTENTS_BYTES);
          }
        }));
  }
View Full Code Here

Examples of com.google.enterprise.connector.util.InputStreamFactory

  }

  /** Tests BinaryValue constructors - InputStreamFactory. */
  public void testBinaryValueInputStreamFactoryError() throws Exception {
    BinaryValue value = (BinaryValue) Value.getBinaryValue(
        new InputStreamFactory() {
          public InputStream getInputStream() throws IOException {
            throw new IOException("Test Exception");
          }
        });

View Full Code Here

Examples of opennlp.tools.util.InputStreamFactory

    assertEquals(ADParagraphStreamTest.NUM_SENTENCES, count);
  }

  private static ADSentenceStream openData() throws IOException {
    InputStreamFactory in = new ResourceAsStreamFactory(ADParagraphStreamTest.class, "/opennlp/tools/formats/ad.sample");

    return new ADSentenceStream(new PlainTextByLineStream(in, "UTF-8"));
  }
View Full Code Here

Examples of opennlp.tools.util.InputStreamFactory

  }

  @Before
  public void setup() throws IOException {
    InputStreamFactory in = new ResourceAsStreamFactory(
        ADParagraphStreamTest.class, "/opennlp/tools/formats/ad.sample");

    ADChunkSampleStream stream = new ADChunkSampleStream(
      new PlainTextByLineStream(in, "UTF-8"));
View Full Code Here

Examples of opennlp.tools.util.InputStreamFactory

public class DoccatFactoryTest {

  private static ObjectStream<DocumentSample> createSampleStream()
      throws IOException {

    InputStreamFactory isf = new ResourceAsStreamFactory(
        DoccatFactoryTest.class, "/opennlp/tools/doccat/DoccatSample.txt");

    return new DocumentSampleStream(new PlainTextByLineStream(isf, "UTF-8"));
  }
View Full Code Here

Examples of opennlp.tools.util.InputStreamFactory

  private static final String ENGLISH_SAMPLE = "conll2003-en.sample";
  private static final String GERMAN_SAMPLE = "conll2003-de.sample";


  private static ObjectStream<NameSample> openData(LANGUAGE lang, String name) throws IOException {
    InputStreamFactory in = new ResourceAsStreamFactory(Conll03NameSampleStreamTest.class,
        "/opennlp/tools/formats/" + name);

    return new Conll03NameSampleStream(lang, in, Conll02NameSampleStream.GENERATE_PERSON_ENTITIES);
  }
View Full Code Here

Examples of opennlp.tools.util.InputStreamFactory

* Sample training data must be UTF-8 encoded and uncompressed!
*/
public class Conll02NameSampleStreamTest {

  private static ObjectStream<NameSample> openData(LANGUAGE lang, String name) throws IOException {
    InputStreamFactory in = new ResourceAsStreamFactory(Conll02NameSampleStreamTest.class,
        "/opennlp/tools/formats/" + name);

    return new Conll02NameSampleStream(lang, in, Conll02NameSampleStream.GENERATE_PERSON_ENTITIES);
  }
View Full Code Here

Examples of opennlp.tools.util.InputStreamFactory

    assertEquals(new Span(5, 6, "person"), samples.get(7).getNames()[2]);
  }

  @Before
  public void setup() throws IOException {
    InputStreamFactory in = new ResourceAsStreamFactory(ADParagraphStreamTest.class,
        "/opennlp/tools/formats/ad.sample");

    ADNameSampleStream stream = new ADNameSampleStream(
        new PlainTextByLineStream(in, "UTF-8"), true);
View Full Code Here

Examples of opennlp.tools.util.InputStreamFactory

public class ConllXPOSSampleStreamTest {

  @Test
  public void testParsingSample() throws IOException {

    InputStreamFactory in = new ResourceAsStreamFactory(ConllXPOSSampleStreamTest.class,
        "/opennlp/tools/formats/conllx.sample");

    ObjectStream<POSSample> sampleStream = new ConllXPOSSampleStream(in,Charset.forName("UTF-8"));

    POSSample a = sampleStream.read();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.