2017-10-18 2 views
1

OpenNLP 버전 1.8에서 분류기를 작성하려고하지만 아래 코드를 사용하면 계속 NullPointerException으로 표시됩니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?OpenNLP 분류기 버전 1.8

public class test 
{ 

     public static void main(String[] args) throws IOException 
     { 
      InputStream is = new FileInputStream("D:/training.txt"); 
      DoccatModel m = new DoccatModel(is); 
      Tokenizer tokenizer = WhitespaceTokenizer.INSTANCE; 
      String tweet = "testing sentence"; 
      String[] tokens = tokenizer.tokenize(tweet); 
      DocumentCategorizerME myCategorizer = new DocumentCategorizerME(m); 
      double[] outcomes = myCategorizer.categorize(tokens); 
      String category = myCategorizer.getBestCategory(outcomes); 

     } 
} 

답변