Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
dcd-sentiment-analyser
Advanced tools
SentimentAnalyzer 是一个情感分析工具包,基于 T5 模型,支持多种自然语言任务。用户可以选择不同的提取模式,轻松完成情感四元组、二元组、三元组等任务。
你可以通过以下命令安装 SentimentAnalyzer:
pip install dcd-sentiment-analyzer
首先,导入并初始化 SentimentAnalyzer
类:
from DCD_sentiment_analyser import SentimentAnalyzer
analyzer = SentimentAnalyzer() # 自动下载模型文件
# 可以传入自定义模型目录用于初始化SentimentAnalyzer类
analyzer = SentimentAnalyzer(model_dir="your_model_dir")
SentimentAnalyzer
支持以下提取模式:
target_opinion_aspect_polarity
(对象 | 观点 | 方面 | 极性)object_opinion
(对象 | 观点)object_opinion_aspect
(对象 | 观点 | 方面)object_opinion_polarity
(对象 | 观点 | 极性)object_aspect_polarity
(对象 | 方面 | 极性)aspect_polarity
(方面 | 极性)opinion_polarity
(观点 | 极性)polarity
(极性)text = "个头大、口感不错,就是个别坏了的或者有烂掉口子刻意用泥土封着,这样做不好。"
result = analyzer.analyze("quadruples", text)
print(result)
text = "这真是太糟糕了。"
result = analyzer.analyze("polarity", text)
print(result)
text = "这部电影还不错。"
result = analyzer.analyze("opinion_polarity", text)
print(result)
如有任何问题,请联系 younghangx@163.com。
此项目基于 MIT 许可证,详细请查看 LICENSE 文件。
FAQs
sentiment analysis for dcd
We found that dcd-sentiment-analyser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.