Examples of DEPReader


Examples of com.clearnlp.reader.DEPReader

    System.out.printf("%5.2f (%d/%d)\n", 100d*correct/total, correct, total);
  }
 
  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();
    fold.close();
    fnew.close();
  }
View Full Code Here

Examples of com.clearnlp.reader.DEPReader

public class DEPErrors
{
  public DEPErrors(String mergeFile)
  {
    DEPReader gReader = new DEPReader(0, 1, 2, 4, 6, 7, 9);
    DEPReader sReader = new DEPReader(0, 1, 3, 5, 6, 8, 10);
    DEPTree gTree, sTree;
   
    gReader.open(UTInput.createBufferedFileReader(mergeFile));
    sReader.open(UTInput.createBufferedFileReader(mergeFile));
   
    String[] errors = {
        "sHead is a dependent       of gHead",
        "sHead is a grand-dependent of gHead",
        "gHead is a sibling         of sHead",
        "sHead is a descendent      of gHead",
        "gHead is a sibling         of cHead",
        "gHead is a dependent       of cNode",
        "gHead is a grand-dependent of sHead"
    };
   
    int[] counts = new int[errors.length+1];   
   
    while ((gTree = gReader.next()) != null)
    {
      sTree = sReader.next();
      gTree.setDependents();
      sTree.setDependents();
      checkErrors(gTree, sTree, counts);
    }
   
View Full Code Here

Examples of com.clearnlp.reader.DEPReader

  }
 
  public void assign(String depFile, String tpcFile, String outFile, int threshold) throws IOException
  {
    List<List<String[]>> topics = getTopics(tpcFile, threshold);
    DEPReader reader = new DEPReader(0, 1, 2, 3, 4, 5, 6);
    reader.open(UTInput.createBufferedFileReader(depFile));
    PrintStream fout = UTOutput.createPrintBufferedFileStream(outFile);
    IntOpenHashSet[] sets;
    StringBuilder build;
    IntOpenHashSet set;
    int[] indices;
    DEPTree tree;
    int i, size;
   
    while ((tree = reader.next()) != null)
    {
      sets  = assignTopics(topics, tree);
      size  = sets.length;
      build = new StringBuilder();
     
View Full Code Here

Examples of com.clearnlp.reader.DEPReader

public class DEPSplit
{
  static public void main(String[] args)
  {
    DEPReader reader = new DEPReader(0, 1, 3, 5, 6, 9, 10);
    String[] filelist = UTFile.getSortedFileList(args[0]);
    PrintStream[] fout = new PrintStream[10];
    DEPTree tree;
    int i;
   
    for (i=0; i<fout.length; i++)
      fout[i] = UTOutput.createPrintBufferedFileStream(args[1]+File.separator+i+".dep");
   
    for (String filename : filelist)
    {
      reader.open(UTInput.createBufferedFileReader(filename));
     
      while ((tree = reader.next()) != null)
      {
        i = (tree.size() > 101) ? 9 : (tree.size()-2) / 10;
        fout[i].println(tree.toStringCoNLL()+"\n");
     
     
      reader.close();
    }
   
    for (i=0; i<fout.length; i++)
      fout[i].close();
  }
View Full Code Here

Examples of com.clearnlp.reader.DEPReader

    {
      System.err.printf("The '%s' field must be specified in the configuration file.\n", AbstractColumnReader.FIELD_FEATS);
      System.exit(1);
    }
   
    return new DEPReader(iId, iForm, iLemma, iPos, iFeats, iHeadId, iDeprel);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.