(output: str, stopwords: list)
| 33 | |
| 34 | @staticmethod |
| 35 | def trim_with_stopwords(output: str, stopwords: list) -> str: |
| 36 | for w in sorted(stopwords, key=len, reverse=True): |
| 37 | if output.endswith(w): |
| 38 | output = output[:-len(w)] |
| 39 | break |
| 40 | return output |
| 41 | |
| 42 | @staticmethod |
| 43 | def to_word_list_format(word_dict, tokenizer): |