RasaGen: A Rasa chatbot training data generator
(中文版) | (English)
Installation
Install the latest version of RasaGen by running:
pip install rasa_gen
or install with source code:
pip install git+https://github.com/SchweitzerGAO/rasa-train-generator
Basic usage
An Example
Though the template in this example is in Chinese, It supports mainstream languages like English, French and Japanese etc.
from rasa_gen import NLUTemplate, Generator
if __name__ == '__main__':
sentence_template = [
'[{}](operation_set_temp)[{}]{{"entity":"value","role":"temperature"}}度',
'把[{}](operation_set_temp)[{}]{{"entity":"value","role":"temperature"}}度',
'空调[{}](operation_set_temp)[{}]{{"entity":"value","role":"temperature"}}度',
'把空调[{}](operation_set_temp)[{}]{{"entity":"value","role":"temperature"}}度',
]
word_template = [
'温度降低到', '温度升高到', '温度升高至', '温度降低至', '温度调整到', '温度调整至', '温度调到', '温度调至',
]
template = NLUTemplate().add_sentence(sentence_template)\
.add_word(word_template)\
.add_random_val(16, 30)
generator = Generator('test_intent').add_template(template)
generator.generate_from_template(50, './test_template.yml')
A detailed example is in example.py
Creating a NLUTemplate
As shown in the example,
you can create a NLU training data generating template by creating a NLUTemplate instance and add sentence,
word and random value to fill
in the template in a streaming way.
Using a Generator
- Create a
Generator
You can create a Generator instance
with specifying the name of the key of the training data.
For example,
you shall specify the name of intent
when generating data for an intent
or the name of lookup for a lookup table.
Note: If you are generating data from a csv or tsv file
with the name of lookup in the first column,
there is no need to specify
the name when creating a Generator
For now, only intent and lookup data types in nlu class are supported.
Other types like rule and story
will be supported in the future
- Generate data by a
Generator
There are 2 supported ways to generate data by a Generator
- From a template (Recommended for
intentdata)
You can add a Template instance by add_template method and generate the data by generate_from_template method.
- From a file (Recommended for
lookupdata)
There is no need to create Template instances.
Just specify the input file and output file
and use the generate_from_file method will be OK.
Coming Soon...
-
Generating
story,synonymandruledata -
The detailed document will be released soon.
Metadata
Release files for rasa-gen 0.0.3
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 | |
|---|---|---|---|---|
| rasa_gen-0.0.3.tar.gz | 9.3 kB | Without provenance | Details |
Release files / rasa_gen-0.0.3.tar.gz
| Download URL | rasa_gen-0.0.3.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e6181136ef4357f0fcbe8c4e5cf331cd78776141fbc6e331e48472ed2eadb73
|
|
BLAKE2b-256 checksum How to use checksums |
4896dc172d3a02bd547b7a06fd21b13417096cec30ed0724ac9f8882bf0d4f00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.8
|
Security for rasa-gen 0.0.3
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.