def remove_punctuation(review):
lst = []
for text in review:
if text not in string.punctuation:
lst.append(text)
return "".join(lst)
df.Review = df.Review.apply(lambda x: remove_punctuation(x))
我正在做亚马逊产品评论的情感分析。我正在对评论的文本进行预处理,并使用上述功能删除标点符号。它把它们全部删除了,但我的问题是,我们是
用例如下所示:
假设我有一个句子(复习数据):The staffs were very kind and helpful. The room is ok for its price. There did not seem to be a heater in the room. So, a bit for our January trip.
现在,如果我想知道一个词的情感,例如room,那么我应该如何进行。
我使用bag of words模型设计了对给定句子的情感分析,但是从word (回顾数据)中确定给定的D3的情感对我来说还是比较新的。我在这里应该采取什么方法?
提供某种方法或任何链接就足够
我试图在XLNet中做这样的事情,但是我在文档中找不到这个部分,任何帮助都是有价值的,谢谢!
# we access the transformer model within our bert object using the bert attribute
# (eg bert.bert instead of bert)
embeddings = bert.bert(input_ids, attention_mask=mask)[1] # access pooled activations with [1]
(而不是bert.bert,我试图用xlnet来实现它)
我想知道如何从零开始创建一个情感模型。我有我的数据,文本列表,没有关于情感的标签。
Author Quotes
Dan Brown “Everything is possible. The impossible just takes longer.”
Dan Brown “Great minds are always feared by lesser minds.”
Dan Brown “Men go to far greater lengths to avoid what they fear than to obtain what they desire.”
Dan
我想开发一个深度学习模型来分类一些评论和评论。以下是对数据结构的一点描述:
每个注释可能与一个或多个类相关,例如关于手机电池、手机操作系统或其他类的评论(类型分析)。
每条评论(比如关于手机电池及其操作系统的评论)都可以是正面的、负面的或中性的,其中只有一条是(情感分析)。
现在的问题是,我是否应该开发多个模型(每个类一个模型),该模型有3个情感输出,如下所示:
DATA ==> TYPE DETECTION MODEL ==> output_1 (type of review)
DATA ==> SENTIMENT DETECTION MODEL ==> output
我对Google平台非常陌生,我正在尝试与TPU一起训练一个模型。我遵循这个与Google建立TPU。下面的所有代码都遵循本教程。
这是我所做的步骤:
import datetime
import json
import os
import pprint
import random
import string
import sys
import tensorflow as tf
assert 'COLAB_TPU_ADDR' in os.environ, 'ERROR: Not connected to a TPU runtime; please see the fi