💬 A language model abstraction layer that works across NLU providers
Learn more about the Jovo Model format here: jovo.tech/docs/model
$ npm install jovo-model
The Jovo Model supports the following NLU providers (see the packages
folder)
- Amazon Alexa (built-in NLU)
- Amazon Lex
- Dialogflow
- Microsoft LUIS
- Rasa NLU
Each platform implements the following methods of the jovo-model
core package:
/**
* Converts native model files to JovoModel
*
* @param {NativeFileInformation[]} inputFiles The files in the native format
* @param {string} locale The locale of the files
* @returns {JovoModelData}
* @memberof JovoModel
*/
static toJovoModel(inputFiles: NativeFileInformation[], locale: string): JovoModelData {
// ...
}
/**
* Converts JovoModel to native model files
*
* @param {JovoModel} model The JovoModel to convert
* @param {string} locale The locale of the JovoModel
* @returns {NativeFileInformation[]}
* @memberof JovoModel
*/
static fromJovoModel(model: JovoModelData, locale: string): NativeFileInformation[] {
// ...
}
With the help of the Jovo Model it is easily possible to convert the data from one Language-Model to another.
import { NativeFileInformation } from 'jovo-model';
import { JovoModelAlexa } from 'jovo-model-alexa';
const jovoModelInstance = new JovoModelAlexa();
const jovoModelData = '...';
const locale = 'en-US';
jovoModelInstance.importJovoModel(jovoModelData, locale);
const alexaModelFiles = jovoModelInstance.exportNative();
import { NativeFileInformation } from 'jovo-model';
import { JovoModelAlexa } from 'jovo-model-alexa';
const jovoModelInstance = new JovoModelAlexa();
const alexaModelFiles: NativeFileInformation = [
{
path: [
'fileName.json',
],
content: '...',
}
];
const locale = 'en-US';
jovoModelInstance.importNative(alexaModelFiles, locale);
const jovoModelData = jovoModelInstance.exportJovoModel();
import { NativeFileInformation } from 'jovo-model';
import { JovoModelAlexa } from 'jovo-model-alexa';
import { JovoModelDialogflow } from 'jovo-model-dialogflow';
const locale = 'en-US';
// Convert Alexa Model -> Jovo Model
const jovoModelInstanceAlexa = new JovoModelAlexa();
const alexaModelFiles: NativeFileInformation = [
{
path: [
'fileName.json',
],
content: '...',
}
];
jovoModelInstanceAlexa.importNative(alexaModelFiles, locale);
const jovoModelData = jovoModelInstanceAlexa.exportJovoModel();
// Convert Jovo Model -> Dialogflow Model
const jovoModelInstanceDialogflow = new JovoModelDialogflow();
jovoModelInstance.importJovoModel(jovoModelData, locale);
const dialogflowModelFiles = jovoModelInstance.exportNative();
The Jovo Model also allows to easily extract, manipulate and delete data.
For a full list of methods check: JovoModel.ts
import { NativeFileInformation } from 'jovo-model';
import { JovoModelDialogflow } from 'jovo-model-dialogflow';
// Load the data into the Jovo-Model
const jovoModelInstance = new JovoModelDialogflow();
const alexaModelFiles: NativeFileInformation = [
{
path: [
'fileName.json',
],
content: '...',
}
];
const locale = 'en-US';
jovoModelInstance.importNative(alexaModelFiles, locale);
const intent = jovoModelInstance.getIntentByName('MyNameIntent');
const phrases = jovoModelInstance.getPhrases(intent);
jovoModelInstance.removeIntent(intent);
// Export updated model
// As Jovo Model
const jovoModelData = jovoModelInstanceAlexa.exportJovoModel();
// As Dialogflow Model
const dialogflowModelFiles = jovoModelInstance.exportNative();