gov.llnl.ontology.text.parse
Class StanfordParser

java.lang.Object
  extended by gov.llnl.ontology.text.parse.StanfordParser
All Implemented Interfaces:
Parser

public class StanfordParser
extends Object
implements Parser

A Parser wrapper around the Stanford Parser.

Author:
Keith Stevens

Field Summary
static String PARSER_MODEL
          The default location of the stanford parser information.
 
Constructor Summary
StanfordParser()
          Creates a new StanfordParser using the default model location.
StanfordParser(String parserModel, boolean loadFromJar)
          Creates a new StanfordParser using the provided model location.
 
Method Summary
 String parseText(String header, String document)
          Returns a dependency parse tree formatted in the default CoNLL format.
 String parseText(String header, StringPair[] sentence)
          Returns a dependency parse tree formatted in the default CoNLL format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARSER_MODEL

public static final String PARSER_MODEL
The default location of the stanford parser information.

See Also:
Constant Field Values
Constructor Detail

StanfordParser

public StanfordParser()
Creates a new StanfordParser using the default model location.


StanfordParser

public StanfordParser(String parserModel,
                      boolean loadFromJar)
Creates a new StanfordParser using the provided model location. If loadFromJar is true, then the path is assumed to refer to a file within the currently running jar. This Parser can readily by used within a map reduce job by setting loadFromJar to true and including the parser model within the map reduce jar.

Method Detail

parseText

public String parseText(String header,
                        String document)
Returns a dependency parse tree formatted in the default CoNLL format. The returned string may represent multiple parse tress, espeically if the given document contains multiple sentences. Each parse tree will be padded with new lines. If header is not null, then it will be first line of each parse tree, otherwise only padded parse trees will be returned.

Specified by:
parseText in interface Parser
Parameters:
header - The header text that should label each parsed tree
document - The raw text to be parsed

parseText

public String parseText(String header,
                        StringPair[] sentence)
Returns a dependency parse tree formatted in the default CoNLL format. The returned string will contain only one parse tree If header is not null, then it will be first line of the parse tree, otherwise only the parse tree will be returned.

Specified by:
parseText in interface Parser
Parameters:
header - The header text that should label each parsed tree
sentence - The part of speech tagged words in a sentence.


Copyright © 2010-2011. All Rights Reserved.