Package com.clearnlp.reader

Examples of com.clearnlp.reader.SRLReader


    System.out.println(sTree.getRichKeyEn(ignore, "."));
  }
 
  <T>void traverseSRLTrees(String[] args, Function<DEPTree,T> func)
  {
    SRLReader reader = new SRLReader(0, 1, 2, 3, 4, 5, 6, 8);
    reader.open(UTInput.createBufferedFileReader(args[0]));
  }
View Full Code Here


        }              
    };
 
  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]);
    List<String> verbs = Lists.newArrayList(map.keySet());
    Collections.sort(verbs);
View Full Code Here

    System.out.printf("%5.2f (%d/%d)\n", (double)invalid/total, invalid, total);
  }
 
  void toQuestion(String[] args)
  {
    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

    fout.close();
  }
 
  void testParseLabel(String[] args) throws Exception
  {
    SRLReader fin = new SRLReader(0, 1, 2, 3, 4, 5, 6, 8);
    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

 
  void mapPropBankToDependency(String inputFile, String outputFile)
  {
    final String NONE = "NONE";

    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++)
      {
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++)
      {
View Full Code Here

    System.out.println(sTree.getRichKeyEn(ignore, "."));
  }
 
  <T>void traverseSRLTrees(String[] args, Function<DEPTree,T> func)
  {
    SRLReader reader = new SRLReader(0, 1, 2, 3, 4, 5, 6, 8);
    reader.open(UTInput.createBufferedFileReader(args[0]));
  }
View Full Code Here

        }              
    };
 
  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]);
    List<String> verbs = Lists.newArrayList(map.keySet());
    Collections.sort(verbs);
View Full Code Here

    System.out.printf("%5.2f (%d/%d)\n", (double)invalid/total, invalid, total);
  }
 
  void toQuestion(String[] args)
  {
    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

    fout.close();
  }
 
  void testParseLabel(String[] args) throws Exception
  {
    SRLReader fin = new SRLReader(0, 1, 2, 3, 4, 5, 6, 8);
    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

TOP

Related Classes of com.clearnlp.reader.SRLReader

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.