Class HumanLanguageDetector

java.lang.Object
org.sonarsource.analyzer.commons.HumanLanguageDetector

public class HumanLanguageDetector extends Object
  • Method Details

    • humanLanguageScore

      public static double humanLanguageScore(String text)
      Calculates human language score. Before calling a method it is recommended to call StringUtils.stripAccents(text) to improve precision.
      Parameters:
      text - to analyze
      Returns:
      1.0 in average for random string, and above if it looks like language (ex: could be compared using > 1.5d)