Dies ist der Code, den ich in Google Colab < /p>
verwendeimport re
from textblob import TextBlob
import emoji
def clean_tweet(text):
text = re.sub(r'@[A-Za-z0-9]+', '', str(text)) # remove @mentions
text = re.sub(r'#', '', str(text)) # remove the '#' symbol
text = re.sub(r'RT[\s]+', '', str(text)) # remove RT
text = re.sub(r'https?\/\/S+', '', str(text)) # remove the hyperlink
text = re.sub(r'http\S+', '', str(text)) # remove the hyperlink
text = re.sub(r'www\S+', '', str(text)) # remove the www
text = re.sub(r'twitter+', '', str(text)) # remove the twitter
text = re.sub(r'pic+', '', str(text)) # remove the pic
text = re.sub(r'com', '', str(text)) # remove the com
return text
def remove_emoji(text):
return emoji.get_emoji_regexp().sub(u'', text)
< /code>
Wenn ich diese Aufrufe < /p>
machetweets['cleaned_text']=tweets['text'].apply(clean_tweet)
tweets['cleaned_text']=tweets['cleaned_text'].apply(remove_emoji)
< /code>
Ich erhalte den folgenden Fehler < /p>
AttributeError Traceback (most recent call last)
in
1 tweets['cleaned_text']=tweets['text'].apply(clean_tweet)
----> 2 tweets['cleaned_text']=tweets['cleaned_text'].apply(remove_emoji)
4 frames
in remove_emoji(text)
24
25 def remove_emoji(text):
---> 26 return emoji.get_emoji_regexp().sub(u'', text)
AttributeError: module 'emoji' has no attribute 'get_emoji_regexp'
< /code>
Das ist sehr seltsam. Ich habe dieses Problem noch nie gesehen. Könnte mir jemand dabei helfen? Mache ich hier etwas falsch?
AttributeError: Modul 'emoji' hat kein Attribut 'get_emoji_regexp' ⇐ Python
-
- Similar Topics
- Replies
- Views
- Last post