def classify_with_expert_knowledge(paths): sentences, labels, class_names = load_test_data(paths) features, vocabulary, unused = extract_features_and_vocabulary(sentences) stemmed_target_features = [stem_words(target_feature) for target_feature in TARGET_FEATURES] predicted = classify(stemmed_target_features, features.toarray(), vocabulary) print('EXPERT KNOWLEDGE:') evaluate_classification(predicted, labels, sentences, class_names)
def test_stem_words(words, stemmed_words): assert stem_words(words) == stemmed_words