标签: sentiment-analysis

是否存在一组用于正极性或负极性的形容词单词列表

我正在研究情绪分析.我想如果有任何可用的形容词表示正/负(如正面:好,真棒,惊人)的含义?第二件事是我可以用作测试用例的一组数据.

nlp stanford-nlp sentiment-analysis

3
推荐指数
2
解决办法
1万
查看次数

如何在情绪分析中使用上下文敏感语法?

是否可以在情绪分析中使用上下文敏感语法?如果是,那怎么样?基本上,我想做一些短语级别的分析.

nlp sentiment-analysis context-sensitive-grammar

3
推荐指数
1
解决办法
1178
查看次数

如何保存分类器textblob NaiveBayesClassifier的结果?

NaiveBayesclassifier根据我选择的给定主题使用TextBlob 进行文本分析.

数据量巨大(约3000个条目).

虽然我能够得到一个结果,但是如果没有再次调用该函数并等待数小时直到处理完成,我将无法将其保存以备将来使用.

我试着通过以下方法进行酸洗

ab = NaiveBayesClassifier(data)

import pickle

object = ab
file = open('f.obj','w') #tried to use 'a' in place of 'w' ie. append
pickle.dump(object,file)
Run Code Online (Sandbox Code Playgroud)

我收到一个错误,如下:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\pickle.py", line 1370, in dump
    Pickler(file, protocol).dump(obj)
  File "C:\Python27\lib\pickle.py", line 224, in dump
    self.save(obj)
  File "C:\Python27\lib\pickle.py", line 331, in save
    self.save_reduce(obj=obj, *rv)
  File "C:\Python27\lib\pickle.py", line 419, in save_reduce
    save(state)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # …
Run Code Online (Sandbox Code Playgroud)

python classification pickle sentiment-analysis textblob

3
推荐指数
1
解决办法
2594
查看次数

Python NLTK错误:未找到NLTK中的english.pickle资源

试图在Python中学习NLP和情感分析,并遇到了NLTK.做了一些教程,但却陷入了令牌化功能,因为它对我不起作用(命令行说我没有资源).

我已经尝试过安装punkt,虽然已经下载了,但命令行仍然会出现同样的错误:

Resource u'taggers/maxent_treebank_pos_tagger/english.pickle'
not found.  Please use the NLTK Downloader to obtain the
resource:  >>> nltk.download()
Searched in:
  - 'C:\\Users\\JeromePogi/nltk_data'
  - 'C:\\nltk_data'
  - 'D:\\nltk_data'
  - 'E:\\nltk_data'
  - 'C:\\Python27\\nltk_data'
  - 'C:\\Python27\\lib\\nltk_data'
  - 'C:\\Users\\JeromePogi\\AppData\\Roaming\\nltk_data'
  - u''
Run Code Online (Sandbox Code Playgroud)

我已经尝试了一切,包括将nltk_data文件夹放在它搜索过的每个目录中,但无济于事.我该怎么做才能解决此错误?

python named-entity-recognition nltk sentiment-analysis

3
推荐指数
1
解决办法
1万
查看次数

是否有比 AFINN 和 wordstrength 改进/更好的单词列表版本

是否有比 AFINN 和 wordstrength 改进/更好的单词列表版本?我在有限的列表中没有获得很好的准确性。我正在寻找更多与情感分数相关的单词。

scoring words sentiment-analysis

3
推荐指数
1
解决办法
2355
查看次数

