Skip to main content

Applying pipeline “tensorflow_embedding” of Rasa NLU


According to this nice article, there was a new pipeline released using a different approach from the standard one (spacy_sklearn). I wanted to give it a try to see whether it can help with improving bot’s accuracy.

After applying done, I gave an evaluation of “tensorflow_embedding”. It seemed to work better a bit. For example, I defined intents “greet” and “goodbye” with some following messages in my training data.

## intent:greet
- Hey! How are you?
- Hi! How can I help you?
- Good to see you!
- Nice to see you!
- Hi
- Hello
- Hi there

## intent:goodbye
- Bye
- Bye Bye
- See you later
- Take care
- Peace

In order to play around with Rasa NLU, I created a project here. You can have a look at this change from this pull request. Yay!

When I entered message “hi bot”, then bot with “tensorflow_embedding” could detect intent “greet” with better confidence scores rather than bot with “spacy_sklearn”. The following are responses after executing curl -X POST localhost:5000/parse -d '{"q": "Hi bot", "project": "ctraubot", "model": "nlu"}' | python -m json.tool
A response of bot with pipeline spacy_sklearn
{

"intent": {

"name": "greet",

"confidence": 0.8687479112327237

},

"entities": [],

"intent_ranking": [

{

"name": "greet",

"confidence": 0.8687479112327237

},

{

"name": "goodbye",

"confidence": 0.13125208876727643

}

],

"text": "Hi bot",

"project": "ctraubot",

"model": "nlu"

}
A response of bot with pipeline tensorflow_embedding
{

"intent": {

"name": "greet",

"confidence": 0.9777982831001282

},

"entities": [],

"intent_ranking": [

{

"name": "greet",

"confidence": 0.9777982831001282

},

{

"name": "goodbye",

"confidence": -0.08299092948436737

}

],

"text": "Hi bot",

"project": "ctraubot",

"model": "nlu"

}
By the way, I still need modules spacy and sklearn for a further usage of entity extraction.

Comments

Popular posts from this blog

Creating a Chatbot with RiveScript in Java

Motivation"Artificial Intelligence (AI) is considered a major innovation that could disrupt many things. Some people even compare it to the Internet. A large investor firm predicted that some AI startups could become the next Apple, Google or Amazon within five years"
- Prof. John Vu, Carnegie Mellon University.

Using chatbots to support our daily tasks is super useful and interesting. In fact, "Jenkins CI, Jira Cloud, and Bitbucket" have been becoming must-have apps in Slack of my team these days.

There are some existing approaches for chatbots including pattern matching, algorithms, and neutral networks. RiveScript is a scripting language using "pattern matching" as a simple and powerful approach for building up a Chabot.
Architecture Actually, it was flexible to choose a programming language for the used Rivescript interpreter like Java, Go, Javascript, Python, and Perl. I went with Java.


Used Technologies and ToolsOracle JDK 1.8.0_151Apache Maven 3.5…

AngularJS - Build a custom validation directive for using multiple emails in textarea

AngularJS already supports the built-in validation with text input with type email. Something simple likes the following:
<input name="input" ng-model="email.text" required="" type="email" /> <span class="error" ng-show="myForm.input.$error.email"> Not valid email!</span>
However, I used a text area and I wanted to enter some email addresses that's saparated by a comma (,). I had a short research and it looked like AngualarJS has not supported this functionality so far. Therefore, I needed to build a custom directive that I could add my own validation functions. My validation was done only on client side, so I used the $validators object.

Note that, there is the $asyncValidators object which handles asynchronous validation, such as making an $http request to the backend.

This is just my implementation on my project. In order to understand that, I supposed you already had experiences with Angular…

Only allow input number value with autoNumeric.js

autoNumeric is a jQuery plugin that automatically formats currency and numbers as you type on form inputs. I used autoNumeric 1.9.21 for demo code.

1. Dowload autoNumeric.js file from https://github.com/BobKnothe/autoNumeric
2. Import to project
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type="text/javascript" src="js/autoNumeric.js"></script> 3. Define a function to use it
<script type="text/javascript"> /* only number is accepted */ function txtNumberOnly_Mask() { var inputOrgNumber = $("#numberTxt"); inputOrgNumber.each(function() { $(this).autoNumeric({ aSep : '', aDec: '.', vMin : '0.00' }); }); } </script>
4. Call the function by event
<form> <input type="text" value="" id="numberTxt"/>(only number) </form> <script type="te…

[Snippet] CSS - Child element overlap parent

I searched from somewhere and found that a lot of people says a basic concept for implementing this feature looks like below:
HTML code:
<div id="parent">  <div id="child">  </div> </div> And, CSS:
#parent{   position: relative;   overflow:hidden; } #child{   position: absolute;   top: -1;   right: -1px; }
However, I had a lot of grand-parents in my case and the above code didn't work. Therefore, I needed an alternative. I presumed that my app uses Boostrap and AngularJs, maybe some CSS from them affects mine. I didn't know exactly the problem, but I believed when all CSS is loaded into my browser, I could completely handle it.

www.tom-collinson.com

I tried to create an example to investigated this problem by Fiddle. Accidentally, I just changed: position: parent; to position: static; for one of parents -> the problem is solved.
Look at my code:

<div class="modal-body dn-placeholder-parent-position"> <div clas…