使用Apache OpenNLP生成解析树的错误

时间:2013-03-10 16:27:01

标签: java apache opennlp

public static void main(String[] args)
{
String parsed_sentence = null;
        try {

            parsed_data = new FileInputStream("src/DATA/en-parser-chunking.zip");
            System.out.println("fetched from the file");
            ParserModel model = new ParserModel(parsed_data);
            System.out.println("model created");
            Parser parser = ParserFactory.create(model);
            System.out.println("parseer created");
            String t = "The quick brown fox jumps over the lazy dog .";
            opennlp.tools.parser.Parse topParses[] = ParserTool.parseLine(t, parser, 1);
            System.out.println("parsed ");
            System.out.println(topParses[0]);
        }
        catch (Exception ex)
        {
          System.out.println("Error");
        }

    }  
}
}

输出:     从文件中获取     线程“main”中的异常java.lang.OutOfMemoryError:Java堆空间....

在Netbeans中运行此项目时,我收到此错误,我不知道该怎么做。我确实在OpenNLP网站http://opennlp.apache.org/documentation/1.5.2-incubating/manual/opennlp.html#tools.parser上说过。

1 个答案:

答案 0 :(得分:1)

Java heap space in netbeans.. but I've increased the heap size already!)......这解决了我的问题......我需要在项目的VMX变量中添加....