truesocialmetrics/sentiment-analysis

PHP情感分析库,用于将文本分类为正面、负面或中性。

1.0.0 2020-10-09 07:10 UTC

This package is auto-updated.

Last update: 2024-09-09 15:26:25 UTC


README

PHP 情感分析库,用于将文本分类为正面、负面或中性。

安装

要使用Composer安装此库,请在项目目录内运行以下命令

composer require risan/sentiment-analysis

基本用法

<?php
// Include composer autoloader file.
require __DIR__ . '/vendor/autoload.php';

// Create a new instance of analyzer with default configuration.
$analyzer = SentimentAnalysis\Analyzer::withDefaultConfig();

// Analyze the text.
$result = $analyzer->analyze('This PHP package is awesome');

// Get and print the category.
echo $result->category();