requests.exceptions.ChunkedEncodingError: ('连接中断:IncompleteRead(读取 0 个字节,预计还有 512 个)',IncompleteRead

我想编写一个程序来从 Twitter 获取推文,然后进行情感分析。我编写了以下代码,即使在导入所有必要的库后也出现错误。我对数据科学比较陌生,所以请帮助我。我无法理解此错误的原因:

class TwitterClient(object):


def __init__(self):

    # keys and tokens from the Twitter Dev Console
    consumer_key = 'XXXXXXXXX'
    consumer_secret = 'XXXXXXXXX'
    access_token = 'XXXXXXXXX'
    access_token_secret = 'XXXXXXXXX'
    api = Api(consumer_key, consumer_secret, access_token, access_token_secret)

    def preprocess(tweet, ascii=True, ignore_rt_char=True, ignore_url=True, ignore_mention=True, ignore_hashtag=True,letter_only=True, remove_stopwords=True, min_tweet_len=3):
        sword = stopwords.words('english')

        if ascii:  # maybe remove lines with ANY non-ascii character
            for c in tweet:
                if not (0 < ord(c) < 127):
                    return ''

        tokens = tweet.lower().split()  # to lower, split
        res = []

        for …
Run Code Online (Sandbox Code Playgroud)

twitter chunked-encoding sentiment-analysis python-requests

3
推荐指数
1
解决办法
2万
查看次数

Transformer库缓存路径没有改变

我已经尝试过但它对我不起作用。我正在使用这个Git 存储库。我正在构建一个桌面应用程序,不希望用户下载模型。我想通过构建来运送模型。我知道 Transformers 库会寻找cache/torch/transformers. 如果不存在,请下载它。我还知道你可以cache_dir在 中传递参数pre_trained。我正在尝试这个。

cache = os.path.join(os.path.abspath(os.getcwd()), 'Transformation/Annotators/New Sentiment Analysis/transformers')
os.environ['TRANSFORMERS_CACHE'] = cache


if args.model_name_or_path is None:
    args.model_name_or_path = 'barissayil/bert-sentiment-analysis-sst'
#Configuration for the desired transformer model
config = AutoConfig.from_pretrained(args.model_name_or_path, cache_dir=cache)
Run Code Online (Sandbox Code Playgroud)

我已经尝试了上述问题中的解决方案,并尝试了cache_dir。Transformer 文件夹与analyze.py 位于同一目录中。整个存储库和转换器文件夹位于 New Sentiment Analysis 目录中。

python sentiment-analysis huggingface-transformers

3
推荐指数
1
解决办法
3338
查看次数

如何根据 R 词典中的单词标记文本正面或负面?

假设我有一个包含注释的向量(数据框)(每行都是不同的注释):

comment
'well done!'
'terrible work'
'quit your job'
'hi'
Run Code Online (Sandbox Code Playgroud)

我有以下包含单词的数据框positivenegative即字典)

positive negative
well     terrible
done     quit
Run Code Online (Sandbox Code Playgroud)

R 有没有办法使用这个字典来标记第一个数据帧中的评论positivenegative或者neutral根据它们是否包含更多或更少的正面/负面评论?

即我希望输出是一个数据框,如下所示:

comment          label
'well done!'     positive
'terrible work'  negative
'quit your job'  negative
'hi'             neutral
Run Code Online (Sandbox Code Playgroud)

有谁知道如何在 R 中做到这一点?

r sentiment-analysis

3
推荐指数
1
解决办法
383
查看次数

python 中是否有 set_value 的替代方案

我收到如下错误:“AttributeError:'DataFrame'对象没有属性'set_value'”。代码在这里给出:

for i in range(0,len(text)):
   textB = TextBlob(text[i])
   sentiment = textB.sentiment.polarity
   new_df.set_value(i,'sentiment', sentiment)
   if sentiment < 0.00 :
       sentimentclass = 'Negative'
       new_df.set_value(i, 'sentimentclass', sentimentclass)
   elif sentiment > 0.00 :
       sentimentclass = 'Positive'
       new_df.set_value(i, 'sentimentclass', sentimentclass)
   else :
       sentimentclass = ' Neutral'
       new_df.set_value(i, 'sentimentclass', sentimentclass)
Run Code Online (Sandbox Code Playgroud)

python dataframe sentiment-analysis pandas

3
推荐指数
1
解决办法
4981
查看次数

modulenot 找到 'keras.layer.embeddings' 即使我正确安装了 keras,我也不知道如何解决这个问题

import pandas as pd
import numpy as np

import matplotlib.pyplot as plt
 import seaborn as sns
%matplotlib inline
from wordcloud import WordCloud

from bs4 import BeautifulSoup  
import re
import nltk
from nltk.corpus import stopwords 
from nltk.stem.porter import PorterStemmer
from nltk.stem import SnowballStemmer, WordNetLemmatizer
from nltk import sent_tokenize, word_tokenize, pos_tag


from keras.preprocessing import sequence
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Lambda
from keras.layers.embeddings import Embedding
from keras.layers.recurrent import LSTM, SimpleRNN, GRU
from keras.preprocessing.text …
Run Code Online (Sandbox Code Playgroud)

python sentiment-analysis keras jupyter-notebook keras-layer

3
推荐指数
1
解决办法
5773
查看次数