Package edu.stanford.nlp.ling

Examples of edu.stanford.nlp.ling.Word$WordFactoryHolder


      if (node.isLeaf() || node.children().length < 2) {
        continue;
      }
      // every child with a different head (or repeated) is an argument
      Label l = node.label();
      Word w = null;
      if (hf != null) {
        Tree hwt = node.headTerminal(hf);
        if (hwt != null) {
          w = new Word(hwt.label());
        }
      } else {
        if (l instanceof HasWord) {
          w = new Word(((HasWord) l).word());
        }
      }
      Tree[] kids = node.children();
      boolean seenHead = false;
      for (int cNum = 0; cNum < kids.length; cNum++) {
        Tree child = kids[cNum];
        Label dl = child.label();
        Word dw = null;
        if (hf != null) {
          Tree dwt = child.headTerminal(hf);
          if (dwt != null) {
            dw = new Word(dwt.label());
          }
        } else {
          if (dl instanceof HasWord) {
            dw = new Word(((HasWord) dl).word());
          }
        }
        // System.out.println("XX Doing pair: " + l + ", " + dl +
        //                 " gives " + w + ", " +dw);
        if (w != null && w.word() != null && dw != null && w.word().equals(dw.word()) && !seenHead) {
          seenHead = true;
        } else {
          Dependency<Label, Label, Object> p = new UnnamedDependency(w, dw);
          if (f.accept(p)) {
            deps.add(p);
View Full Code Here


      // cdm: this is new hacked in stuff in Mar 2007 so we can now have a
      // well-typed version of a Sentence, whose objects MUST implement HasWord
      if (lab instanceof HasWord) {
        y.add((X) lab);
      } else {
        y.add((X) new Word(lab));
      }
    } else {
      Tree[] kids = children();
      for (int i = 0; i < kids.length; i++) {
        kids[i].yield(y);
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.ling.Word$WordFactoryHolder

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.