botbuilder-tools/packages/Ludown
Chris McConnell 278155eb71
Merge pull request #1116 from microsoft/chrimc/luis
Update to support roles.
2019-06-27 12:12:53 -07:00
..
ChitChat
bin
docs Merge pull request #1116 from microsoft/chrimc/luis 2019-06-27 12:12:53 -07:00
examples Tomlm/fixurl (#1076) 2019-04-20 13:04:02 -07:00
lib Fix for refresh losing interchangeable 2019-06-26 13:10:01 -07:00
test updating tests 2019-06-26 14:12:07 -07:00
.gitignore
README.MD Minor fix to code sample in README (#1174) 2019-06-26 15:21:01 -07:00
package-lock.json Roll js package versions to be 1 higher than their release versions. 2019-06-11 15:40:50 -07:00
package.json Roll js package versions to be 1 higher than their release versions. 2019-06-11 15:40:50 -07:00

README.MD

LUDown

npm version

.lu files help describe language understanding components for your bot. LUDown is a command line tool that helps convert .lu file(s) into JSON files that you can then use to create your LUIS app or QnAMaker knowledge base.

Language Understanding (LUIS.ai) allows your application to understand what a person wants in their own words. LUIS uses machine learning to allow developers to build applications that can receive user input in natural language and extract meaning from it.

QnA Maker enables you to go from FAQ to bot in minutes. With QnA Maker you can build, train and publish a simple question and answer bot based on FAQ URLs, structured documents or editorial content in minutes.

The .lu file and the LUDown tool serve several use cases:

  • Quick, simple and easy way to bootstrap language understanding for your bot.
  • Describe intents, entities, utterances and patterns for your bot in simple markdown documents.
  • The language understanding definition for your bot lives with the rest of your code. You can use other CLI tools like luis to create a new LUIS app using the .lu files.
  • Group language understanding documents by language and locale to easily manage localization.
  • Define question and answer pairs for your bot.
  • Works in conjunction with other Microsoft Bot Builder tools, like LUIS CLI and QnAMaker CLI.

Prerequisite

Installation

To install:

npm i -g ludown

Checkout the examples folder for example .lu files.

Also see the here to add Small talk/ chit-chat capabilities to your bot.

Docs

Use ludown as a library

Ludown can be used within a Node.js application as an imported library. Install locally:

npm install ludown --save

In your node project:

const ludown = require('ludown');
const luContent1 = `# Greeting
- hi`;
const log = false;
const locale = 'en-us';
ludown.parser.parseFile(luContent1, log, locale)
    .then(function(parsedContent) {
        // Parsed LUIS object
        console.log(JSON.stringify(parsedContent.LUISJsonStructure, 2, null));
        // Parsed QnA content
        console.log(JSON.stringify(parsedContent.qnaJsonStructure, 2, null));
        // Additional files to parse
        console.log(JSON.stringify(parsedContent.additionalFilesToParse, 2, null));
    })
    .catch(function(err) {
        let errObj = new ludown.helperClasses.exception(err);
        // err is of type ludown.helperClasses.exception. 
        // Possible error codes are available under ludown.helperEnums.errorCodes
        if(errObj.errCode === ludown.helperEnums.errorCodes.INVALID_INPUT) {
            // do something specific to this error code
        } else {
            console.log(errObj.text);
        }
    })

Check out the full reference here

Nightly builds

Nightly builds are based on the latest development code which means they may or may not be stable and probably won't be documented. These builds are better suited for more experienced users and developers although everyone is welcome to give them a shot and provide feedback.

You can get the latest nightly build of Ludown from the BotBuilder MyGet feed. To install the nightly -

npm config set registry https://botbuilder.myget.org/F/botbuilder-tools-daily/npm/

Install using npm:

npm i -g ludown

To reset registry:

npm config set registry https://registry.npmjs.org/