Skip to content

Commit

Permalink
Merge pull request societe-generale#2 from FabienGiely/no_contract_no…
Browse files Browse the repository at this point in the history
…_interpret

add no contract on no_interpret
  • Loading branch information
MathiasWinckel authored Mar 18, 2021
2 parents 946ac67 + fb744da commit 7508582
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions CoreNLG/NoInterpret.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"[": "OPENING_BRACKET",
"]": "CLOSING_BRACKET",
"\n": "CARRIAGE_RETURN",
"": "NOCONTRACT"
}

interpretable_char_reverse = {value: key for key, value in interpretable_char.items()}
Expand All @@ -44,8 +45,11 @@ def __no_interpret_char(self, char):
except KeyError:
return char

def no_interpret(self, text):
not_interpret_text = "".join([self.__no_interpret_char(c) for c in text])
def no_interpret(self, text, no_contract=True):
not_interpret_text = ""
if no_contract:
not_interpret_text = "#NOCONTRACT#"
not_interpret_text += "".join([self.__no_interpret_char(c) for c in text])
if ' ' in text:
return self.__add_tag("span", not_interpret_text, style="white-space:pre")
else:
Expand Down

0 comments on commit 7508582

Please sign in to comment.