PPKM_sentiment / formalisasi.txt
William14045's picture
commit1
15462a3
raw
history blame contribute delete
No virus
268 Bytes
def formalize_words(text, word_formalization_dict):
pattern = re.compile('\\b(' + '|'.join(kamus.keys()) + ')\\b')
def replace_words(match):
return kamus[match.group(0)]
formalized_text = pattern.sub(replace_words, text)
return formalized_text