简单的 任务式 自然语言理解 工具
说明
支持中文语句的模版匹配。可以理解为,简单版本的百度unit或者科大讯飞的AIUI
对于,简单语句的自然语言理解也是很方便的。欢迎大家试用。
对于不喜欢调用API,喜欢在自己代码中嵌入的人是蛮好用的。
用例
```
from pmnlp.word import build_sentence_word_dict
from pmnlp.sentence import SentenceTplTrie
# 初始化,用于记录用户配置的词槽,以及语句的模版匹配。
user_word_dict = {'num': ['一杯', '两杯'], 'coffee': [
'拿铁', '拿铁咖啡'], 'common': [], 'phone': ['re\d+']}
sentent_intent_tpl = {
'coffee': '[common:0-4][num][common:0-10][coffee]'
}
# 建立模型
sentence_word_dict = build_sentence_word_dict(word_dict=user_word_dict)
test_tree = SentenceTplTrie(word_dict=sentence_word_dict)
test_tree.build(sentence_tpl_dict=sentent_intent_tpl, common_key='common')
# 理解用户输入
_, intent, result = test_tree.sep('我要一杯热啊啊啊啊啊啊拿铁咖啡',common_key='common')
if isinstance(intent, str):
print(intent, result)
else:
print(intent, result)
```
Metadata
Release files for pmnlp 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pmnlp-0.2.0.tar.gz | 5.1 kB | Without provenance | Details for pmnlp-0.2.0.tar.gz |
Release files / pmnlp-0.2.0.tar.gz
| Download URL | pmnlp-0.2.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25b7c17334ec66a866c0c7eb12f519ff40708246e072897696cd2e3f19a15c62
|
|
BLAKE2b-256 checksum How to use checksums |
1499f66f014450344251e68129a3753c6fcf31b1bda8170a6550676162612bb9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pmnlp 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.