Package edu.stanford.nlp.ling

Examples of edu.stanford.nlp.ling.WordTag$LabelFactoryHolder


   *  The default is to lowercase non-proper-nouns, unless options have
   *  been set.
   */
  public static WordTag stemStatic(String word, String tag) {
    initStaticLexer();
    return new WordTag(lemmatize(word, tag, staticLexer, staticLexer.option(1)), tag);
  }
View Full Code Here


  }


  public Object apply(Object in) {
    if (in instanceof WordTag) {
      WordTag wt = (WordTag) in;
      String tag = wt.tag();
      return new WordTag(lemmatize(wt.word(), tag, lexer, lexer.option(1)), tag);
    }
    if (in instanceof Word) {
      return stem((Word) in);
    }
    return in;
View Full Code Here

  public PairsHolder() {}

  // todo: This method seems crazy.  Can't we either just do nothing or using ensureCapacity()?
  public void setSize(int s) {
    while (arr.size() < s) {
      arr.add(new WordTag(null,"NN"))// todo: remove NN.  NA okay?
    }
  }
View Full Code Here

  private static String treeAsStemmedCollocation(Tree t, boolean threadSafe) {
    List<WordTag> list= getStemmedWordTagsFromTree(t, threadSafe);
    // err.println(list.size());
    StringBuffer s = new StringBuffer(160);
    WordTag firstWord = list.remove(0);
    s.append(firstWord.word());
    for(WordTag wt : list) {
      s.append("_");
      s.append(wt.word());
    }
    //err.println("Expressing this as:"+s.toString());
View Full Code Here

  private static String treeAsNonStemmedCollocation(Tree t) {
    List<WordTag> list= getNonStemmedWordTagsFromTree(t);

    StringBuffer s = new StringBuffer(160);
    WordTag firstWord = list.remove(0);
    s.append(firstWord.word());
    for(WordTag wt : list) {
      s.append("_");
      s.append(wt.word());
    }
    return s.toString();
View Full Code Here

   */
  private static List<WordTag> getStemmedWordTagsFromTree(Tree t, boolean threadSafe) {
    List<WordTag> stemmedWordTags = Generics.newArrayList();
    ArrayList<TaggedWord> s = t.taggedYield();
    for (TaggedWord w : s) {
      WordTag wt = threadSafe ? Morphology.stemStaticSynchronized(w.word(), w.tag())
              : Morphology.stemStatic(w.word(), w.tag());
      stemmedWordTags.add(wt);
    }
    return stemmedWordTags;
  }
View Full Code Here

  private static List<WordTag> getNonStemmedWordTagsFromTree(Tree t) {
    List<WordTag> wordTags = Generics.newArrayList();
    ArrayList<TaggedWord> s = t.taggedYield();
    for (TaggedWord w : s) {
      WordTag wt = new WordTag(w.word(), w.tag());
      wordTags.add(wt);
    }
    return wordTags;
  }
View Full Code Here

                                totalWords + totalSentences + sentence.size(),
                                totalWords + totalSentences + i,
                                pairs, maxentTagger.extractors);
        String tag = tags.get(i);
        String word = words.get(i);
        pairs.add(new WordTag(word,tag));
        int y = maxentTagger.addTag(tag);
        DataWordTag dat = new DataWordTag(h, y, tag);
        v.add(dat);

        IntCounter<String> tagCounts = wordTagCounts.get(word);
View Full Code Here

    c.incrementCount(tw1);
    TaggedWord tw2 = new TaggedWord("w", "t2");
    System.out.println(c.containsKey(tw2));
    System.out.println(tw1.equals(tw2));

    WordTag wt1 = toWordTag(tw1);
    WordTag wt2 = toWordTag(tw2);
    WordTag wt3 = new WordTag("w", "t2");
    System.out.println(wt1.equals(wt2));
    System.out.println(wt2.equals(wt3));
  }
View Full Code Here

    System.out.println(wt1.equals(wt2));
    System.out.println(wt2.equals(wt3));
  }

  private static WordTag toWordTag(TaggedWord tw) {
    return new WordTag(tw.word(), tw.tag());
  }
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.ling.WordTag$LabelFactoryHolder

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.