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

edu.berkeley.nlp.io.PTBLineLexer 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.io;

import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

/**
 * Similar to PTBLexer. However, instead of reading from a Reader this class is given a line
 * and returns a list of tokenized Strings.
 * @author petrov
 *
 */
public class PTBLineLexer extends PTBLexer {
	
	public PTBLineLexer(){
		super((java.io.Reader)null);
	}
	
	public List tokenizeLine(String line) throws IOException{
		LinkedList tokenized = new LinkedList();
		if (line==null) return tokenized;
		int nEl = line.length();
		char[] array = line.toCharArray();
		zzBuffer = line.toCharArray();//new char[nEl+1];
		//for(int i=0;i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy