2013-03-10 51 views
0
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堆空間....錯誤generatin解析樹使用Apache OpenNLP

在運行這個項目Netbeans,我得到這個錯誤,我不知道該怎麼做。我確實告訴OpenNLP站點http://opennlp.apache.org/documentation/1.5.2-incubating/manual/opennlp.html#tools.parser

+1

嘗試'運行時選項。看看http://stackoverflow.com/questions/1493913/how-to-set-the-maximum-memory-usage-for-jvm和http://www.oracle.com/technetwork/java/javase/ memorymanagement-whitepaper-150215.pdf – 2013-03-10 17:18:48

+0

仍然同樣的錯誤連續... :((... ... – 2013-03-10 19:31:07

+0

@RavindraGullapalli thnx工作後,我在我的項目中添加netbeans運行變量.... – 2013-03-12 13:32:46

回答