Dies sollte die Emoticons loswerden, mit wie von Ndoogan vorgeschlagen.
Einige reproduzierbare Daten:
require(twitteR)
# note that I had to register my twitter credentials first
# here's the method: http://stackoverflow.com/q/9916283/1036500
s <- searchTwitter('#emoticons', cainfo="cacert.pem")
# convert to data frame
df <- do.call("rbind", lapply(s, as.data.frame))
# inspect, yes there are some odd characters in row five
head(df)
text
1 ROFLOL: echte #emoticons [humor] http://t.co/0d6fA7RJsY via @tweetsmania ;-)
2 “@teeLARGE: when tmobile get the iphone in 2 wks im killin everybody w/ emoticons & \nall the other stuff i cant see on android!" \n#Emoticons
3 E poi ricevi dei messaggi del genere da tua mamma xD #crazymum #iloveyou #emoticons #aiutooo #bestlike http://t.co/Yee1LB9ZQa
4 #emoticons I want to change my name to an #emoticon. Is it too soon? #prince http://t.co/AgmR5Lnhrk
5 I use emoticons too much. #addicted #admittingit #emoticons <ed><U+00A0><U+00BD><ed><U+00B8><U+00AC><ed><U+00A0><U+00BD><ed><U+00B8><U+0081> haha
6 What you text What I see #Emoticons http://t.co/BKowBSLJ0s
Hier ist der Schlüssel Linie, die die Emoticons entfernen wird:
# Clean text to remove odd characters
df$text <- sapply(df$text,function(row) iconv(row, "latin1", "ASCII", sub=""))
nun wieder prüfen, um zu sehen, ob die ungeraden Zeichen verschwunden sind (siehe Zeile 5)
head(df)
text
1 ROFLOL: echte #emoticons [humor] http://t.co/0d6fA7RJsY via @tweetsmania ;-)
2 @teeLARGE: when tmobile get the iphone in 2 wks im killin everybody w/ emoticons & \nall the other stuff i cant see on android!" \n#Emoticons
3 E poi ricevi dei messaggi del genere da tua mamma xD #crazymum #iloveyou #emoticons #aiutooo #bestlike http://t.co/Yee1LB9ZQa
4 #emoticons I want to change my name to an #emoticon. Is it too soon? #prince http://t.co/AgmR5Lnhrk
5 I use emoticons too much. #addicted #admittingit #emoticons haha
6 What you text What I see #Emoticons http://t.co/BKowBSLJ0s
versuchen mit iconv Arbeits() – ndoogan
Und Blick auf 'Encodings' –
Darf ich vorschlagen, dass Sie herausfinden, was diese Codierungen bedeuten?. Das Emoticon ist eine Form der Sprache, die eine Bedeutung vermittelt, die möglicherweise nicht in der formalen Textsprache erfasst wird. Nicht sicher, was Sie suchen, aber diese Emoticons sind Sentiment, eine Art, Gestik/Gesichtsausdruck in einer Weise darzustellen, wie es sich die typische formale Sprache nicht leisten kann. Verwenden Sie die Kommentare/Lösungen hier erneut, um die Emoticons nicht zu eliminieren, sondern um herauszufinden, welche Bedeutung das Emoticon vermittelt. –