Comments (4)
Hi @gauravbrills,
Yes, you can use it from javascript (node or browsers). You should just be able to require the adapter you want to use. chatito/dist/adapters/rasa
here is an example of how the IDE uses the adapters programatically:
https://github.com/rodrigopivi/Chatito/blob/master/web/components/Editor/Editor.tsx#L448
Let me know if that worked
from chatito.
HI @rodrigopivi actually I wanted to be able to generate the chatitio dsl file programatically by which I mean generated the DSL code in the file via code and then subsequently generate the data sets from ui .
from chatito.
Don't see what is the blocker, you should be able to just generate the text template programatically. Alternatively, instead of passing a string, you can also pass a JS object (the AST). Currently, chatito uses PEG.js to parse the plain text and form an abstract representation of what is inside the text.
This abstract representation is just a js object you can also construct manually, and then pass to the generator:
just call this method with a valid AST object, that implementts the IChatitoEntityAST interface.
You can create an object that implements this interface:
https://github.com/rodrigopivi/Chatito/blob/master/src/types.ts#L22
And then pass that object to this generator function:
https://github.com/rodrigopivi/Chatito/blob/master/src/main.ts#L144
For example, this DSL:
%[hi]('training': '1')
~[greet?] @[name] ~[all good]
@[name]
~[gauravbrills]
Will generate this AST:
[
{
"type": "IntentDefinition",
"key": "hi",
"args": {
"training": "1"
},
"location": {
"start": {
"offset": 0,
"line": 1,
"column": 1
},
"end": {
"offset": 22,
"line": 1,
"column": 23
}
},
"inner": [
[
{
"value": "greet",
"type": "Alias",
"opt": true
},
{
"value": " ",
"type": "Text"
},
{
"value": "name",
"type": "Slot",
"opt": false,
"location": {
"start": {
"offset": 37,
"line": 2,
"column": 15
},
"end": {
"offset": 44,
"line": 2,
"column": 22
}
},
"variation": null
},
{
"value": " ",
"type": "Text"
},
{
"value": "all good",
"type": "Alias",
"opt": false
}
]
]
},
{
"type": "SlotDefinition",
"key": "name",
"args": null,
"location": {
"start": {
"offset": 58,
"line": 4,
"column": 1
},
"end": {
"offset": 65,
"line": 4,
"column": 8
}
},
"inner": [
[
{
"value": "gauravbrills",
"type": "Alias",
"opt": false
}
]
],
"variation": null
}
]
Not sure what if this is kind of the programatic interface you are trying to hook to. Note: you should be able to just skip passing the 'location' attribute since its only used for error reporting when the dsl was incorrect, this way you can just extend aliases or sentences by adding a new item in the corresponding object array for that entity, i have not removed the location attribute in the example to show the actual AST generated, but you can do it to make the object smaller and easier to understand
from chatito.
@rodrigopivi Thanks for the application got it 👍
from chatito.
Related Issues (20)
- relex
- Unhandled crash when generating testing data HOT 3
- Online ide HOT 2
- Optional slots HOT 1
- [BUG] Slot regression between v2.1.5 and v.2.2.1 HOT 5
- Import failing HOT 2
- Weighted probability HOT 10
- Snips NLU output format error HOT 1
- 数据量太大,然后速度太慢了 HOT 2
- How can I add previous generated json file with new examples? HOT 1
- How can I add Number? HOT 1
- "Can't generate X examples" warning doesn't say which intent it is referring to HOT 2
- How to use Chatito in angularjs HOT 1
- Training/Testing Number Via Cli? HOT 2
- how to use regex_features? HOT 1
- Downloading dsl files? HOT 1
- How to start Chatito on local host HOT 1
- I got JavaScript heap out of memory when training HOT 1
- How to determine whether happened over-fit?
- Save entities for test HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chatito.