@Test public void testSpache_score() { logger.info("spache_score"); String strText = TEST_STRING; double expResult = 41.523999999999994; double result = ReadabilityStatistics.spacheScore(strText); assertEquals(expResult, result, Constants.DOUBLE_ACCURACY_HIGH); }
public static double spacheScore(String strText) { strText = cleanText(strText); int intUniqueUnfamiliarWordCount = 0; Set<String> arrWords = new HashSet<>((new WhitespaceTokenizer()).tokenize(strText)); for(String word : arrWords) { if (!SPACHE_WORDLIST.contains(word)) { ++intUniqueUnfamiliarWordCount; } } int intSentenceCount=sentenceCount(strText); int intWordCount = wordCount(strText); return 0.121*intWordCount/(double)intSentenceCount+0.082*intUniqueUnfamiliarWordCount+0.659; }
ReadabilityStatistics { public static double spacheScore(String strText) { strText = cleanText(strText); int intUniqueUnfamiliarWordCount = 0; Set<String> arrWords = new HashSet<>((new WhitespaceTokenizer()).tokenize(strText)); for(String word : arrWords) { if (!SPACHE_WORDLIST.contains(word)) { ++intUniqueUnfamiliarWordCount; } } int intSentenceCount=sentenceCount(strText); int intWordCount = wordCount(strText); return 0.121*intWordCount/(double)intSentenceCount+0.082*intUniqueUnfamiliarWordCount+0.659; } }
ReadabilityStatistics { public static double spacheScore(String strText) { strText = cleanText(strText); int intUniqueUnfamiliarWordCount = 0; Set<String> arrWords = new HashSet<>((new WhitespaceTokenizer()).tokenize(strText)); for(String word : arrWords) { if (!SPACHE_WORDLIST.contains(word)) { ++intUniqueUnfamiliarWordCount; } } int intSentenceCount=sentenceCount(strText); int intWordCount = wordCount(strText); return 0.121*intWordCount/(double)intSentenceCount+0.082*intUniqueUnfamiliarWordCount+0.659; }  }
ReadabilityStatistics { public static double spacheScore(String strText) { strText = cleanText(strText); int intUniqueUnfamiliarWordCount = 0; Set<String> arrWords = new HashSet<>((new WhitespaceTokenizer()).tokenize(strText)); for(String word : arrWords) { if (!SPACHE_WORDLIST.contains(word)) { ++intUniqueUnfamiliarWordCount; } } int intSentenceCount=sentenceCount(strText); int intWordCount = wordCount(strText); return 0.121*intWordCount/(double)intSentenceCount+0.082*intUniqueUnfamiliarWordCount+0.659; }  static double fleschKincaidReadingEase(String strText); static double fleschKincaidGradeLevel(String strText); static double gunningFogScore(String strText); static double colemanLiauIndex(String strText); static double smogIndex(String strText); static double automatedReadabilityIndex(String strText); static double daleChallScore(String strText); static double daleChallGrade(String strText); static double spacheScore(String strText); }
ReadabilityStatistics { public static double spacheScore(String strText) { strText = cleanText(strText); int intUniqueUnfamiliarWordCount = 0; Set<String> arrWords = new HashSet<>((new WhitespaceTokenizer()).tokenize(strText)); for(String word : arrWords) { if (!SPACHE_WORDLIST.contains(word)) { ++intUniqueUnfamiliarWordCount; } } int intSentenceCount=sentenceCount(strText); int intWordCount = wordCount(strText); return 0.121*intWordCount/(double)intSentenceCount+0.082*intUniqueUnfamiliarWordCount+0.659; }  static double fleschKincaidReadingEase(String strText); static double fleschKincaidGradeLevel(String strText); static double gunningFogScore(String strText); static double colemanLiauIndex(String strText); static double smogIndex(String strText); static double automatedReadabilityIndex(String strText); static double daleChallScore(String strText); static double daleChallGrade(String strText); static double spacheScore(String strText);  }