Naive Approach in Python Modul

This commit is contained in:
Maren 2018-06-26 14:59:24 +02:00
parent c893380a23
commit 1b1ba52201

View File

@ -17,7 +17,7 @@ import pprint
# # Naive Approach
table = pd.read_csv('../Tools/emoji_descriptions.csv')
#######################
# Helper functions
@ -79,7 +79,6 @@ def evaluate_sentence(sentence, table, description_key = 'description', lang = '
# emojis_to_consider can be either a list or "all"
def prepareData(stemming=False, emojis_to_consider="all"):
table = pd.read_csv('../Tools/emoji_descriptions.csv')
table.head()
if(stemming):
@ -95,10 +94,10 @@ def prepareData(stemming=False, emojis_to_consider="all"):
emoji_set = set(emoji_set)
return lookup, table
return lookup
# make a prediction for an input sentence
def predict(sentence, lookup, table, emojis_to_consider="all", criteria="threshold", description_key='description', lang = 'eng', n=10, t=0.9):
def predict(sentence, lookup, emojis_to_consider="all", criteria="threshold", description_key='description', lang = 'eng', n=10, t=0.9):
result = evaluate_sentence(sentence, table, description_key, lang)