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

update attackedtext references, need to update tokenization

This commit is contained in:
Jack Morris
2020-06-16 21:56:33 -04:00
parent 9bf213f7fd
commit d25bf44f52
22 changed files with 189 additions and 166 deletions

View File

@@ -19,8 +19,8 @@ class LanguageTool(Constraint):
self.grammar_error_threshold = grammar_error_threshold
self.grammar_error_cache = {}
def get_errors(self, tokenized_text, use_cache=False):
text = tokenized_text.clean_text()
def get_errors(self, attacked_text, use_cache=False):
text = attacked_text.printable_text
if use_cache:
if text not in self.grammar_error_cache:
self.grammar_error_cache[text] = len(self.lang_tool.check(text))