update splitter.md
This commit is contained in:
parent
3745b1d1bb
commit
17985c7f8e
|
|
@ -1,10 +1,11 @@
|
||||||
## 自定义分词器
|
## 如何自定义分词器
|
||||||
|
|
||||||
### 在哪里写,哪些文件要改
|
### 在哪里写,哪些文件要改
|
||||||
1. 在```text_splitter```文件夹下新建一个文件,文件名为您的分词器名字,比如`my_splitter.py`,然后在`__init__.py`中导入您的分词器,如下所示:
|
1. 在```text_splitter```文件夹下新建一个文件,文件名为您的分词器名字,比如`my_splitter.py`,然后在`__init__.py`中导入您的分词器,如下所示:
|
||||||
```python
|
```python
|
||||||
from .my_splitter import MySplitter
|
from .my_splitter import MySplitter
|
||||||
```
|
```
|
||||||
|
|
||||||
2. 修改```config/model_config.py```文件,将您的分词器名字添加到```text_splitter_dict```中,如下所示:
|
2. 修改```config/model_config.py```文件,将您的分词器名字添加到```text_splitter_dict```中,如下所示:
|
||||||
```python
|
```python
|
||||||
MySplitter: {
|
MySplitter: {
|
||||||
|
|
@ -13,9 +14,11 @@ MySplitter: {
|
||||||
}
|
}
|
||||||
TEXT_SPLITTER_NAME = "MySplitter"
|
TEXT_SPLITTER_NAME = "MySplitter"
|
||||||
```
|
```
|
||||||
|
|
||||||
完成上述步骤后,就能使用自己的分词器了。
|
完成上述步骤后,就能使用自己的分词器了。
|
||||||
|
|
||||||
### 如何贡献您的分词器
|
### 如何贡献您的分词器
|
||||||
|
|
||||||
1. 将您的分词器所在的代码文件放在```text_splitter```文件夹下,文件名为您的分词器名字,比如`my_splitter.py`,然后在`__init__.py`中导入您的分词器。
|
1. 将您的分词器所在的代码文件放在```text_splitter```文件夹下,文件名为您的分词器名字,比如`my_splitter.py`,然后在`__init__.py`中导入您的分词器。
|
||||||
2. 发起PR,并说明您的分词器面向的场景或者改进之处。我们非常期待您能举例一个具体的应用场景。
|
2. 发起PR,并说明您的分词器面向的场景或者改进之处。我们非常期待您能举例一个具体的应用场景。
|
||||||
3. 在Readme.md中添加您的分词器的使用方法和支持说明。
|
3. 在Readme.md中添加您的分词器的使用方法和支持说明。
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue