定制 otifsolutions/php-sentiment-analysis 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

otifsolutions/php-sentiment-analysis

Composer 安装命令:

composer require otifsolutions/php-sentiment-analysis

包简介

Php Sentiment Analysis allows user to analyze sentiments from a text statement

README 文档

README

Install via Composer

Using Composer (Recommended)

You can run the following command in the root directory of your project:

composer require otifsolutions/php-sentiment-analysis

Usage

  • Php Sentiment Analysis allows to analyze a text statement if it is positive or negative. e.g. comment on any post.

    Sentiment::make()->analyze($value);
    • Where $value is the statement to be analyzed.
  • Statement may contain labels, emojis and negators.

    • Labels are words statement contains e.g. corruption, boycott.
    • Emoji e.g. 😍, 💖.
    • Negators are words that negate something e.g. doesnt, not.
  • We use following methods

    • getTokens

      • This method separate the words from the given statement and returns all words.
    • getDataSet

      • This method has dataset.
      • Labels, emojis and negators already stored in the dataset, which have a positive or negative value.
      • For example "fun": 4, "funeral": -1,

This example demonstrates the usage of Php Sentiment Analysis,

  Sentiment::make()->analyze('She is famous, but she hates others.');
  {
   "score": -1,
   "comparative": -0.14285714285714285,
   
   "calculation": [
     {"she": 0},{"is": 0},{"famous": 2},{"but": 0},{"she": 0},{"hates": -3},{"others": 0}
     ],
  
   "tokens":  [
    "she","is","famous","but","she","hates","others"
      ],
 
   "positive": [
      "famous"
      ],
 
   "negative": [
      "hates"
      ]
  }
Option Description
score Positive or negative value after analysis of given statement.
tokens Tokens are the separated words in a Statement.
comparative Value received when score is divided by count of token.
calculation Words in an array with a positive or negative value, if the word exists in dataset the value will be positive or negative otherwise value will be zero.
positive Shows all positive words from the statement.
negative shows all negative words from the statement.

统计信息

  • 总下载量: 545
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-06-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固