public double get_direct_relevance(String text, String query, HashSet<String> query_content_words)
{
String[] query_category_words = get_category_words_of(query);
String[] text_words = text.Split();
double score = 0.0;
foreach(String word in text_words)
{
double category_score = 0.0, content_score = 0.0;
foreach (String category_word in query_category_words) { category_score += get_word_similarity(word, category_word); }
foreach (String content_word in query_content_words) { content_score += get_word_similarity(word, content_word); }
score += category_score / Math.Pow(query_category_words.Count(), 0.5) + // 0.5 because length doesn't really matter
content_score / Math.Pow(query_content_words.Count(), 1.0); // 1.0 as standard scaling power
}
return score / Math.Pow(text_words.Count(), 1.5); // 1.5 to penalize long sentences
}
}