如何处理从Twitter爬虫到人工神经网络的数据

问题描述 投票:0回答:1

我正在使用深度学习(人工神经网络)来研究python中的情感分析,并且遇到了困难,如果我的问题难以理解,对不起。

所以,我有一个用于情感分析的后端和一个Twitter搜寻器,但是我很难处理来自Twitter的大量数据。

我已经成功地对其进行了分类,但是只有一个句子被分类为肯定/否定。您可以在屏幕快照链接中看到输出。

https://imgur.com/krh4pfY

这是我的代码:

Ann。

def testFromTrained(x):
    model = Sequential()
    # load json and create model
    json_file = open('model/model.json', 'r')
    loaded_model_json = json_file.read()
    json_file.close()
    model = model_from_json(loaded_model_json)

    # load weights into new self.model
    model.load_weights("model/model.h5")
    print("Loaded model from disk")

    sgd = SGD(lr=0.01)

    model.compile(loss='binary_crossentropy', optimizer=sgd)
    return getBinaryResult(model.predict_proba(np.array(x)))
Preproses()
td = TFIDF([xdata, ydata])
# TESTING
test = "he loves me"
print(test)
print (testFromTrained([td.transform(test)]))

这是来自搜寻器:

qry='trump'
maxTweets = 1000 # up to you
tweetsPerQry = 100  # No more than 100 

我需要的是对(1000个原始数据)进行爬网之后,立即对数据进行直接处理,以在神经网络上进行情感极性分析(百分比)。

有人可以帮忙吗?

python neural-network nlp web-crawler sentiment-analysis
1个回答
0
投票

使用twpy lib for python,专为数据科学设计,与熊猫兼容,没有限制。

© www.soinside.com 2019 - 2024. All rights reserved.