From 1b1ba52201811f0c489749d1577223da8c4267e2 Mon Sep 17 00:00:00 2001 From: Maren Date: Tue, 26 Jun 2018 14:59:24 +0200 Subject: [PATCH] Naive Approach in Python Modul --- Project/naive_approach/naive_approach.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Project/naive_approach/naive_approach.py b/Project/naive_approach/naive_approach.py index 0d1484c..bf38f8a 100644 --- a/Project/naive_approach/naive_approach.py +++ b/Project/naive_approach/naive_approach.py @@ -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)