我正在尝试使用深度学习(RNN)对推特数据进行情绪分析。我知道还有其他各种深度学习库,如TF,keras,gensim等,但我想知道是否可以使用CoreNLP库进行深度学习。
https://github.com/charlescc9/deep-learning-sentiment-analysis
上面这个人试图比较gensim,tensorflow和core nlp进行深度学习。但是几乎没有任何文档,我无法理解如何运行文件(或)所需的dependecies。请帮帮我。
我之前使用过RNN的原因相同,这就是我所做的:
pip install pycorenlp
。Java>=1.8
。现在,让我们看看如何使用它:
java -mx5g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -timeout 10000
localhost:9000
上运行。现在,您可以编写您的程序。这是一个简单的例子:
>>> from pycorenlp import StanfordCoreNLP
>>>
>>> sentence = "NLP is great"
>>> nlp = StanfordCoreNLP('http://localhost:9000')
>>> res = nlp.annotate(sentence, properties={ 'annotators': 'sentiment',
... 'outputFormat': 'json',
... 'timeout': 10000,})
>>> #you can get the class by:
>>> klass = res["sentences"][0]["sentimentValue"]