我想检测熊猫系列中字符串的语言,并将字符串从检测到的语言翻译成英语
df['Comments'][:7]
0 @bertelsen1986
1 20 or 30 mm rise on the Renthal Fatbar?
2 Luckily I have one to 🔥💪🏻
3 @hatsofftojj isn’t this a dope bike
4 My bike came with a old GX eagle I have big scam
5 NaN
6 Also ist ein Spulenschock jetzt ein Daumen hoch auf einem Spektral?
Name: Comments, dtype: object
下面是用来检测字符串语言的代码。 对于22000行,代码已经运行了几乎一整天(仍在运行)
from langdetect import detect
lang = []
for row in df.Comments:
lang = detect(r)
df['Comments'] = str(df['Comments'])
df['Language'] = df['Comments'].apply(detect)
目前没有回答
相关问题 更多 >
编程相关推荐