mginoben commited on
Commit
370f6d7
1 Parent(s): 244a6f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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
- word = re.sub("[^a-zA-Z0-9@]", "", word).lower()
42
  scores = []
43
  matched_words = []
44
  # If word > 4 chars
45
- if len(word) >= 4:
46
  # Get fuzzy ratio
47
  for lookup_word in lookup_words:
48
- score = fuzz.ratio(word, lookup_word)
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)