Examples of Sentence


Examples of org.apache.ctakes.typesystem.type.textspan.Sentence

        AnnotationIndex nodeIndex = jCas.getAnnotationIndex(ConllDependencyNode.type);
        AnnotationIndex tokenIndex = jCas.getAnnotationIndex(BaseToken.type);
        FSIterator sentences = jCas.getAnnotationIndex(Sentence.type).iterator();

        while (sentences.hasNext()) {
            Sentence sentence = (Sentence) sentences.next();

            tokens.clear();
            nodes.clear();

            FSIterator tokenIterator = tokenIndex.subiterator(sentence);
View Full Code Here

Examples of org.apache.stanbol.enhancer.nlp.model.Sentence

            //first the sentences
            TokenStream sentences = new SentenceTokenizer(new CharSequenceReader(at.getText()));
            try {
                while(sentences.incrementToken()){
                    OffsetAttribute offset = sentences.addAttribute(OffsetAttribute.class);
                    Sentence s = at.addSentence(offset.startOffset(), offset.endOffset());
                    if(log.isTraceEnabled()) {
                        log.trace("detected {}:{}",s,s.getSpan());
                    }
                }
            } catch (IOException e) {
                String message = String.format("IOException while reading from "
                    +"CharSequenceReader of AnalyzedText for ContentItem %s",ci.getUri());
View Full Code Here

Examples of org.apache.uima.examples.opennlp.Sentence

    AnnotationIndex tokenIndex = aJCas.getAnnotationIndex(Token.type);

    // iterate over Sentences
    FSIterator sentenceIterator = sentenceIndex.iterator();
    while (sentenceIterator.hasNext()) {
      Sentence sentence = (Sentence) sentenceIterator.next();

      wordList.clear();
      sentenceBuffer.setLength(0);

      int mapIdx = 0;
View Full Code Here

Examples of org.apache.uima.fit.examples.type.Sentence

    AnalysisEngine a3 = AnalysisEngineFactory.createEngine(Annotator3.class,
            typeSystemDescription);
    jCas.setDocumentText("betgetjetletmetnetpetsetvetwetyet");
    SimplePipeline.runPipeline(jCas, a1, a2, a3);

    Sentence sentence = JCasUtil.selectByIndex(jCas, Sentence.class, 0);
    assertEquals("metnetpetsetvetwetyet", sentence.getCoveredText());
  }
View Full Code Here

Examples of org.apache.uima.fit.type.Sentence

    // index1 is a sorted index, so when adding a token twice, both remain in the index
    Token token2 = new Token(jcas, 3, 4);
    token2.addToIndexes();
    token2.addToIndexes();

    Sentence sentence1 = new Sentence(jcas, 1, 2);
    sentence1.addToIndexes();

    // index2 is a set index, so even when adding a sentence twice, only one remains in the index
    Sentence sentence2 = new Sentence(jcas, 3, 4);
    sentence2.addToIndexes();
    sentence2.addToIndexes();

    FSIndex<FeatureStructure> index1 = jcas.getFSIndexRepository().getIndex("index1");
    FSIndex<FeatureStructure> index2 = jcas.getFSIndexRepository().getIndex("index2");

    assertEquals(3, index1.size());
View Full Code Here

Examples of org.arquillian.spacelift.process.Sentence

                writer.write(interaction.typesInitialText().getBytes());
                writer.flush();
                output.add(interaction.typesInitialText());
            }

            Sentence sentence = new SentenceImpl();
            // we have an extra check to figure out whether EOF was reached - using last expected response
            while (!reachedEOF && (i = reader.read()) != -1) {
                // add the character
                sentence.append((char) i);

                boolean shouldTerminate = interaction.shouldTerminate(sentence);
                String answer = interaction.repliesTo(sentence);
                // sentence was not empty, reply
                if (answer != null) {
                    sentence.append(answer);
                    writer.flush();
                    writer.write(answer.getBytes());
                    writer.flush();
                }
                if (shouldTerminate) {
                    runningProcess.markAsFinished();
                    runningProcess.terminate();
                }

                reachedEOF = runningProcess.isMarkedAsFinished();

                // save and print output
                if (sentence.isFinished()) {
                    sentence.trim();
                    log.log(Level.FINEST, "({0}): {1}", new Object[] { result.processName(), sentence });

                    output.add(sentence.toString());
                    // propagate output/error to user
                    if (interaction.shouldOutput(sentence)) {
                        System.out.println(interaction.transform(sentence));
                    }
                    if (interaction.shouldOutputToErr(sentence)) {
                        System.err.println(interaction.transform(sentence));
                    }
                    sentence.reset();
                }
            }

            // handle last line
            if (!sentence.isEmpty()) {
                log.log(Level.FINEST, "{0} outputs: {1}", new Object[] { result.processName(), sentence });

                output.add(sentence.toString());
                // propagate output/error to user
                if (interaction.shouldOutput(sentence)) {
                    System.out.println(interaction.transform(sentence));
                }
                if (interaction.shouldOutputToErr(sentence)) {
View Full Code Here

Examples of org.fnlp.nlp.parser.Sentence

    LabelAlphabet postagAlphabet = factory.buildLabelAlphabet("postag");

    int count = 0;
    while (reader.hasNext()) {

      Sentence instance = (Sentence) reader.next();
      int[] heads = (int[]) instance.getTarget();
      ParsingState state = new ParsingState(instance,factory);
      while (!state.isFinalState()) {
        // 左右焦点词在句子中的位置
        int[] lr = state.getFocusIndices();

        HashSparseVector features = state.getFeatures();
        ParsingState.Action action = getAction(lr[0], lr[1],
            heads);
        state.next(action);
        if (action == ParsingState.Action.LEFT)
          heads[lr[1]] = -1;
        if (action == ParsingState.Action.RIGHT)
          heads[lr[0]] = -1;

        // writer.write(String.valueOf(instance.postags[lr[0]]));
        String pos = instance.getTagAt(lr[0]);
        postagAlphabet.lookupIndex(pos);
        writer.write(pos);
        writer.write(" ");
        switch (action) {
        case LEFT:
View Full Code Here

Examples of org.ictclas4j.bean.Sentence

            if (Utility.SEPERATOR_C_SUB_SENTENCE.indexOf(ss[i]) == -1
                && Utility.SEPERATOR_E_SUB_SENTENCE
                    .indexOf(ss[i]) == -1)
              s1 += Utility.SENTENCE_END;

            result.add(new Sentence(s1, true));
            s1 = "";
          }

          // �ǻس����з���ո�����Ҫ���з�������
          if (Utility.SEPERATOR_LINK.indexOf(ss[i]) != -1) {
            result.add(new Sentence(ss[i]));
            s1 = Utility.SENTENCE_BEGIN;

          } else if (Utility.SEPERATOR_C_SENTENCE.indexOf(ss[i]) != -1
              || Utility.SEPERATOR_E_SENTENCE.indexOf(ss[i]) != -1)
            s1 = Utility.SENTENCE_BEGIN;
          else s1 = Utility.SENTENCE_BEGIN;
//            s1 = ss[i];

        } else
          s1 += ss[i];
      }

      if (s1.length() > 0 && !Utility.SENTENCE_BEGIN.equals(s1)) {
        s1 += Utility.SENTENCE_END;
        result.add(new Sentence(s1, true));
      }
    }
    return result;
  }
View Full Code Here

Examples of org.snu.ids.ha.ma.Sentence

        KkmaInterface ki = new KkmaInterface();

        // Test morphAnalyzer
        List<Sentence> sentenceList = ki.morphAnalyzer(phrase);
        for (int i = 0; i < sentenceList.size(); i++) {
            Sentence st = sentenceList.get(i);
            System.out.println("* " + st.getSentence());
            for (int j = 0; j < st.size(); j++) {
                System.out.println((st.get(j)));
            }
        }

        // Test extractNoun
        KeywordList kl = ki.extractNoun(phrase);
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.