gpt4 book ai didi

python - 从字符串 NLP 中删除英语 "crap"单词的策略,例如 "um"、 "uh"

转载 作者:太空宇宙 更新时间:2023-11-03 20:09:49 25 4
gpt4 key购买 nike

是否有一个好的 python 库,专门包含某种常见英语“扔掉单词”的字典,例如“um”、“uh”,我可以用它来清理 NLP 文本?

同样,我的同事开始列出俚语/俗语列表。我想要一个能够找到所有这些的 python 库。他下面的 js 代码做了一些事情,比如把“nope”和“naw”变成“no”

  txt = txt.replace(
/\b(yeah|ya|yep|yup|yes)\b/g, "yes"
).replace(
/\b(no|naw|nope)\b/g, "no"
).replace(
/\b([ah]+|uh-huh|uh+|um+|mhm+|huh+|oh)\b/g, ""
).replace(
/\b(im|i'm|i am)\b/g, "im"
).replace(
/\b(gotta|gonna|got to|going to|wanna|want to)\b/g, "yyxxa"
).replace(
/\b(ok|okay|k)\b/g, "okay"
);

最佳答案

关于python - 从字符串 NLP 中删除英语 "crap"单词的策略,例如 "um"、 "uh",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58774510/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com