Commit d760888d authored by Franziska Koehn's avatar Franziska Koehn
Browse files

filtered empty strings

parent 469f5b79
...@@ -22,8 +22,12 @@ def count_substrings(substrings, strings): ...@@ -22,8 +22,12 @@ def count_substrings(substrings, strings):
if strings == []: if strings == []:
return [] return []
subs = list(set(substrings))
results = defaultdict(int) results = defaultdict(int)
for sub,string in product(substrings, strings): for sub,string in product(subs, strings):
if sub == '':
continue
results[sub] # create key results[sub] # create key
if sub.lower() in string.lower(): if sub.lower() in string.lower():
results[sub] += 1 results[sub] += 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment