小编stu*_*001的帖子

nltk NaiveBayesClassifier培训情绪分析

我正在NaiveBayesClassifier使用句子训练Python,它给出了下面的错误.我不明白错误是什么,任何帮助都会很好.

我尝试了很多其他输入格式,但错误仍然存​​在.代码如下:

from text.classifiers import NaiveBayesClassifier
from text.blob import TextBlob
train = [('I love this sandwich.', 'pos'),
         ('This is an amazing place!', 'pos'),
         ('I feel very good about these beers.', 'pos'),
         ('This is my best work.', 'pos'),
         ("What an awesome view", 'pos'),
         ('I do not like this restaurant', 'neg'),
         ('I am tired of this stuff.', 'neg'),
         ("I can't deal with this", 'neg'),
         ('He is my sworn enemy!', 'neg'),
         ('My boss is horrible.', 'neg') ]

test = [('The beer …
Run Code Online (Sandbox Code Playgroud)

python nlp nltk sentiment-analysis textblob

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

在文本文件中记录 PostgreSQL 会话

我正在尝试将 psql 中的完整会话记录到 .txt 文件中。给我的命令最初是这样的:

psql db_name| tee file_name.txt
Run Code Online (Sandbox Code Playgroud)

但是,我的 SSH 客户端在我退出之前什么都不做。这意味着,它不识别任何命令。更像是一个文档,无论我写什么都不会发生任何动作。到目前为止,只有'\q'被认可让我摆脱它。任何想法发生了什么?如果 shell 不读取任何内容,我该如何编写查询。另外,我尝试了以下操作(这是在连接到数据库之前):

script filename.txt
Run Code Online (Sandbox Code Playgroud)

它确实显示消息 : script started, file is filename.txt,但我不知道此文件的存储位置以及如何检索它。

任何有关上述问题的帮助都将受到欢迎并非常感谢!非常感谢 :)

postgresql psql

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

标签 统计

nlp ×1

nltk ×1

postgresql ×1

psql ×1

python ×1

sentiment-analysis ×1

textblob ×1