Giter Site home page Giter Site logo

microsoft / universal-language-intelligence-service Goto Github PK

View Code? Open in Web Editor NEW
17.0 15.0 13.0 16 KB

A wrapper for the microsoft luis cognitive that provides universal language support (after training) using the translate cognitive service

Home Page: https://www.microsoft.com/developerblog/real-life-code/2017/01/15/Universal-Langauge-Intent-and-Entity-Extraction.html

License: MIT License

JavaScript 100.00%

universal-language-intelligence-service's Introduction

Universal Language Intelligence Service

A wrapper for the Microsoft LUIS cognitive that provides universal language support (after training) using the bing translate api

The .NET port can be found here: ULIS.NET

Pre-Requisites

  • LUIS Account
  • Bing Translate Key
  • Add keys to the configuration file

Installation

$ npm install ulis

To Train Language Model (See Provided Hebrew Example)

  1. Upload natural language samples to LUIS using either the testTrainBot or the Batch insertion tool
  2. Tag translation intents and entities

To Use

var ulis = require('ulis');

//Setup ulisClient using client id and secret
var ulisClient = new ulis.getClient({
    lang:'he',
    bingTranslate_clientId: 'TRANSLATE_CLIENT_ID',
    bingTranslate_secret: 'TRANSLATE_CLIENT_SECRET',
    luisURL: 'LUIS_ENDPOINT'
});

//Or setup ulisClient using translate api_key from azure portal
var ulisClient = new ulis.getClient({
    lang:'he',
    bingTranslate_api_key:'TRANSLATE_API_KEY',
    luisURL: 'LUIS_ENDPOINT'
});

//Make a query
 ulisClient.query('אפשר לקבוע תור למחר', (err, ulisRes) => {
    if (err) return console.log(err.message);       
    console.log(`Translated As: " ${ulisRes.translatedText} "\n\nLUIS Intent: " ${ulisRes.intent} " \n\nLUIS Entities \n\n"  ${JSON.stringify(ulisRes.entities)}`);
});

Optionally, you can specify the format of the text being translated. The supported formats are text/plain (default) and text/html. It is also possible to execute a function on the translated text before it is sent to LUIS. This is especially helpful if you want to exclude content from translation, see http://docs.microsofttranslator.com/text-translate.html#excluding-content-from-translation.

Example:

var ulisClient = new ulis.getClient({
    lang:'he',
    bingTranslate_api_key:'TRANSLATE_API_KEY',
    luisURL: 'LUIS_ENDPOINT',

    // set the format
    contentType: 'text/html',

    // pass a function that is applied to the translated text and removes the HTML
    // from text enclosed with <div class="notranslate">text<\/div>
    replaceInTranslation: text => text.replace(/<div class="notranslate">(.*?)<\/div>/g, ' $1')
});

universal-language-intelligence-service's People

Contributors

aribornstein avatar peterbozso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.