File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change 44
55[ The Jieba Chinese Word Segmentation] ( https://github.com/messense/jieba-rs ) Implemented in Rust Bound for PHP.
66
7+ ## Requirements
8+
9+ - rust
10+ - php-dev
11+
712## Build
813
914``` shell
10- # Optional, specify if php isn't installed globally,
11- # this environment is used by `phper-sys`.
15+ # Optional, specify if php isn't installed globally.
1216#
1317# export PHP_CONFIG=<Your path of php-config>
1418
@@ -19,9 +23,25 @@ cargo build --release
1923## Run
2024
2125``` shell
26+ php -d " extension=target/debug/libjieba.so" --ri jieba
27+
2228php -d " extension=target/debug/libjieba.so" -r " print_r((new Jieba())->cut('我们中出了一个叛徒'));"
2329```
2430
31+ ## API
32+
33+ ``` php
34+ class Jieba {
35+ public function __construct();
36+
37+ public function cut(string $sentence, bool $hmm): array;
38+
39+ public function cutForSearch(string $sentence, bool $hmm): array;
40+
41+ public function cutAll(string $sentence): array;
42+ }
43+ ```
44+
2545## Examples
2646
2747``` php
You can’t perform that action at this time.
0 commit comments