API AI Recognise Infinitely varying reference - chatbot

My Issue
Im currently working with API.AI for an chat bot system. Im coming up against an issue where I need to be able to recognise a booking reference in a string of text.The problem that I am having is that this booking reference has no real pattern to it, they are generated at random. But are always 5 chars long, for example ABC12.
Current Attempt
I've given API.AI examples (as an entity) of how these can look, and have switched on Automated Expansion. In my intent I have then given examples of how a user may structure these for example 'My booking reference is ABC12' and denoted where the booking reference can be found.
How ever many examples I give it just doesn't seem to recognise this. Have I done something wrong / am I missing something?
Any help would be much appreciated.

Related

Create custom Google Smart Home Action

I have a Google Nest Hub Max and I want to increase its capabilities for a custom need:
"Hey Google, add xyz to my work planning"
Then I want to make an HTTP call to my private server
The private server returns a text
The text is displayed in the Google Nest Hub Max screen + speak-out.
How can that be achieved?
Originally I thought that this will not be difficult. I've imagined a NodeJs, Java, Python or whatever framework where Google gives me the xyz text and I can do my thing and return a simple text. And obviously, Google will handle the intent matching and only call my custom code when users say the precise phrase.
I've tried to search for how to do it online, but there is a lot of documentation everywhere. This post resumes quite well the situation, but I've never found a tutorial or hello world example of such a thing.
Does anyone know how to do it?
For steps 2. and 3., I don't necessarily need to use a private server, if I can achieve what the private server does inside the Smart Home Action code, mostly some basic Python code.
First - you're on the right track! There are a few assumptions and terminology issues in your question that we need to clear up first, but your idea is fundamentally sound:
Google uses the term "Smart Home Actions" to describe controlling IoT/smart home devices such as lights, appliances, outlets, etc. Making something that you control through the Assistant, including Smart Speakers and Smart Hubs, means building a Conversational Action.
Most Conversational Actions need to be invoked by name. So you would start your action with something like "Talk to Work Planning" or "Ask Work Planning to add XYZ'. There are a limited, but growing, number of built in intents (BIIs) to cover other verticals - but don't count on them right now.
All Actions are public. They all share an invocation name namespace and anyone can access them. You can add Account Linking or other ways to ensure a limited audience, and there are ways to have more private alpha and beta testing, but there are issues with both. (Consider this an opportunity!)
You're correct that Google will help you with parsing the Intent and getting the parameter values (the XYZ in your example) and then handing this over to your server. However, the server must be at a publicly accessible address with an HTTPS endpoint. (Google refers to this as a webhook.)
There are a number of resources available, via Google, StackOverflow, and elsewhere:
On StackOverflow, look for the actions-on-google tag. Frequently, conversational actions are either built with dialogflow-es or, more recently, actions-builder which each have their own tags. (And don't forget that when you post your own questions to make sure you provide code, errors, screen shots, and as much other information as you can to help us help you overcome the issues.)
Google's documentation about how to design and build conversational actions.
Google also has codelabs and sample code illustrating how to build conversational actions. The codelabs include the "hello world" examples you are probably looking for.
Most sample code uses JavaScript with node.js, since Google provides a library for it. If you want to use python, you'll need the JSON format that the Assistant will send to your webhook and that it expects back in response.
There are articles and videos written about it. For example, this series of blog posts discussing designing and developing actions outlines the steps and shows the code. And this YouTube playlist takes you through the process step-by-step (and there are other videos covering other details if you want more).

Can MATLAB retrieve online data?

I have a final project due soon and am having to create a building calculator GUI.
Inputs will be
number of floors
number of bathrooms, and
square footage
The output shall be the cost in materials to build the home.
One of my goals (which I was told by my TA was doable, then he seemed to not know much about after I went more in depth later) was to automatically update the cost of each material from a website such as Home Depot's each time the GUI is run. Building material costs change frequently so I wanted to assign each material its own cost value that is updated automatically from HD's website. Is this something that is possible?
I appreciate any input.
RockPrice = urlread('http://www.homedepot.com/p/SHEETROCK-UltraLight-1-2-in-x-4-ft-x-8-ft-Gypsum-Board-14113411708/202530243','Get',{'displayPrice','urlread'})
For getting a webpage's content (including all markup), urlread can be used. Parsing that string for the data you want ('scraping' it, as some like to call this process) might be non-trivial in MATLAB, though.
Easier to handle would be data from a dedicated API, and Home Depot seems to actually have a REST API that has their product details. All their public APIs seem to still be in private beta, though, so I don't know how successful one would be in requesting an API key.

IM (Instant Message) Address Standard

Dear stack overflowers,
I am not sure if this is the best place for this question, but I figured I'd give it a shot.
I am currently working on an API that will allow consumers to read/write data about users. i.e. name, emails, phoneNumbers, etc. And, as you could guess by the title, I am also storing ims.
Since users may contain multiple im addresses that belong to different services (e.g. skype, google talk, AIM, etc.), there is a type attribute associated with each im address.
I am at the point where I am attempting to validate the user attributes, and when I arrived to ims I was unable to find a formal specification, or normative document that dictates how these should be formatted/validated.
My question is the following:
Is there a general format that im URI's follow?
*note:*I have stumbled upon RFC 3861 that touches on im addresses. But it seems like this isn't a standard. Additionally, there is only one example here that has the following format:
im:fred#example.com
Since emails are effectively unique identifiers, it seems reasonable that they could be represented in this way.
Could anyone shed light on this?
After looking in several sites, I was unable to find a standard that applies to all IM providers. I even looked in some API documentation (Yahoo and Jabber) without any luck. If anyone else finds anything that leads them to think any different, please share the knowledge. But as for right now, it appears I am out of luck...

Concurrently filling in drupal forms on different computers mixes up form_state data of the different computers

I'm having a very difficult problem atm, one that I can not explain... at all. I really hope someone here may be able to shed some light on this predicament.
On my website I have a self-developed module that displays some kind of registration form. The registration form consists of different parts:
Personal information
Educational Information
Linguistic Skills
Local/Exchange Specific information
Some optional additional remarks.
Using AHAH and the AHAH Helper module I have created (read: programmed) this form to be 'multipage'. It has the header on top describing what part of the total registration you are currently in, and which parts you have yet to complete. You have a previous/next button to navigate between the different pages of the form.
This is all controlled by AHAH, and I keep track of the pages using a hidden form element with a default value 'current_page'. Anyway that is kind of besides the point.
The important part of the above explanation is that the data of all the different parts persists through the different pages by using the form_state variable. AHAH Helper keeps the previous values entered in the form saved in the 'storage' of the form_state.
Now some of the users seem to be experiencing the following problem upon registering:
While they are filling in their information, and some AHAH call is triggered in the form (e.g.: Pressing the next button, Checking the email address for validity, checking birthdate for >= 17) after the AHAH call is finished, the values within the form elements, that had already been filled in, have been replaced by completely different values.
A name of a different person, his age, his email address etc. Even though this person, I assume that this is what is happening, is filling out the form on a different, private computer, in obviously a different session.
My users do not have to login on the website in order to register using this page, I'm not sure if that is causing an issue?
Anyway, as far as I can tell, I can only recreate the problem when I try filling out the form with different data from different browsers on my computer, concurrently. In that case I can manage to corrupt the form_state data. But as the users are on different, private computers, which presumable use different sessions/cookies/what-not, how is it ever possible for form_state data to be changed to form_state data of another computer who is also filling out the form??
I don't get this? Is there some kind of inherent flaw in using AHAH (& AHAH Helper) for keeping the form_state? If there is, is there some kind of work around? Am I just making a huge newby mistake somewhere in my module code that prevents the form from working correctly?
Is there please, anybody, that can shed even a little bit of light at all on this problem? I am absolutely, and completely clue-less and I can not begin to imagine what is going wrong and how and even IF I can fix it at all.
Please help me! :S
Thanks in advance!
Best Regards,
Tom
Edit:
This problem describes a problem in drupal 6.x
I'm answering my own question after having found the solution (quite a while back, but I forgot about this question).
The problem is that the form_state for the different computers is kept apart using session information from drupal.
However, this did not seem to work correctly with the AHAH forms for users that were not registered.
Having users register before being able to fill in these forms solved all the concurrency issues.

How to implement a search system in a database for an iphone application

This is pretty wide question, but I'm hoping to get a push in the right direction (technologies and methodology).
Ok, I have an iphone app (which I am developing) that works with a web service (c#) through http requests. The web service connects to the underlying database, extracts the necessary data depending on the request and feeds it back to the application.
Now, I need to implement a search system in the app. The user searches for some words, and I need to provide the most relevant results. The search must be performed on different tables in the database. Each table can be searched in a number of columns. For example, when searching through the people table I need to search in the first name, lastname, company, and other fields. Other tables have other important columns.
I have so many questions that I don't even know where to start.
How do I make my sql queries to make the search, but still be fast enough. Do I need to make some extra tables with indexed content somehow?
How should I add relevance factor to the results so I can ultimately filter only the most relevant results? For example, if an user searches for Smith, maybe there is a person named Smith or even a Company. They should be displayed before any other content that can have smith in the description.
I know the question is a little vague/wide but I can explain more if somebody desires.
Thank you
This kind of depends on which language/rdbms you are using on your server. You might checkout various DB search solutions like Sphinx which will do all of that indexing for you and provide a simple Search API. Sphinx for example allows you to prioritize columns, define character mappings (ß->s, ä->a) etc.
In the end I have decided to use Lucene. It's a wonderful piece of technology and even if I had some doubts in the beginning, after reading 3/4 of the book called "Lucene in Action" it was clear to me that it had everything I needed (and much more).
I know it's not a fully-functional searching system (with all the elements needed), but merely a library handling the core of a search system. It will need some work to integrate it with my application/webservice/database. I will let you know how it goes :)
Thanks for your input!