title: OpenNLP-Document Categorise not getting expected result
body: <p>I'm trying to train model to identify conversion, Here I loaded categorize data from the database and create model,</p>
  <pre><code>List&lt;CategoryData&gt; categoryDataList = categoryRepository.findAll();
      List&lt;DocumentSample&gt; documentSamples = new ArrayList&lt;&gt;();
      categoryDataList.stream().forEach(categoryData -&gt; {
          List&lt;String&gt; dataListStr = new ArrayList&lt;&gt;();
          categoryData.getQuestions().forEach(question -&gt; dataListStr.add(question.getQuestion()));
  
          documentSamples.add(new DocumentSample(categoryData.getCategoryName(), dataListStr.stream().toArray(String[]::new)));
  
      });
      ObjectStream&lt;DocumentSample&gt; sampleObjectStream = ObjectStreamUtils.createObjectStream(documentSamples);
      TrainingParameters params = new TrainingParameters();
      params.put(TrainingParameters.ITERATIONS_PARAM, 15);
      params.put(TrainingParameters.CUTOFF_PARAM, 1);
  
      TrainingParameters mlParams = new TrainingParameters();
      mlParams.put(TrainingParameters.ITERATIONS_PARAM, Integer.toString(150));
      mlParams.put(TrainingParameters.CUTOFF_PARAM, Integer.toString(0));
  
      DoccatModel model = DocumentCategorizerME.train(&quot;en&quot;, sampleObjectStream,
              mlParams, new DoccatFactory());
      return model;
  </code></pre>
  <p>After getting my model, I'm trying to pass text to identify which category is best matches for text I passed,</p>
  <pre><code>String paragraph = &quot;Hi there&quot;;
      DocumentCategorizerME categorizerME = new DocumentCategorizerME(dataModel);
      for (int i = 0; i &lt; categorizerME.getNumberOfCategories(); i++) {
          log.info(&quot;Trained Categories : {}&quot;, categorizerME.getCategory(i));
      }
      //double[] categorize = categorizerME.categorize(tokenize(paragraph));
      double[] categorize = categorizerME.categorize(new String[]{paragraph});
      String bestCategory = categorizerME.getBestCategory(categorize);
      //Arrays.sort(categorize);
  
      log.info(&quot;All categories , {} &quot;, categorizerME.getAllResults(categorize));
  
      //SortedMap&lt;Double, Set&lt;String&gt;&gt; doubleSetSortedMap = categorizerME.sortedScoreMap(tokenize(paragraph));
  
      //doubleSetSortedMap.forEach((aDouble, strings) -&gt; log.info(&quot;Value is : {} &amp; Categories : {}&quot;, aDouble, strings));
  
      // log.info(&quot;All categories : {}&quot;,categorize);
      log.info(&quot;Best Category : {}&quot;, bestCategory);
      return bestCategory;
  </code></pre>
  <p>If I pass extract sentence matching for trained data, it's getting the right answer, otherwise, getting the wrong answer; in here, &quot;Hi there&quot; getting result &quot;entry-requirements&quot; that's wrong.</p>
  <pre><code>    requirements
  
          Computing event counts...  done. 3 events
      Indexing...  done.
  Sorting and merging events... done. Reduced 3 events to 3.
  Done indexing in 0.01 s.
  Incorporating indexed data for training...  
  done.
      Number of Event Tokens: 3
          Number of Outcomes: 3
        Number of Predicates: 13
  ...done.
  Computing model parameters ...
  Performing 150 iterations.
  
  
  
  
  
   2022-05-15 20:37:41.884  INFO 7508 --- [  restartedMain] l.e.chatbot.service.OpenNLPServiceImpl   : Trained Categories : entry-requirements
  2022-05-15 20:37:41.885  INFO 7508 --- [  restartedMain] l.e.chatbot.service.OpenNLPServiceImpl   : Trained Categories : course-details
  2022-05-15 20:37:41.885  INFO 7508 --- [  restartedMain] l.e.chatbot.service.OpenNLPServiceImpl   : Trained Categories : start
  2022-05-15 20:37:41.886  INFO 7508 --- [  restartedMain] l.e.chatbot.service.OpenNLPServiceImpl   : All categories , entry-requirements[0.3333]  course-details[0.3333]  start[0.3333] 
  2022-05-15 20:37:41.886  INFO 7508 --- [  restartedMain] l.e.chatbot.service.OpenNLPServiceImpl   : Best Category : entry-
  </code></pre>
  <p>Data:
  <a href="https://i.stack.imgur.com/pGW1I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pGW1I.png" alt="enter image description here" /></a></p>
  <p>please help me to resolve this problem I'm new to this.</p>