Package edu.stanford.nlp.ling

Examples of edu.stanford.nlp.ling.CoreLabel.word()


        CoreLabel nxt = tokens.get(i + 1);

        // trailing +
        if(crt.endPosition() == nxt.beginPosition() &&
          ! isParen(crt.word()) &&
          nxt.word().equals("+")){
          String word = crt.word() + nxt.word();
          output.add(tokenFactory.makeToken(word, crt.beginPosition(), word.length()));
          i ++;
          continue;
        }
View Full Code Here


        // trailing +
        if(crt.endPosition() == nxt.beginPosition() &&
          ! isParen(crt.word()) &&
          nxt.word().equals("+")){
          String word = crt.word() + nxt.word();
          output.add(tokenFactory.makeToken(word, crt.beginPosition(), word.length()));
          i ++;
          continue;
        }
View Full Code Here

        // trailing -
        if(crt.endPosition() == nxt.beginPosition() &&
          (i + 2 >= tokens.size() || nxt.endPosition() != tokens.get(i + 2).beginPosition()) &&
          ! isParen(crt.word()) &&
          nxt.word().equals("-")){
          String word = crt.word() + nxt.word();
          output.add(tokenFactory.makeToken(word, crt.beginPosition(), word.length()));
          i ++;
          continue;
        }
View Full Code Here

        // trailing -
        if(crt.endPosition() == nxt.beginPosition() &&
          (i + 2 >= tokens.size() || nxt.endPosition() != tokens.get(i + 2).beginPosition()) &&
          ! isParen(crt.word()) &&
          nxt.word().equals("-")){
          String word = crt.word() + nxt.word();
          output.add(tokenFactory.makeToken(word, crt.beginPosition(), word.length()));
          i ++;
          continue;
        }
View Full Code Here

        }

        // preceding -
        if(crt.endPosition() == nxt.beginPosition() &&
          (i == 0 || crt.beginPosition() != tokens.get(i - 1).endPosition()) &&
          ! isParen(nxt.word()) &&
          crt.word().equals("-")){
          String word = crt.word() + nxt.word();
          output.add(tokenFactory.makeToken(word, crt.beginPosition(), word.length()));
          i ++;
          continue;
View Full Code Here

        // preceding -
        if(crt.endPosition() == nxt.beginPosition() &&
          (i == 0 || crt.beginPosition() != tokens.get(i - 1).endPosition()) &&
          ! isParen(nxt.word()) &&
          crt.word().equals("-")){
          String word = crt.word() + nxt.word();
          output.add(tokenFactory.makeToken(word, crt.beginPosition(), word.length()));
          i ++;
          continue;
        }
      }
View Full Code Here

  private static List<CoreLabel> breakOnPattern(List<CoreLabel> tokens, Pattern pattern) {
    List<CoreLabel> output = new ArrayList<CoreLabel>();
    for (int i = 0; i < tokens.size(); i++) {
      CoreLabel token = tokens.get(i);
      Matcher matcher = pattern.matcher(token.word());
      if (matcher.find()) {
        int sepPos = matcher.start(2);
        String s1 = token.word().substring(0, sepPos);
        if(! DISCARD_STANDALONE_DASHES || ! s1.equals("-")){
          output.add(tokenFactory.makeToken(s1, token.beginPosition(), sepPos));
View Full Code Here

    for (int i = 0; i < tokens.size(); i++) {
      CoreLabel token = tokens.get(i);
      Matcher matcher = pattern.matcher(token.word());
      if (matcher.find()) {
        int sepPos = matcher.start(2);
        String s1 = token.word().substring(0, sepPos);
        if(! DISCARD_STANDALONE_DASHES || ! s1.equals("-")){
          output.add(tokenFactory.makeToken(s1, token.beginPosition(), sepPos));
        }
        String sep = matcher.group(2);
        if(! DISCARD_STANDALONE_DASHES || ! sep.equals("-")){
View Full Code Here

        }
        String sep = matcher.group(2);
        if(! DISCARD_STANDALONE_DASHES || ! sep.equals("-")){
          output.add(tokenFactory.makeToken(sep, token.beginPosition() + sepPos, 1));
        }
        String s3 = token.word().substring(sepPos + 1);
        if(! DISCARD_STANDALONE_DASHES || ! s3.equals("-")){
          output.add(tokenFactory.makeToken(s3, token.beginPosition() + sepPos + 1,
            token.endPosition() - token.beginPosition() - sepPos - 1));
        }
View Full Code Here

        for (int j = 1, size = tokens.size(); j <= size; ++j)
        {
          CoreLabel token = tokens.get(j - 1);
          output.printf("%d\t%s\t_\t%s\t%s\t_\t%d\t%s\t_\t_%n",
                  j, token.word(), token.tag(), token.tag(),
                  token.get(CoreAnnotations.CoNLLDepParentIndexAnnotation.class),
                  token.get(CoreAnnotations.CoNLLDepTypeAnnotation.class));
        }
        output.println();
      }
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.