Skip to main content

基于三分类的中文情感分析

Project description

基于三分类的文本情感分析

基于bert模型,能够识别文本postive, neutral, negative三种情感。

安装

pip install bhsenti

使用

import bhsenti

pre = bhsenti.predict("待预测文本")
pre_info = bhsenti.predict_info("待预测文本")

print(pre)
# 积极
print(pre_info)
# {'text': '待预测文本', 'result': '积极', 'classes': 2, 'score': [0.3605044484138489, 0.009216712787747383, 0.6302788257598877]}
  • text: str 接收到的文本,
  • result: str 预测结果,
  • classes: int 情感类别序号: 0.消极 1.中性 2.积极,
  • score: list[double] 每个类别的预测得分

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bhsenti-0.0.3.tar.gz (76.6 kB view details)

Uploaded Source

Built Distribution

bhsenti-0.0.3-py3-none-any.whl (73.6 kB view details)

Uploaded Python 3

File details

Details for the file bhsenti-0.0.3.tar.gz.

File metadata

  • Download URL: bhsenti-0.0.3.tar.gz
  • Upload date:
  • Size: 76.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for bhsenti-0.0.3.tar.gz
Algorithm Hash digest
SHA256 999cdcd991b61e17150d73f598440822bfe8dc5f076c5bc4872be9372b07828e
MD5 a34d3b62a74e4a198416b6ac46a7ae69
BLAKE2b-256 ee38cc11418bb1c9ec1839b4c4fcf9cd05334086bdba1fd31f744bc7cd5caada

See more details on using hashes here.

File details

Details for the file bhsenti-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: bhsenti-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 73.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for bhsenti-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7ca89924e002eb5ac066ce09b6d94d85568ecff525ea3158d87584cf5c7b784d
MD5 e1cf2d32c2723ca3c4dcf0c37d986cf8
BLAKE2b-256 50a121220660163c76f74821b65f56b715c86f539bdba3bb32869c61dac98c4d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page