Example usage for edu.stanford.nlp.parser.lexparser LexicalizedParser loadModel

List of usage examples for edu.stanford.nlp.parser.lexparser LexicalizedParser loadModel

Introduction

In this page you can find the example usage for edu.stanford.nlp.parser.lexparser LexicalizedParser loadModel.

Prototype

public static LexicalizedParser loadModel() 

Source Link

Document

Construct a new LexicalizedParser object from a previously serialized grammar read from a System property edu.stanford.nlp.SerializedLexicalizedParser , or a default classpath location ( edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ).

Usage

From source file:edu.cmu.cs.in.hoop.visualizers.HoopParseTreeViewer.java

License:Open Source License

/**
 * //from w  w  w  .  j  a v  a 2  s  . c  o  m
 */
public HoopParseTreeViewer() {
    //this.setLayout(new BoxLayout (this,BoxLayout.Y_AXIS));            

    Options theseOptions = new Options();
    theseOptions.setOptions(new String[] {});
    String theseExtraFlags[] = new String[] { "-maxLength", "256", "-retainTmpSubcategories" };

    //theLexicalizedParser = LexicalizedParser.loadModel(theLexicalizedParserName, theseOptions, theseExtraFlags);
    theLexicalizedParser = LexicalizedParser.loadModel();

    model = new DefaultListModel();

    sentenceList = new JList(model);
    sentenceList.setOpaque(true);
    sentenceList.setBackground(new Color(220, 220, 220));
    sentenceList.addMouseListener(this);

    JScrollPane scroller = new JScrollPane(sentenceList);
    scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

    Box controlBox = Box.createHorizontalBox();

    entry = new JTextArea();
    entry.setFont(new Font("Dialog", 1, 10));
    //entry.setBorder(blackborder);
    entry.setMinimumSize(new Dimension(100, 25));
    entry.setPreferredSize(new Dimension(200, 25));
    entry.setMaximumSize(new Dimension(200, 25));

    //entry.setText("The quick brown fox jumps over the lazy dog.");

    parseButton = new JButton();
    //parseButton.setIcon(HoopLink.imageIcons [8]);
    parseButton.setMargin(new Insets(1, 1, 1, 1));
    parseButton.setText("Parse");
    parseButton.setFont(new Font("Courier", 1, 8));
    parseButton.setPreferredSize(new Dimension(20, 16));
    parseButton.addActionListener(this);

    controlBox.add(entry);
    controlBox.add(parseButton);
    controlBox.add(Box.createHorizontalGlue());

    treePanel = new TreeJPanel();

    JPanel content = (JPanel) getContentPane();
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));

    //this.add(controlBox);
    //this.add(scroller);      
    //this.add (treePanel);

    content.add(controlBox);
    content.add(scroller);
    content.add(treePanel);
}