PHPackages                             deminy/jieba-php - 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. deminy/jieba-php

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

deminy/jieba-php
================

结巴中文分词PHP版本

0.25.3(9y ago)21.6k1MITPHPPHP &gt;=7.0

Since Apr 30Pushed 8y ago1 watchersCompare

[ Source](https://github.com/deminy/jieba-php)[ Packagist](https://packagist.org/packages/deminy/jieba-php)[ RSS](/packages/deminy-jieba-php/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (13)Used By (0)

[deminy/jieba-php](https://github.com/deminy/jieba-php)
=======================================================

[](#deminyjieba-php)

[![Build Status](https://camo.githubusercontent.com/57d2cdc55bf44ff32b2f68a061f84bdf9e9c6e93781bbfe563ec4cf87e8c9026/68747470733a2f2f7472617669732d63692e6f72672f64656d696e792f6a696562612d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/deminy/jieba-php)[![Latest Stable Version](https://camo.githubusercontent.com/1593867c3728b10435d568ec874197f31500d165961752890e273ea15095cd82/68747470733a2f2f706f7365722e707567782e6f72672f64656d696e792f6a696562612d7068702f762f737461626c652e706e67)](https://packagist.org/packages/deminy/jieba-php)[![Codacy Badge](https://camo.githubusercontent.com/638395ef79f3a1adb5958044de470414197d04d0d50000c636f96a20129139b5/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3236353334353231643334353435386139393865656364336233303038363230)](https://www.codacy.com/app/deminy/jieba-php)[![Coding Standards](https://camo.githubusercontent.com/dbabe22710e675cb88cd0b12196f1477e2376dea497332775692cf1359a75918/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f63732d5053522d2d322d2d522d79656c6c6f772e737667)](https://github.com/php-fig-rectified/fig-rectified-standards)[![PSR-4](https://camo.githubusercontent.com/bbde1fa96ef88cc4935dac2851741d5045ad4e348558501bc1031ca96926c7ef/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f63732d5053522d2d342d79656c6c6f772e737667)](http://www.php-fig.org/psr/psr-4/)[![License](https://camo.githubusercontent.com/2e2b752efe67946ab4bec632c275c7f570165121924275ee1abc7ee9a51a6e70/68747470733a2f2f706f7365722e707567782e6f72672f64656d696e792f6a696562612d7068702f6c6963656e73652e737667)](https://packagist.org/packages/deminy/jieba-php)

"结巴中文分词"PHP版本："[结巴中文分词](https://github.com/fxsjy/jieba)"是Sun Junyi开发的Python版的中文分词组件，后来衍生了多种语言实现，包括C++、Java、.NET、Go等等。这份PHP版本起始于[fukuball](https://github.com/fukuball/jieba-php)之前做的PHP实现（v0.25），随后对其整体重写并作了各种更新和改进，包括代码升级、使用PHP 7的新功能重构代码、使用PSR-4管理autoloading、使用依赖注射等设计模式、更新单元测试的实现、以及更多的性能优化和代码更新等等。如果你需要相应的PHP扩展的版本，可考虑jonnywang写的[结巴中文分词之PHP扩展](https://github.com/jonnywang/phpjieba)。

有关算法、词典生成等方面的问题，请参考[结巴中文分词](https://github.com/fxsjy/jieba)相关文档。

特点
==

[](#特点)

- 支持三种分词模式：
    - 精确模式，试图将句子最精确地切开，适合文本分析。
    - 全模式，把句子中所有的可以成词的词语都扫描出来, 速度非常快，但是不能解决歧义。
    - 搜索引擎模式，在精确模式的基础上，对长词再次切分，提高召回率，适合用于搜索引擎分词。
- 支持繁体分词。
- 支持自定义词典。

安装使用
====

[](#安装使用)

使用本库你需要至少给PHP分配1G内存限制或更多，主要是用来存储词典信息。随着进一步的优化（包括缓存方面的优化），内存消耗将会降低。

```
composer require deminy/jieba-php:dev-master
```

```
