<commit_before># Natural Language Understanding with Recime

Bring the natural language provider of choice with Recime as `npm` package. We have tested and recommend the following Natural Language providers:

  * [api.ai](https://api.ai)
  * [wit.ai](https://github.com/wit-ai/node-wit)
  * [IBM Watson](https://www.npmjs.com/package/watson-developer-cloud)

## Configuring `api.ai` with Recime

[api.ai](https://api.ai/) is a natural language understanding platform that makes it easy for developers \(and non-developers\) to design and integrate intelligent and sophisticated conversational user interfaces into mobile apps, web applications, devices, and bots.


In order to enable natural language processing using API.AI in Recime. Go to your `api.ai` console and copy the client access token:


  ![](console.png)


For more information on how to obtain access token, please checkout the API.AI documentation here:

[https://docs.api.ai/docs/key-concepts](https://docs.api.ai/docs/key-concepts)

Go to your bot folder and install the `apiai` module:

```
npm install --save apiai

```

Set the client access token (copied earlier) as a config var:


```
recime-cli config set SYSTEM_RECIME_APIAI_CLIENT_KEY=PASTE_YOUR_ACCESS_TOKEN_HERE

```

Once everything is set, you can extract entities from a given `text` input in the following way:

```
/*jshint esversion: 6 */

import APIAI from 'apiai';

export default class Bot {

  constructor(args){
       this.args = args;
       this.apiai = new APIAI(process.env.SYSTEM_RECIME_APIAI_CLIENT_KEY);
  }

  execute(){
      let text = this.args.text;

      return new Promise((resolve, reject)=>{
            let options = {
                  sessionId : this.args.sender
            };

            let request = this.apiai.textRequest(text, options);

            request.on("response", (response)=>{
                  let result = response.result;
                  // TODO://
            });

           request.on('error', (err)=>{
              reject(err)
           });

           request.end();
      });
    }
}

```

`api.ai` makes it really easy to define your entities and intents using their interactive console. As for example, we have defined the following intent for extracting city for a given user expression.


![](find_place.png)
<commit_msg>APIAI_CLIENT_KEY<commit_after># Natural Language Understanding with Recime

Bring the natural language provider of choice with Recime as `npm` package. We have tested and recommend the following Natural Language providers:

  * [api.ai](https://api.ai)
  * [wit.ai](https://github.com/wit-ai/node-wit)
  * [IBM Watson](https://www.npmjs.com/package/watson-developer-cloud)

## Configuring `api.ai` with Recime

[api.ai](https://api.ai/) is a natural language understanding platform that makes it easy for developers \(and non-developers\) to design and integrate intelligent and sophisticated conversational user interfaces into mobile apps, web applications, devices, and bots.


In order to enable natural language processing using API.AI in Recime. Go to your `api.ai` console and copy the client access token:


  ![](console.png)


For more information on how to obtain access token, please checkout the API.AI documentation here:

[https://docs.api.ai/docs/key-concepts](https://docs.api.ai/docs/key-concepts)

Go to your bot folder and install the `apiai` module:

```
npm install --save apiai

```

Set the client access token (copied earlier) as a config var:


```
recime-cli config set APIAI_CLIENT_KEY=PASTE_YOUR_ACCESS_TOKEN_HERE

```

Once everything is set, you can extract entities from a given `text` input in the following way:

```
/*jshint esversion: 6 */

import APIAI from 'apiai';

export default class Bot {

  constructor(args){
       this.args = args;
       this.apiai = new APIAI(process.env.APIAI_CLIENT_KEY);
  }

  execute(){
      let text = this.args.text;

      return new Promise((resolve, reject)=>{
            let options = {
                  sessionId : this.args.sender
            };

            let request = this.apiai.textRequest(text, options);

            request.on("response", (response)=>{
                  let result = response.result;
                  // TODO://
            });

           request.on('error', (err)=>{
              reject(err)
           });

           request.end();
      });
    }
}

```

`api.ai` makes it really easy to define your entities and intents using their interactive console. As for example, we have defined the following intent for extracting city for a given user expression.


![](find_place.png)

{'fraction_non_alphanumeric': 0.10626762090652787, 'fraction_numerical': 0.00043374539145521576, 'mean_word_length': 2.979292493528904, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 12, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3847523', 'n_tokens_mistral': 1365, 'n_tokens_neox': 1281, 'n_words': 460}