Package com.aliasi.classify

Examples of com.aliasi.classify.JointClassification


        //*-- designated category
    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);
     } //*-- end of inner for
    } //*-- end of outer for
     
      logger.info("--------------------------------------------");
View Full Code Here


        //*-- designated category
    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);
     } //*-- end of inner for
    } //*-- end of outer for
     
      logger.info("--------------------------------------------");
View Full Code Here

      String text = Files.readFromFile( new File(classDir, testingFiles[j]) );
     
      //*-- limit the length of the text
        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++)
            sb.append(nf.format(jc.score(k)) + " ");
          logger.debug(sb);
     } //*-- end of inner for
    } //*-- end of outer for
     
      logger.info("--------------------------------------------");
View Full Code Here

  
   //*-- 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");
  }
View Full Code Here

   * @return String The closest category for the passed string
   */
  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

Related Classes of com.aliasi.classify.JointClassification

Copyright © 2018 www.massapicom. 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.