gpt4 book ai didi

用于删除互联网行话/俚语/首字母缩略词的 python 模块

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

是否有任何 python 模块(可能在 nltk python 中)可以删除互联网俚语/聊天俚语,如“lol”、“brb”等。如果没有,有人可以为我提供一个包含如此庞大的俚语列表的 CSV 文件吗?

网站http://www.netlingo.com/acronyms.php给出了首字母缩略词列表,但我无法找到任何 CSV 文件以在我的程序中使用它们。

最佳答案

要废弃的代码 http://www.netlingo.com/acronyms.php

from bs4 import BeautifulSoup
import requests, json
resp = requests.get("http://www.netlingo.com/acronyms.php")
soup = BeautifulSoup(resp.text, "html.parser")
slangdict= {}
key=""
value=""
for div in soup.findAll('div', attrs={'class':'list_box3'}):
for li in div.findAll('li'):
for a in li.findAll('a'):
key =a.text
value = li.text.split(key)[1]
slangdict[key]=value

with open('myslang.json', 'w') as f:
json.dump(slangdict, f, indent=2)

关于用于删除互联网行话/俚语/首字母缩略词的 python 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8502387/

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