Skip to content

Commit

Permalink
v2.0.0 (#3)
Browse files Browse the repository at this point in the history
* Refactored python and javascript implementations to make them more equal
* Add Rasa NLU support
* Add optional synonyms support in intents definition
  • Loading branch information
YuukanOO authored Jul 31, 2019
1 parent f0744f0 commit e165bfc
Show file tree
Hide file tree
Showing 52 changed files with 5,292 additions and 1,648 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
dist: xenial
language: python
python:
- "3.6"
- "3.7"
install:
- pip install codecov nosexcover
- cd python
Expand Down
98 changes: 44 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,67 @@
chatl [![Build Status](https://travis-ci.org/atlassistant/chatl.svg?branch=master)](https://travis-ci.org/atlassistant/chatl) [![codecov](https://codecov.io/gh/atlassistant/chatl/branch/master/graph/badge.svg)](https://codecov.io/gh/atlassistant/chatl) [![npm version](https://badge.fury.io/js/chatl.svg)](https://badge.fury.io/js/chatl) [![pypi version](https://badge.fury.io/py/pychatl.svg)](https://badge.fury.io/py/pychatl) ![License](https://img.shields.io/badge/License-MIT-blue.svg)
===

Tiny DSL used to generates training dataset for NLU engines (currently `snips-nlu`). Heavily inspired by [chatito](https://github.com/rodrigopivi/Chatito).
Tiny DSL used to generates training dataset for NLU engines (currently `snips-nlu` and `rasa nlu`). Heavily inspired by [chatito](https://github.com/rodrigopivi/Chatito).

## DSL specifications

```
# chatl is really easy to understand.
#
# You can defines:
# - Intents
# - Entities (with or without variants)
# - Synonyms
# - Comments (only at the top level)
# Inside an intent, you got training data.
# Training data can refer to one or more entities and/or synonyms, they will be used
# by generators to generate all possible permutations and training samples.
%[my_intent]
~[greet] some training data @[date]
another training data that uses an @[entity] at @[date#with_variant]
# The chatl syntax is easy to understand.
# With the `%` symbol, you define intents. Intent data can contains entity references
# with the `@` and optional (using `?` as a suffix) synonyms with `~`.
# Synonyms here will be used to generate variations of the given sentence.
%[get_weather]
~[greet?] what's the weather like in @[city] @[date]
~[greet] will it rain in @[city] at @[date#hour]
# With the `~`, you define synonyms used in intents and entities definitions.
~[greet]
hi
hello
# Entities contains available samples and could refer to a synonym.
@[entity]
some value
other value
~[a synonym]
# Synonyms contains only raw values
~[a synonym]
possible synonym
another one
# Entities and intents can define arbitrary properties that will be made available
# to generators.
# For snips, `type`, `extensible` and `strictness` are used for example.
# If the type value could not be found in the entities declaration, it will assume its a builtin one
# and on snips, it will prepend the 'snips/' automatically
@[date](type=datetime)
hey
~[new york]
ny
nyc
the big apple
# With the `@`, you define entities.
@[city]
paris
rouen
~[new york]
# You can define properties on intents, entities and synonyms.
# Depending on the dataset you want to generate, some props may be used
# by the adapter to convey specific meanings.
@[date](type=datetime, another=`property backticked`)
tomorrow
today
# Variants is used only to generate training sample with specific values that should
# maps to the same entity name, here `date`. Props will be merged with the root entity.
this weekend
this evening
@[date#with_variant]
the end of the day
nine o clock
twenty past five
# You can define entity variants with the `#` symbol. Variants will be merge with
# the entity it references but is used to provide different values when
# generating intent sentences.
@[date#hour]
ten o'clock
noon
```

## Adapters

For now, only the [snips adapter](https://github.com/snipsco/snips-nlu) has been done. Here is a list of adapters and their respective properties:
For now, only the [snips adapter](https://github.com/snipsco/snips-nlu) and [rasa nlu](https://github.com/RasaHQ/rasa) has been done. Here is a list of adapters and their respective properties:

| adapter | snips |
|----------------|-------|
| type (1) | ✔️ |
| extensible (2) | ✔️ |
| strictness (3) | ✔️ |
| adapter | snips | rasa |
|----------------|-------|------|
| type (1) | ✔️ | ✔️ |
| extensible (2) | ✔️ ||
| strictness (3) | ✔️ ||
| regex (4) | ️️❌️ | ✔️ |

1. Specific type of the entity to use (such as datetime, temperature and so on), if the given entity name could not be found in the chatl declaration, it will assume its a builtin one (supported types are related to snips and [listed here](https://github.com/snipsco/snips-nlu-ontology#supported-builtin-entities) without the `snips/` prefix)
1. Specific type of the entity to use (such as datetime, temperature and so on). For `snips`, if the given entity name could not be found in the chatl declaration, it will assume its a builtin one (supported types are [listed here](https://github.com/snipsco/snips-nlu-ontology#supported-builtin-entities) without the `snips/` prefix). For `rasa`, it will use the referenced type as the slot name.
2. Are values outside of training samples allowed?
3. Parser threshold
4. Regex pattern used to help the NLU to extract stuff

## Installation

Expand Down
93 changes: 63 additions & 30 deletions docs/bundle.js

Large diffs are not rendered by default.

90 changes: 43 additions & 47 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"start": "webpack-dev-server"
},
"dependencies": {
"lodash": "^4.17.11",
"lodash": "^4.17.15",
"monaco-editor": "^0.14.2",
"vue": "^2.5.16"
},
Expand Down
Loading

0 comments on commit e165bfc

Please sign in to comment.