All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.berkeley.nlp.PCFGLA.TreeListMerger Maven / Gradle / Ivy

Go to download

The Berkeley parser analyzes the grammatical structure of natural language using probabilistic context-free grammars (PCFGs).

The newest version!
///**
// * 
// */
//package edu.berkeley.nlp.PCFGLA;
//
//import java.io.FileInputStream;
//import java.io.FileOutputStream;
//import java.io.InputStreamReader;
//import java.io.OutputStreamWriter;
//import java.io.PrintWriter;
//import java.util.LinkedList;
//
//import edu.berkeley.nlp.PCFGLA.TreeReranker.Options;
//import edu.berkeley.nlp.syntax.Tree;
//import edu.berkeley.nlp.syntax.Trees.PennTreeReader;
//
///**
// * @author petrov
// *
// */
//public class TreeListMerger {
//	@Option(name = "-inputFile", usage = "Input File for Parse Trees.")
//	public String inputFile;
//
//	@Option(name = "-outputFile", usage = "Output File for Merged List")
//	public String outputFile;
//	
//	@Option(name = "-nGrammars", usage = "Number of grammars")
//	public int nGrammars;
//
//	public static void main(String[] args) {
//		OptionParser optParser = new OptionParser(Options.class);
//		Options opts = (Options) optParser.parse(args, true);
//		// provide feedback on command-line arguments
//		System.err.println("Calling with " + optParser.getPassedInOptions());
//
//    try {
//    	PennTreeReader[] treeReaders = new PennTreeReader[opts.nGrammars];
//    	PrintWriter outputData = (opts.outputFile==null) ? new PrintWriter(new OutputStreamWriter(System.out)) : new PrintWriter(new OutputStreamWriter(new FileOutputStream(opts.outputFile), "UTF-8"), true);
//    	
//  		for (int i=0; i tree = null;
//    	while(treeReaders[opts.nGrammars-1].hasNext()){
//    		LinkedList> uniqueList;
//    		for (int i=0; i parse failure
//	    			outputData.write("()\n");
//	    			continue;
//	    		}
//    		}
//      }
//    } catch (Exception ex) {
//      ex.printStackTrace();
//    }
//    System.exit(0);
//	}
//}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy