【发布时间】:2020-05-21 20:46:14
【问题描述】:
我已经安装了最新版本的转换器,我能够使用它的简单语法对英语短语进行情感预测:
from transformers import pipeline
sentimentAnalysis = pipeline("sentiment-analysis")
print(sentimentAnalysis("Transformers piplines are easy to use"))
HBox(children=(FloatProgress(value=0.0, description='Downloading', max=442.0, style=ProgressStyle(description_…
HBox(children=(FloatProgress(value=0.0, description='Downloading', max=629.0, style=ProgressStyle(description_…
HBox(children=(FloatProgress(value=0.0, description='Downloading', max=230.0, style=ProgressStyle(description_…
HBox(children=(FloatProgress(value=0.0, description='Downloading', max=267844284.0, style=ProgressStyle(descri…
[{'label': 'POSITIVE', 'score': 0.9305251240730286}]
print(sentimentAnalysis("Transformers piplines are extremely easy to use"))
[{'label': 'POSITIVE', 'score': 0.9820092916488647}]
但是,当我在非英语语言(这里是希腊语)上尝试时,我没有得到预期的结果。
以下短语用英文翻译为:'This food is disgusting',我希望我的情绪得分非常低,这不是我得到的:
print(sentimentAnalysis("Αυτό το φαγητό είναι αηδιαστικό"))
[{'label': 'POSITIVE', 'score': 0.7899578213691711}]
这是使用最佳多语言模型的尝试:
稍微好一点,但仍然远远超出目标。
有什么我可以做的吗?
【问题讨论】:
标签: python-3.x multilingual huggingface-transformers