Package edu.stanford.nlp.ling

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


    String baseParentStr = ctlp.basicCategory(parentStr);
    String baseGrandParentStr = ctlp.basicCategory(grandParentStr);

    CoreLabel lab = (CoreLabel) t.label();
    String word = lab.word();
    String tag = lab.tag();
    String baseTag = ctlp.basicCategory(tag);
    String category = lab.value();
    String baseCategory = ctlp.basicCategory(category);
View Full Code Here


                    || l.get(constVars.getAnswerClass().get(label)) == null
                    || !l.get(constVars.getAnswerClass().get(label)).equals(
                        label.toString())) {
                  useWordNotLabeled = true;
                }
                phrase += " " + l.word();
                phraseLemma += " " + l.lemma();
                addedindices[i-s] = true;
              }
            }
          }
View Full Code Here

//                  new HashSet<Integer>(), new HashSet<Integer>(),
//                  new HashSet<Integer>()));
          p.put(i, new HashSet<E>());
          CoreLabel token = sent.get(i);
          // do not create patterns around stop words!
          if (PatternFactory.doNotUse(token.word(), constVars.getStopWords())) {
            continue;
          }

          Set<E> pat = Pattern.getContext(constVars.patternType, sent, i);
          p.put(i, pat);
View Full Code Here

      CoreLabel coreLabel = (CoreLabel) label;
      String lemma = coreLabel.lemma();
      //PTB escaping since we're going to put this in the leaf
      if (lemma == null) {
        // No lemma, so just add the surface form
        lemma = coreLabel.word();
      } else if (lemma.equals("(")) {
        lemma = "-LRB-";
      } else if (lemma.equals(")")) {
        lemma = "-RRB-";
      }
View Full Code Here

            me.set(CoreAnnotations.AnswerAnnotation.class, "NUMBER");
          }
        } else if (ORDINAL_PATTERN.matcher(me.word()).matches()) {
          if ((next.word() != null && MONTH_PATTERN.matcher(next.word()).matches()) ||
              (next.word() != null && next.word().equalsIgnoreCase("of") &&
               next2.word() != null && MONTH_PATTERN.matcher(next2.word()).matches())) {
            me.set(CoreAnnotations.AnswerAnnotation.class, "DATE");
          }
        } else if(GENERIC_TIME_WORDS.matcher(me.word()).matches()){
          me.set(CoreAnnotations.AnswerAnnotation.class, "TIME");
        }
View Full Code Here

            me.set(CoreAnnotations.AnswerAnnotation.class, "NUMBER");
          }
        } else if (ORDINAL_PATTERN.matcher(me.word()).matches()) {
          if ((next.word() != null && MONTH_PATTERN.matcher(next.word()).matches()) ||
              (next.word() != null && next.word().equalsIgnoreCase("of") &&
               next2.word() != null && MONTH_PATTERN.matcher(next2.word()).matches())) {
            me.set(CoreAnnotations.AnswerAnnotation.class, "DATE");
          }
        } else if(GENERIC_TIME_WORDS.matcher(me.word()).matches()){
          me.set(CoreAnnotations.AnswerAnnotation.class, "TIME");
        }
View Full Code Here

          me.set(CoreAnnotations.AnswerAnnotation.class, "TIME");
        }
      } else if (me.getString(CoreAnnotations.PartOfSpeechAnnotation.class).equals("JJ")) {
        if ((next.word() != null && MONTH_PATTERN.matcher(next.word()).matches()) ||
            next.word() != null && next.word().equalsIgnoreCase("of") &&
            next2.word() != null && MONTH_PATTERN.matcher(next2.word()).matches()) {
          me.set(CoreAnnotations.AnswerAnnotation.class, "DATE");
        } else if (ORDINAL_PATTERN.matcher(me.word()).matches()) {
          // don't do other tags: don't want 'second' as noun, or 'first' as adverb
          // introducing reasons
          me.set(CoreAnnotations.AnswerAnnotation.class, "ORDINAL");
View Full Code Here

          me.set(CoreAnnotations.AnswerAnnotation.class, "TIME");
        }
      } else if (me.getString(CoreAnnotations.PartOfSpeechAnnotation.class).equals("JJ")) {
        if ((next.word() != null && MONTH_PATTERN.matcher(next.word()).matches()) ||
            next.word() != null && next.word().equalsIgnoreCase("of") &&
            next2.word() != null && MONTH_PATTERN.matcher(next2.word()).matches()) {
          me.set(CoreAnnotations.AnswerAnnotation.class, "DATE");
        } else if (ORDINAL_PATTERN.matcher(me.word()).matches()) {
          // don't do other tags: don't want 'second' as noun, or 'first' as adverb
          // introducing reasons
          me.set(CoreAnnotations.AnswerAnnotation.class, "ORDINAL");
View Full Code Here

    if (DEBUG) {
      System.err.println("leftScan from: " + pl.get(i).word());
    }
    for (int j = i - 1; j >= 0 && j >= i - 3; j--) {
      CoreLabel fl = pl.get(j);
      if (fl.word().startsWith("weigh")) {
        if (DEBUG) {
          System.err.println("leftScan found weight: " + fl.word());
        }
        return true;
      }
View Full Code Here

    }
    for (int j = i - 1; j >= 0 && j >= i - 3; j--) {
      CoreLabel fl = pl.get(j);
      if (fl.word().startsWith("weigh")) {
        if (DEBUG) {
          System.err.println("leftScan found weight: " + fl.word());
        }
        return true;
      }
    }
    return false;
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.