MMIR (Mobile Multimodal Interaction and Relay) library
npm install mmir-lib[mmir-lib][0]
========





Source Code for the [mmir][5] (Mobile Multimodal Interaction and Relay)* library
The mmir framework provides means for creating _minimal_ (client-based)
_dialog systems_ for multimodal interactions:
* state-based interaction handling using SCXML (e.g. for touch/click, speech, gesture interactions)
* support and plugins for several speech input (Automatic Speech Recognition, ASR) engines
* support and plugins for several speech output/synthesis (Text To Speech, TTS) engines
* support for client- or sever-based NLU processing
* built-in support for grammars (similar to [BNF grammars][13])
__Overview:__
- Install
- API Documentation
- Examples
- Pre-Building Grammars, State Machines etc.
- Include in Web Page
- Node.js
- Node.js and WebWorker
- Additional Notes
- Used Libraries
- License
----
/lib directory in your assets
npm / package.json
npm registry:
bash
npm install mmir-lib
`
* install master branch via GitHub repository:
`bash
npm install git+https://github.com/mmig/mmir-lib.git
`
* see [mmir-tooling][3] and [mmir-wepack][4] for more options
API Documentation
The API documentation is available at [/docs][6] (md format) or in [HTML format][7]
(more details are available in [jsdoc-generated API documentation][8], and further details at [github.com/mmig/mmir][5]).
Examples
For examples, see the [mmir-starter-kit][1] or [mmir-starter-ionic][2].
Pre-Building Grammars, State Machines etc.
* Prerequesites: Node.js
Some resources (e.g. grammars, state machines) can be built/compiled before they
are used in the application at runtime.
Note that most of these resources can be compiled during runtime too (as in case
of grammars and state machines).
Compiling/building these resources is supported e.g. via the [mmir-tooling][3] project.
In addition, the [mmir-wepack][4] integration provides special support
for including mmir in webpack-based/-built applications.
Include in Web Page
The following shows an example of including mmir-lib in a web page "as-is", i.e. without
any build-system (like webpack).
mmir-lib includes requirejs for (async) lazy-loading its sub-modules.
* include /lib as directory /mmirf in your web resources directory, e.g. /www/mmirf
_(e.g. use [mmirinstall][12] script of mmir-tooling: mmirinstall www/mmirf)_
* load/include mmir in HTML page
`html
`
* use mmir in JavaScript code (after it's been initialized)
`javascript
mmir.ready(function(){
...
})
`
Node.js
install via npm
`bash
npm instal mmir-lib
`
initialize and include in JavaScript code:
`javascript
var mmirLib = require('mmir-lib');
//optional: run some configuration before starting to initialize mmir
var preInitFunc = function(mmir){
//... some custom configuration for mmir before loading the library
};
//init should only be called once:
var mmir = mmirLib.init(preInitFunc);
mmir.ready(function(){
...
});
`
$3
For some functionality (e.g. async-compiling grammars, state-manager event processing), mmir uses WebWorkers.
While most of the these functionalities do have fallback implementations, they
may not always provide the same functionality, and run less efficiently.
mmir can use the following WebWorker implementations as drop-ins for
HTML5 WebWorkers when running in node:
* built-in node module worker_threads (recommended):
* since version 10.5.0 available as _experimental_ feature:
use/enable by running node with command-line argument --experimental-worker, e.g.
`bash
# when using node directly
node --experimental-worker ...
# when using npm
npm --node-options --experimental-worker ...
# set as node env variable (*nix)
export NODE_OPTIONS=$NODE_OPTIONS --experimental-worker
# set as node env variable (Windows)
set NODE_OPTIONS=%NODE_OPTIONS% --experimental-worker
# add entry in npm configuration file .npmrc:
#node-options = --experimental-worker
`
* since node version 11.x worker_threads is enabled by default
* alternative module webworker-threads with version >= 0.8.x
* NOTE not everything may work using this package (if possible use worker_threads)
* [worker_threads at npm][10]: current version is !npm
* [worker_threads on github][11]: current version is !GitHub package.json version
Additional Notes
More details, further documentation etc. are available on the [mmir][5] project page.
See also the [tools project][3] for scripts, resources etc. for compiling and
generating resources (e.g. for compiling JSON grammar files from the application's
config/languages/[language code]/ directories into JavaScript files).
NOTE: Integration with / loading of Cordova is designed to work with the
_build process_ of Cordova 5 or later (see [mmir-tooling][3] and
[cordova example project][9] for integration / tooling of the mmir
framework in combination with Cordova 5 and later versions).
----
Used Libraries
(see contents of /vendor/libs/`)