Examples of bestCategory()


Examples of com.aliasi.classify.ConditionalClassification.bestCategory()

        }
    }

    public String classify(String text) {
        ConditionalClassification classification = clazz.classify(text);
        return classification.bestCategory();
    }
}
View Full Code Here

Examples of com.aliasi.classify.JointClassification.bestCategory()

    for (int j = 0; j < testingFiles.length; ++j)
         {
      String text = Files.readFromFile( new File(classDir, testingFiles[j]) );
      logger.debug("Testing on " + CATEGORIES[i] + File.separator + testingFiles[j]);
      JointClassification jc =  compiledClassifier.classifyJoint(text);
          confMatrix.increment(CATEGORIES[i], jc.bestCategory());
          logger.debug("Best Category: " + jc.bestCategory() );
          StringBuffer sb = new StringBuffer();
          sb.append("Scores ");
          for (int k = 0; k < CATEGORIES.length; k++) sb.append(nf.format(jc.score(k)) + " ");
          logger.debug(sb);
View Full Code Here

Examples of com.aliasi.classify.JointClassification.bestCategory()

         {
      String text = Files.readFromFile( new File(classDir, testingFiles[j]) );
      logger.debug("Testing on " + CATEGORIES[i] + File.separator + testingFiles[j]);
      JointClassification jc =  compiledClassifier.classifyJoint(text);
          confMatrix.increment(CATEGORIES[i], jc.bestCategory());
          logger.debug("Best Category: " + jc.bestCategory() );
          StringBuffer sb = new StringBuffer();
          sb.append("Scores ");
          for (int k = 0; k < CATEGORIES.length; k++) sb.append(nf.format(jc.score(k)) + " ");
          logger.debug(sb);
     } //*-- end of inner for
View Full Code Here

Examples of com.aliasi.classify.JointClassification.bestCategory()

    for (int j=0; j < testingFiles.length; ++j)
         {
      String text = Files.readFromFile( new File(classDir, testingFiles[j]) );
      logger.debug("Testing on " + CATEGORIES[i] + File.separator + testingFiles[j]);
      JointClassification jc =  compiledClassifier.classifyJoint(text);
          confMatrix.increment(CATEGORIES[i], jc.bestCategory());
          logger.debug("Best Category: " + jc.bestCategory() );
          StringBuffer sb = new StringBuffer();
          sb.append("Scores ");
          for (int k = 0; k < CATEGORIES.length; k++) sb.append(nf.format(jc.score(k)) + " ");
          logger.debug(sb);
View Full Code Here

Examples of com.aliasi.classify.JointClassification.bestCategory()

         {
      String text = Files.readFromFile( new File(classDir, testingFiles[j]) );
      logger.debug("Testing on " + CATEGORIES[i] + File.separator + testingFiles[j]);
      JointClassification jc =  compiledClassifier.classifyJoint(text);
          confMatrix.increment(CATEGORIES[i], jc.bestCategory());
          logger.debug("Best Category: " + jc.bestCategory() );
          StringBuffer sb = new StringBuffer();
          sb.append("Scores ");
          for (int k = 0; k < CATEGORIES.length; k++) sb.append(nf.format(jc.score(k)) + " ");
          logger.debug(sb);
     } //*-- end of inner for
View Full Code Here

Examples of com.aliasi.classify.JointClassification.bestCategory()

        if (text.length() > 500text = text.substring(0, 500);
      logger.debug("Testing on " + CATEGORIES[i] + File.separator + testingFiles[j]);
      JointClassification jc =  compiledClassifier.classifyJoint(text);
     
      //*-- check if we have sufficient confidence in the decision
      String bestCategory = (jc.score(0) > -2.5) ? jc.bestCategory(): "text";
      confMatrix.increment(CATEGORIES[i], bestCategory)
          logger.debug("Best Category: " + bestCategory );
          StringBuffer sb = new StringBuffer();
          sb.append("Scores ");
          for (int k = 0; k < CATEGORIES.length; k++)
View Full Code Here

Examples of com.aliasi.classify.JointClassification.bestCategory()

   //*-- return book if the length of the document seems large
   if (length > Constants.DB_DOC_STORE_LIMIT) return "book";
  
   //*-- assign a default file type of text when insufficient evidence
   JointClassification jc =  fileTypeClassifier.classifyJoint(contents);
   return ( (jc.score(0) > -2.5) ? jc.bestCategory(): "text");
  }

  /**
   * Classify the passed text string into one of the pre-defined categories - rec, business, news, etc.
   * @param idoc IndexableDoc The document whose contents are to be classified
View Full Code Here

Examples of com.aliasi.classify.JointClassification.bestCategory()

   */
  public String classifyTextContents(IndexableDoc idoc)
  {
   //*-- assign a default text type of "" when insufficient evidence
   JointClassification jc =  textTypeClassifier.classifyJoint(idoc.getContents().toString());
   return ( (jc.score(0) > -2.5) ? jc.bestCategory(): "miscellaneous");
  }
 
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.