PHPackages                             xdao/boson-nlp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. xdao/boson-nlp

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

xdao/boson-nlp
==============

Chinese semantic recognition

1.0(9y ago)466BSDPHPPHP &gt;=5.3.0

Since Apr 1Pushed 8y ago1 watchersCompare

[ Source](https://github.com/dwdcth/BosonNLP)[ Packagist](https://packagist.org/packages/xdao/boson-nlp)[ RSS](/packages/xdao-boson-nlp/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

#### 简介

[](#简介)

简单的封装了BosonNLP中文语义识别的api。

#### 安装

[](#安装)

composer require xdao/boson-nlp

#### 使用

[](#使用)

```
require 'vendor/autoload.php';

use Xdao\Util\BosonNLP;

$news = keywords($news);
if($response){
 var_dump($response);
}

//example2 抛出异常
$bnlp = new BosonNLP("your_key",true,true);
try {
    $response= $bnlp->keywords($news."\"");
    var_dump($response);
} catch (Exception $ex) {
    echo $ex->getMessage();
}

//example3 去除英文标点

$response= $bnlp->keywords(BosonNLP::removePunct($news."\""));
var_dump($response);
```

#### 注意

[](#注意)

- 为了简洁，使用的是php内置的file\_get\_contents，不支持异步,返回原始所有数据，未做处理 [![](response.jpg)](response.jpg)
- 有两种处理错误方式，一种是错误时返回false，一种是抛出异常 [![](exception.jpg)](exception.jpg)
- BosonNLP有点傻，如果末尾带了英文的引号就不能处理了，如上example2，于是提供了一个去除英文标点的静态方法removePunct
- 详细的文档，请查阅[官网](http://docs.bosonnlp.com/getting_started.html)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3327d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c71182574d254706a745f8d1486e05babab42ab60b179715d369020313155e6?d=identicon)[dwdcth](/maintainers/dwdcth)

### Embed Badge

![Health badge](/badges/xdao-boson-nlp/health.svg)

```
[![Health](https://phpackages.com/badges/xdao-boson-nlp/health.svg)](https://phpackages.com/packages/xdao-boson-nlp)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
