1
0
mirror of https://github.com/QData/TextAttack.git synced 2021-10-13 00:05:06 +03:00

update tests for ' and -

This commit is contained in:
Jack Morris
2020-06-29 20:31:14 -04:00
parent 98b8d6102a
commit 7427865517
7 changed files with 48 additions and 24 deletions

View File

@@ -26,6 +26,10 @@ def words_from_text(s, words_to_ignore=[]):
for c in " ".join(s.split()):
if c.isalpha():
word += c
elif c in "'-" and len(word) > 0:
# Allow apostrophes and hyphens as long as they don't begin the
# word.
word += c
elif word:
if word not in words_to_ignore:
words.append(word)