Package com.clearnlp.dependency

Examples of com.clearnlp.dependency.DEPNode


  }
 
  void extractVerbPPAux(DEPTree tree, Prob2DMap map)
  {
    int i, size = tree.size();
    DEPNode verb;
    SRLArc arc;
   
    tree.setDependents();
   
    for (i=1; i<size; i++)
    {
      verb = tree.get(i);
     
      if (MPLibEn.isVerb(verb.pos))
      {
        for (DEPNode arg : verb.getDependentNodeList())
        {
          if (!arg.isLabel(DEPLibEn.DEP_AGENT) && (arc = arg.getSHead(verb)) != null)
          {
            if (arg.isPos(CTLibEn.POS_IN) && PBLib.isCoreNumberedArgument(arc.getLabel()))
              map.add(verb.lemma, arg.lemma);
View Full Code Here


  {
    SRLReader reader = new SRLReader(0, 1, 2, 3, 4, 5, 6, 7);
    reader.open(UTInput.createBufferedFileReader(args[0]));
    PrintStream fout = UTOutput.createPrintBufferedFileStream(args[1]);
    Pattern p = UTRegex.getORPatternExact(DEPLibEn.DEP_COMPLM, DEPLibEn.DEP_MARK);
    DEPNode root, head;
    DEPTree tree;
   
    while ((tree = reader.next()) != null)
    {
      tree.setDependents();
      root = tree.getFirstRoot();
      head = root.getDependents().get(0).getNode();
     
      tree = new DEPTree();
      head.removeDependentsByLabels(p);
     
      for (DEPNode node : head.getSubNodeSortedList())
View Full Code Here

    Prob2DMap mVBD = new Prob2DMap();
    Prob2DMap mVBN = new Prob2DMap();
    String form, base, past, part;
    int i, size, cutoff = 1;
    DEPTree tree;
    DEPNode node;
   
    while ((tree = fin.next()) != null)
    {
      size = tree.size();
     
      for (i=1; i<size; i++)
      {
        node = tree.get(i);
        base = node.lemma;
        form = node.form.toLowerCase();
        past = LGVerbEn.getPastRegularForm(base);
       
        if (node.isPos(CTLibEn.POS_VBD))
        {
          if (!form.equals(past))
            mVBD.add(base, form);
        }
        else if (node.isPos(CTLibEn.POS_VBN))
        {
          if (!form.equals(past))
            mVBN.add(base, form);
        }
      }
View Full Code Here

  }
 
  void checkPosDeprel(DEPTree tree, Prob2DMap mc, Prob2DMap mh)
  {
    int i, size = tree.size();
    DEPNode node, head;
    String deprel;
   
    for (i=1; i<size; i++)
    {
      node = tree.get(i);
      head = node.getHead();
      deprel = node.getLabel();

      mc.add(deprel, MPLibEn.toCPOSTag(node.pos));
      mh.add(deprel, MPLibEn.toCPOSTag(head.pos));
    }
  }
View Full Code Here

  }
 
  void classifySentenceType(DEPTree tree, IntIntPair count)
  {
    int i, size = tree.size();
    DEPNode node;
    String  feat;
   
    tree.setDependents();
   
    for (i=1; i<size; i++)
    {
      node = tree.get(i);
      feat = node.getFeat(DEPLib.FEAT_SNT);
     
      if (node.pos.startsWith("VB"))
      {
        if (isImperative(node))
        {
          count.i1++;
         
          if (feat == null || !feat.equals("IMP"))
          {
            if (node.isLemma("be"))
              System.out.println(node.id+" "+tree.toStringDEP()+"\n");
            count.i2++;
          }
        }
      }
View Full Code Here

    if (verb.isLabel(DEPLibEn.DEP_AUX) || verb.isLabel(DEPLibEn.DEP_AUXPASS) || verb.isLabel(DEPLibEn.DEP_XCOMP) || verb.isLabel(DEPLibEn.DEP_PARTMOD) || verb.isLabel(DEPLibEn.DEP_RCMOD) || verb.isLabel(DEPLibEn.DEP_CONJ) || verb.isLabel(DEPLibEn.DEP_HMOD))
      return false;

    List<DEPArc> deps = verb.getDependents();
    int i, size = deps.size();
    DEPNode node;
    DEPArc  dep;
   
    for (i=0; i<size; i++)
    {
      dep  = deps.get(i);
      node = dep.getNode();
     
      if (node.id < verb.id)
      {
        if (dep.isLabel(DEPLibEn.DEP_COMPLM) || dep.isLabel(DEPLibEn.DEP_MARK))
          return false;
       
        if (dep.isLabel(P_AUX) && !node.isLemma("do"))
          return false;
       
        if (node.isPos(CTLibEn.POS_TO) || node.isPos(CTLibEn.POS_MD) || node.pos.startsWith("W"))
          return false
      }
     
      if (dep.isLabel(P_SBJ) || dep.isLabel(DEPLibEn.DEP_EXPL))
        return false;
View Full Code Here

    List<DEPArc> deps = verb.getDependents();
    int i, size = deps.size();
    boolean hasAux = false;
    DEPArc  curr, prev;
    String  label;
    DEPNode node;
   
    for (i=size-1; i>=0; i--)
    {
      curr  = deps.get(i);
      node  = curr.getNode();
View Full Code Here

  //  DEPReader reader = new DEPReader(0, 1, 2, 3, 5, 6, 7);
    DEPReader reader = new DEPReader(0, 1, 2, 4, 6, 8, 10);
    reader.open(UTInput.createBufferedFileReader(inputFile));
    int i, size, left = 0, right = 0, l, r, prevId, depId;
    DEPTree tree;
    DEPNode node;
   
    while ((tree = reader.next()) != null)
    {
      tree.setDependents();
      size = tree.size();
     
      for (i=1; i<size; i++)
      {
        node = tree.get(i);
        prevId = -1;
        l = r = 0;
       
        for (DEPArc arc : node.getDependents())
        {
          depId = arc.getNode().id;
         
          if (depId - prevId == 1)
          {
View Full Code Here

    SRLReader reader = new SRLReader(0, 1, 2, 3, 4, 5, 6, 8);
    reader.open(UTInput.createBufferedFileReader(inputFile));
    PrintStream fout = UTOutput.createPrintBufferedFileStream(outputFile);
    Prob2DMap map = new Prob2DMap();
    DEPNode node, head;
    String deprel, label, ftags;
    DEPTree tree;
    int i, size;
   
    while ((tree = reader.next()) != null)
    {
      size = tree.size();
     
      for (i=1; i<size; i++)
      {
        node   = tree.get(i);
        head   = node.getHead();
        deprel = node.getLabel();
        if ((ftags = node.getFeat(DEPLib.FEAT_SEM)) != null)
          deprel = ftags;
       
        for (DEPArc arc : node.getSHeads())
        {
          label = arc.getLabel();
        //  if (label.startsWith("R-AM"))
        //    label = label.substring(2);
         
View Full Code Here

  public void countSemanticDependents(String[] args)
  {
    SRLReader reader = new SRLReader(0, 1, 2, 3, 4, 5, 6, 8);
    reader.open(UTInput.createBufferedFileReader(args[0]));
    DEPTree tree;
    DEPNode node, dHead, sHead;
    int i;
   
    while ((tree = reader.next()) != null)
    {
      tree.setDependents();
     
      for (i=1; i<tree.size(); i++)
      {
        node  = tree.get(i);
        dHead = node.getHead();
       
        for (DEPArc sArc : node.getSHeads())
        {
          sHead = sArc.getNode();
        //  sHead = sArc.getNode().getHead();
         
          if (sHead != dHead && sHead != dHead.getHead() && node.isDescendentOf(sHead))
          {
            System.out.println(node.id+" "+sArc.getNode().id+" "+tree.toStringSRL());
            try {System.in.read();} catch (IOException e) {e.printStackTrace();}
          }
        }
View Full Code Here

TOP

Related Classes of com.clearnlp.dependency.DEPNode

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.