Created
January 11, 2017 17:49
-
-
Save ugik/080b60b24162483d05f534590c6ec3a8 to your computer and use it in GitHub Desktop.
part 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# return the class with highest score for sentence | |
def classify(sentence): | |
high_class = None | |
high_score = 0 | |
# loop through our classes | |
for c in class_words.keys(): | |
# calculate score of sentence for each class | |
score = calculate_class_score_commonality(sentence, c, show_details=False) | |
# keep track of highest score | |
if score > high_score: | |
high_class = c | |
high_score = score | |
return high_class, high_score |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment