Skip to content

Commit 8a46b54

Browse files
committed
Update readme
1 parent 9ad2a48 commit 8a46b54

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
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+
2228
php -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

0 commit comments

Comments
 (0)