def mapTweet(tweet, afinn, emoDict, positive, negative, neutral, slangs): out = [] line = preprocessing.processTweet( tweet, stopWords, slangs ) # limpio el tweet, eliminando las palabras innecesarias y sobreescribiendo los modismos out.append(polarity.afinnPolarity(line, afinn)) # afinidad out.append(float(features.emoticonScore(line, emoDict))) # emoticon score out.append(float(features.hashtagWordsRatio( line))) # porcentaje de palabras con hashtag out.append(float(len(line) / 140)) # tamaño total de los 140 carácteres utilizados out.append(float(features.upperCase( line))) # si existen mayúsuculas en el tweet; 1 = si, 0 = no out.append(float(features.exclamationTest( line))) # si tiene signo de exclamación o no; 1 = si, 0 = no out.append(float(line.count("!") / 140)) # procentaje de signos de exlamación out.append(float( (features.questionTest(line)))) # si tiene un signo de pregunta out.append(float(line.count('?') / 140)) # procentaje de signos de preguntas out.append(float( features.freqCapital(line))) # porcentaje de las letras en mayusculas u = features.scoreUnigram( line, positive, negative, neutral ) # Score sobre el vector de palabras utilizadas en los documentos de prueba out.extend(u) return out
def mapTweet(tweet,afinn,emoDict,positive,negative,neutral,slangs): out=[] line=preprocessing.processTweet(tweet,stopWords,slangs) p=polarity.afinnPolarity(line,afinn) out.append(p) out.append(float(features.emoticonScore(line,emoDict))) # emo aggregate score be careful to modify weights out.append(float(len(features.hashtagWords(line))/40)) # number of hashtagged words out.append(float(len(line)/140)) # for the length out.append(float(features.upperCase(line))) # uppercase existence : 0 or 1 out.append(float(features.exclamationTest(line))) out.append(float(line.count("!")/140)) out.append(float((features.questionTest(line)))) out.append(float(line.count('?')/140)) out.append(float(features.freqCapital(line))) u=features.scoreUnigram(line,positive,negative,neutral) out.extend(u) return out
def mapTweet(tweet,afinn,emoDict,positive,negative,neutral,slangs): out=[] line=preprocessing.processTweet(tweet,stopWords,slangs) p=polarity.afinnPolarity(line,afinn) out.append(p) out.append(float(features.emoticonScore(line,emoDict))) # emo aggregate score be careful to modify weights out.append(float(len(features.hashtagWords(line))/40)) # number of hashtagged words out.append(float(len(line)/140)) # for the length out.append(float(features.upperCase(line))) # uppercase existence : 0 or 1 out.append(float(features.exclamationTest(line))) out.append(float(line.count("!")/140)) out.append(float((features.questionTest(line)))) out.append(float(line.count('?')/140)) out.append(float(features.freqCapital(line))) u=features.scoreUnigram(line,positive,negative,neutral) out.extend(u) return out