如何编辑土耳其语句子以从预训练模型中获得更好且一致的情感分析?

问题描述 投票:0回答:1
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-classification", model="savasy/bert-base-turkish-sentiment-cased")

sentence = "Bakan Varank Milli elektrikli tren 29 Mayıs'ta test edilmeye başlanacak. Sanayi ve Teknoloji Bakanı Mustafa Varank yaptığı son dakika açıklamasında Milli elektrikli tren, 29 Mayıs'ta raylara indirilip test edilmeye başlanacak. Testlere göre, eylül ayında bu trenler vatandaşlarımızca kullanılmaya başlanacak dedi."

sentiment_result = pipe(sentence)
print(sentiment_result)

它打印出这个:

[{'label': 'negative', 'score': 0.6390795707702637}]

应该是积极的。我可以做哪些预处理来获得更好的分数和标签? 如果我标记土耳其语句子或应用其他东西会更好吗?

deep-learning nlp huggingface-transformers sentiment-analysis turkish
1个回答
0
投票

根据谷歌翻译,英文是这样的:

Minister Varank The national electric train will start testing on May 29. In his last minute statement, Minister of Industry and Technology Mustafa Varank said that the National electric train will be put on the rails and tested on May 29. "According to the tests, these trains will start to be used by our citizens in September," he said.

这对我来说听起来是中性的,既不是特别积极也不是特别消极。当然,如果新火车能让你的通勤变得更好,那是积极的;如果您在一家维护旧柴油(?)火车的公司工作,这可能会被视为负面的。所以这是一个关键点 - 情绪是主观的。

https://huggingface.co/savasy/bert-base-turkish-sentiment-cased表示它已经接受了电影评论和推文的训练。您将在经过类似领域和期望训练的模型上获得最佳结果。

因此,如果您对这样的数据集进行微调,您将获得更好的结果。它不必很大,你可能只需要 20-30 篇与政府相关的正面新闻报道和相同数量的负面新闻报道,上面的句子就可以开始给出你期望的结果。 (关于“如何微调拥抱表情情绪模型”的谷歌提供了大量关于如何做到这一点的教程。)

我的另一个想法是尝试机器翻译成英语,并使用可用的英语情感模型之一,其中有更广泛的选择。

我将上面的文字粘贴到 https://huggingface.co/j-hartmann/sentiment-roberta-large-english-3-classes 顾名思义,它属于第三类,因此可以分为积极、中性或消极。 结果显示为中性 0.999。

所以这可能是一个很好的解决方案,尽管它可能无法解决您认为的问题。

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