Package com.clearnlp.dependency

Examples of com.clearnlp.dependency.DEPTree


  void extractVerbPP(String[] args)
  {
    SRLReader reader = new SRLReader(0, 1, 2, 3, 4, 5, 6, 8);
    reader.open(UTInput.createBufferedFileReader(args[0]));
    Prob2DMap map = new Prob2DMap();
    DEPTree tree;
   
    while ((tree = reader.next()) != null)
      extractVerbPPAux(tree, map);
   
    PrintStream fout = UTOutput.createPrintBufferedFileStream(args[1]);
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())
      {
        tree.add(node);
        if (node.isDependentOf(root))
          node.setHead(tree.get(0), DEPLibEn.DEP_ROOT);
      }
     
      tree.resetIDs();
      fout.println(tree.toStringSRL()+"\n");
    }
   
    fout.close();
    reader.close()
  }
View Full Code Here

    Set<String> keys = new TreeSet<String>();
    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))
View Full Code Here

    fin.open(UTInput.createBufferedFileReader(args[0]));
    PrintStream fold = UTOutput.createPrintBufferedFileStream(args[0]+".o");
    PrintStream fnew = UTOutput.createPrintBufferedFileStream(args[0]+".n");
  //  ObjectInputStream oin = new ObjectInputStream(new BufferedInputStream(new FileInputStream(args[1])));
  //  PBFrameset p = (PBFrameset)oin.readObject();
    DEPTree tree;
   
    while ((tree = fin.next()) != null)
    {
      fold.println(tree.toStringSRL()+"\n");
      DEPLibEn.postLabel(tree);
      fnew.println(tree.toStringSRL()+"\n");
    }
  }
View Full Code Here

    AbstractC2DConverter converter = new KaistC2DConverter(new HeadRuleMap(UTInput.createBufferedFileReader(args[0])));
    String[] inputFiles = UTFile.getSortedFileList(args[1], "ptb");
    String outputFile;
    PrintStream fout;
    CTReader reader;
    DEPTree dTree;
    CTTree cTree;
   
    for (String inputFile : inputFiles)
    {
      outputFile = UTFile.replaceExtension(inputFile, "dep");
      reader = new CTReader(UTInput.createBufferedFileReader(inputFile));
      fout = UTOutput.createPrintBufferedFileStream(outputFile);
      System.out.println(outputFile);
     
      while ((cTree = reader.nextTree()) != null)
      {
        dTree = converter.toDEPTree(cTree);
        fout.println(dTree.toStringDEP()+"\n");
      }
     
      reader.close();
      fout.close();
    }
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())
        {
View Full Code Here

  }
 
  void projectivize(String inputFile, String outputFile)
  {
    DEPReader reader = new DEPReader(0, 1, 2, 4, 6, 8, 10);
    DEPTree tree;
   
    reader.open(UTInput.createBufferedFileReader(inputFile));
    PrintStream fold = UTOutput.createPrintBufferedFileStream(outputFile+".old");
    PrintStream fnew = UTOutput.createPrintBufferedFileStream(outputFile+".new");
    int i;
   
    for (i=0; (tree = reader.next()) != null; i++)
    {
      fold.println(tree.toStringCoNLL()+"\n");
      tree.projectivize();
      fnew.println(tree.toStringCoNLL()+"\n");
     
      if (i%1000 == 0System.out.print(".");
    System.out.println();
   
    reader.close();
View Full Code Here

    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;
       
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

    List<String> outputs = (flag == FLAG_GENERATE) ? new ArrayList<String>() : null;
    if (message != null) LOG.info(message+"\n");
    int i, total = 0, size = filenames.length;
    StringBuilder build = null;
    PrintStream out = null;
    DEPTree tree;
    String s;
   
    for (i=0; i<size; i++)
    {
      reader.open(UTInput.createBufferedFileReader(filenames[i]));
View Full Code Here

TOP

Related Classes of com.clearnlp.dependency.DEPTree

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.