Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -38,14 +38,14 @@ def fuzzy_lookup(tweet):
|
|
38 |
# Loop each word in tweet
|
39 |
for word in tweet.split():
|
40 |
# Only get digits and letters then lowercase
|
41 |
-
|
42 |
scores = []
|
43 |
matched_words = []
|
44 |
# If word > 4 chars
|
45 |
-
if len(
|
46 |
# Get fuzzy ratio
|
47 |
for lookup_word in lookup_words:
|
48 |
-
score = fuzz.ratio(
|
49 |
if score >= 70:
|
50 |
scores.append(score)
|
51 |
matched_words.append(lookup_word)
|
|
|
38 |
# Loop each word in tweet
|
39 |
for word in tweet.split():
|
40 |
# Only get digits and letters then lowercase
|
41 |
+
processed_word = re.sub("[^a-zA-Z0-9@]", "", word).lower()
|
42 |
scores = []
|
43 |
matched_words = []
|
44 |
# If word > 4 chars
|
45 |
+
if len(processed_word) >= 4:
|
46 |
# Get fuzzy ratio
|
47 |
for lookup_word in lookup_words:
|
48 |
+
score = fuzz.ratio(processed_word, lookup_word)
|
49 |
if score >= 70:
|
50 |
scores.append(score)
|
51 |
matched_words.append(lookup_word)
|