Package com.clearnlp.dependency

Examples of com.clearnlp.dependency.DEPFeat


  void generation(String[] args)
  {
    Pattern ignore = Pattern.compile("AM-MOD|AM-ADV|C-.+|R-.+");
    DEPTree tree = new DEPTree();
   
    tree.add(new DEPNode(1, "Tell"   , "tell" , "VB" , new DEPFeat()));
    tree.add(new DEPNode(2, "me"     , "me"   , "PRP", new DEPFeat()));
    tree.add(new DEPNode(3, "about"  , "about", "IN" , new DEPFeat()));
    tree.add(new DEPNode(4, "berries", "berry", "NNS", new DEPFeat()));

    tree.get(1).setHead(tree.get(0), DEPLibEn.DEP_ROOT);
    tree.get(2).setHead(tree.get(1), DEPLibEn.DEP_DOBJ);
    tree.get(3).setHead(tree.get(1), DEPLibEn.DEP_PREP);
    tree.get(4).setHead(tree.get(3), DEPLibEn.DEP_POBJ);
View Full Code Here


  void evalSubPOS(String inputFile) throws Exception
  {
    BufferedReader reader = UTInput.createBufferedFileReader(inputFile);
    Pattern delim = Pattern.compile("\t");
    int correct = 0, total = 0;
    DEPFeat p, g;
    String[] ls;
    String line;
   
    while ((line = reader.readLine()) != null)
    {
      line = line.trim();
     
      if (!line.isEmpty())
      {
        ls = delim.split(line);
        g = new DEPFeat(ls[6]);
        p = new DEPFeat(ls[7]);
       
        if (g.get("SubPOS").equals(p.get("SubPOS")))
          correct++;
           
        total++;
      }
    }
View Full Code Here

  void generation(String[] args)
  {
    Pattern ignore = Pattern.compile("AM-MOD|AM-ADV|C-.+|R-.+");
    DEPTree tree = new DEPTree();
   
    tree.add(new DEPNode(1, "Tell"   , "tell" , "VB" , new DEPFeat()));
    tree.add(new DEPNode(2, "me"     , "me"   , "PRP", new DEPFeat()));
    tree.add(new DEPNode(3, "about"  , "about", "IN" , new DEPFeat()));
    tree.add(new DEPNode(4, "berries", "berry", "NNS", new DEPFeat()));

    tree.get(1).setHead(tree.get(0), DEPLibEn.DEP_ROOT);
    tree.get(2).setHead(tree.get(1), DEPLibEn.DEP_DOBJ);
    tree.get(3).setHead(tree.get(1), DEPLibEn.DEP_PREP);
    tree.get(4).setHead(tree.get(3), DEPLibEn.DEP_POBJ);
View Full Code Here

  void evalSubPOS(String inputFile) throws Exception
  {
    BufferedReader reader = UTInput.createBufferedFileReader(inputFile);
    Pattern delim = Pattern.compile("\t");
    int correct = 0, total = 0;
    DEPFeat p, g;
    String[] ls;
    String line;
   
    while ((line = reader.readLine()) != null)
    {
      line = line.trim();
     
      if (!line.isEmpty())
      {
        ls = delim.split(line);
        g = new DEPFeat(ls[6]);
        p = new DEPFeat(ls[7]);
       
        if (g.get("SubPOS").equals(p.get("SubPOS")))
          correct++;
           
        total++;
      }
    }
View Full Code Here

   
    if (head.c2d == null// for terminals: head = itself
    {
      d_head  = head;
      p_head  = null;
      d_feats = new DEPFeat();
    }
    else          // for phrases: head = child
    {
      d_head = head.c2d.getDependencyHead();
      p_head = head;
View Full Code Here

      pos    = (i_pos    < 0) ? null : tmp[i_pos];
      feats  = (i_feats  < 0) ? AbstractColumnReader.BLANK_COLUMN : tmp[i_feats];
      nament = (i_nament < 0) ? null : tmp[i_nament];

      node = tree.get(id);
      node.init(id, form, lemma, pos, new DEPFeat(feats));
      node.nament = nament;
     
      if (i_headId >= 0 && !tmp[i_headId].equals(AbstractColumnReader.BLANK_COLUMN))
        node.setHead(tree.get(Integer.parseInt(tmp[i_headId])), tmp[i_deprel]);
     
View Full Code Here

 
  protected DEPTree getDAG(List<String[]> lines)
  {
    int id, headId, i, size = lines.size();
    String form, lemma, pos, label;
    DEPFeat feats;
    String[] tmp;
    DEPNode node;
   
    DEPTree tree = new DEPTree();
    for (i=0; i<size; i++tree.add(new DEPNode());
   
    for (i=0; i<size; i++)
    {
      tmp   = lines.get(i);
      id    = Integer.parseInt(tmp[i_id]);
      form  = tmp[i_form];
      lemma = tmp[i_lemma];
      pos   = tmp[i_pos];
      feats = new DEPFeat(tmp[i_feats]);
     
      node = tree.get(id);
      node.init(id, form, lemma, pos, feats);
         
      if (i_xheads >= 0 && !tmp[i_xheads].equals(AbstractColumnReader.BLANK_COLUMN))
View Full Code Here

  void generation(String[] args)
  {
    Pattern ignore = Pattern.compile("AM-MOD|AM-ADV|C-.+|R-.+");
    DEPTree tree = new DEPTree();
   
    tree.add(new DEPNode(1, "Tell"   , "tell" , "VB" , new DEPFeat()));
    tree.add(new DEPNode(2, "me"     , "me"   , "PRP", new DEPFeat()));
    tree.add(new DEPNode(3, "about"  , "about", "IN" , new DEPFeat()));
    tree.add(new DEPNode(4, "berries", "berry", "NNS", new DEPFeat()));

    tree.get(1).setHead(tree.get(0), DEPLibEn.DEP_ROOT);
    tree.get(2).setHead(tree.get(1), DEPLibEn.DEP_DOBJ);
    tree.get(3).setHead(tree.get(1), DEPLibEn.DEP_PREP);
    tree.get(4).setHead(tree.get(3), DEPLibEn.DEP_POBJ);
View Full Code Here

  void evalSubPOS(String inputFile) throws Exception
  {
    BufferedReader reader = UTInput.createBufferedFileReader(inputFile);
    Pattern delim = Pattern.compile("\t");
    int correct = 0, total = 0;
    DEPFeat p, g;
    String[] ls;
    String line;
   
    while ((line = reader.readLine()) != null)
    {
      line = line.trim();
     
      if (!line.isEmpty())
      {
        ls = delim.split(line);
        g = new DEPFeat(ls[6]);
        p = new DEPFeat(ls[7]);
       
        if (g.get("SubPOS").equals(p.get("SubPOS")))
          correct++;
           
        total++;
      }
    }
View Full Code Here

  }
 
  /** Called by {@link LGAsk#generateQuestionFromAsk(DEPTree, String)}. */
  private DEPNode getNode(DEPNode head, String form, String lemma, String pos, String deprel, String label)
  {
    DEPNode aux = new DEPNode(0, form, lemma, pos, new DEPFeat());
    aux.initXHeads();
    aux.initSHeads();
   
    aux.setHead(head, deprel);
    if (label != nullaux.addSHead(head, label);
View Full Code Here

TOP

Related Classes of com.clearnlp.dependency.DEPFeat

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.