Add uie python example and doc (#221)

* add fastdeploy.text.UIEModel

* Add uie python example

* Add one schema for cpp demo

* Add ConvertUIEResultToDict for pretty the uie result in python

* remove default args for SchemaNode

* Add uie example args

* Add uie python api desc

* Add infer.py usage

* truncate some example output

* Add uie schema usage

* Add uie result md

* Add uie c++ api doc
This commit is contained in:
Jack Zhou
2022-09-15 06:06:40 +08:00
committed by GitHub
parent fb0a428c3c
commit 14ba9ce6c2
11 changed files with 760 additions and 33 deletions

View File

@@ -0,0 +1,7 @@
# 自然语言模型预测结果说明
FastDeploy根据自然语言模型的任务类型定义了不同的结构体来表达模型预测结果具体如下表所示
| 结构体 | 文档 | 说明 | 相应模型 |
| :----- | :--- | :---- | :------- |
| UIEResult | [C++/Python文档](./uie_result.md) | UIE模型返回结果 | UIE模型 |

View File

@@ -0,0 +1,34 @@
# UIEResult 图像分类结果
UIEResult代码定义在`fastdeploy/text/uie/model.h`用于表明UIE模型抽取结果和置信度。
## C++ 定义
`fastdeploy::text::UIEResult`
```c++
struct UIEResult {
size_t start_;
size_t end_;
double probability_;
std::string text_;
std::unordered_map<std::string, std::vector<UIEResult>> relation_;
std::string Str() const;
};
```
- **start_**: 成员变量表示抽取结果text_在原文本Unicode编码中的起始位置。
- **end**: 成员变量表示抽取结果text_在原文本Unicode编码中的结束位置。
- **text_**: 成员函数表示抽取的结果以UTF-8编码方式保存。
- **relation_**: 成员函数,表示当前结果关联的结果。常用于关系抽取。
- **Str()**: 成员函数将结构体中的信息以字符串形式输出用于Debug
## Python 定义
`fastdeploy.text.C.UIEResult`
- **start_**(int): 成员变量表示抽取结果text_在原文本Unicode编码中的起始位置。
- **end**(int): 成员变量表示抽取结果text_在原文本Unicode编码中的结束位置。
- **text_**(str): 成员函数表示抽取的结果以UTF-8编码方式保存。
- **relation_**(dict(str, list(fastdeploy.text.C.UIEResult))): 成员函数,表示当前结果关联的结果。常用于关系抽取。
- **get_dict()**: 以dict形式返回fastdeploy.text.C.UIEResult。