I have two entities called #amount and #type . #type has values like "A1BM", "C3MH" and #amount has values such as "1,2,3,4,5,6,7,8,9,10" . Whenever the user enters "A1BM 10", I want the bot to recognize that "10" not as an #amount but rather as the size of the #type.
How can I do it?
You can use patterns (regular expressions) to define entities, e.g., for the format of #amount. Watson Assistant also has system entities that can be enabled, e.g., #sys-number for detecting different forms and written formats of numbers. Moreover, when checking for matches you can also access the entire input string, locations of detected objects (intents, entities, ...) and the confidence of a detection.
You did not share details about how the responses will be entered. Your best bet seems to me to add a pattern for #type, use a number pattern or #sys-number for #amount and compare the location and relative neighborhood of entered values to detect that "10" is meant as size and not as amount.
There are some examples in the documentation.
Related
This could be a simple one that I haven't been able to find but I'm trying to exclude a single value ("girlfriend") from being picked up as an entity in a chatbot I'm building. The entity list is currently "dog, cat, pet, mum, horse" with relevant synonyms for each of those entities as well.
Watson keeps picking up "girlfriend" and matching it as an entity despite it not being in there which is stuffing up the logic in the conversation.
Is there a way to stop Watson identifying similar words in an entity list beyond what is in the list? I have tried turning off fuzzy matching but that just misses spelling mistakes.
Please note this is not an intent training issue, it is specifically asking about entity identification.
Any help appreciated.
-T-
Your question is not entirely clear, but likely you want to take a look at how to improve a skill. Because Watson Assistant is built on AI technology, a key part is about learning.
You can "teach" Watson Assistant by going back to conversations and correct wrong matches with the right ones. Watson Assistant is going to pick this up and then retrain the dialog. This should result in excluding "girlfriend".
I had a similar problem. My bot kept picking its own name as a username and I wanted it to ignore its own name even if the user typed it (e.g. Hello Robot, I am Jill) I wanted it to respond to 'Jill' and not 'Robot' but it kept missing it. I later realized the context variables I created had similar values to user names. So what I did was create a variable #bot-name and gave it only 1 value (Robot), no synonyms, no fuzzy match, no annotations. Then tried it again and the Bot recognized its own name, ignored that and picked the second name correctly as the user name. So when I repeated the sentence 'Hello Robot, I am Jill' it recognized #entity:bot-name and #entity:user-name and then responded only to the username. You can try something similar.
Its not clear how you created your entity list. If its was via contextual entities then Watson may be taking "girlfriend" as being in the same "family" as the other entities and adding to the entity list. If the entity list was hard coded, along with the synonyms, then I would guess that one of your synonyms shares some of the spelling of girlfriend, girl or friend. Which via fuzzy logic would match an entity, but with a lower confidence level.
To fix you could create a new entity list and have a condition that looks to match entity list one, but not entity list two (girlfriend).
Or you could set your condition on the entity list and entity confidence level > 0.8 - but you may then miss some spelling mistakes. (Select a confidence level thats just above that reported for girlfriend).
I can't say if this is a solution, However I'd prefer to call it a workaround as it worked for me in my case.
Non-Contextual Case:
Create a new entity and add girlfriend as a value. Thus it would never interfere with your current entity in a dialog flow.
Contextual Case:
Train an intent with examples which includes girlfriend and annotate it with new entity.
How to I create an #Intent which looks something like this:
How much is a #ProductType?
Whereas the #ProductType is an simple Entity which consists of:
Soft Drinks: Coke, Pepsi, Sprite, Fanta
Fruits: Apple, Banana, Watermelon
I tried adding an Intent with above settings, but it doesn't seem to work. Is such ability natively supported in IBM Watson? Or otherwise, do I need to manually handle in the Dialog, using Conditions and stuffs? Please kindly advise.
The training is based on regular language and typical sentences or phrases. So #ProductType is not what you want in the phrase, but any of the fruits or drinks.
By defining the entities, Watson Assistant later learns the connection and to identify the entities and intents.
To get started, you define the intents and entities. Both can be imported from lists. Then you add the dialog which references the different types.
This blog should give insight to all the ways to train an entity and how it is used within intents.
https://medium.com/ibm-watson/all-about-entities-dictionaries-and-patterns-with-watson-assistant-part-1-5ef7254df76b
There are a number of possible pipelines you can choose from.
1. Indirect references: this is the preferred method.
Use natural language in your intent training data. "I want to buy a pear"
Watson will automatically see the other values you have related to pear and use those as intent training as well. This will be the fastest and simplest way to manage your data
2. Direct references: this should only be used if absolutely necessary
Directly reference the entity in your intent data. "I want to buy an #pear"
Nothing is done in the UI to tell you this works, but it does. This tells Watson the entity is a very important term and will increase the weight, as well as reference all synonyms with high weight. This is more effort for you to go through your entire workspace and relabel everything this way, hence why it is not recommended unless absolutely necessary. By doing this, you also tell watson that when the system sees various fruits without the # symbol, to ignore them as entities which is not ideal
3. Contextual entities. This is highlighting them like in your screenshot.
Note the UI has been updated so there is no an annotation mode instead of just highlighting. This builds a model around the entity, and is good for things like names or locations, but not necessary for a small list of items like crayons in a box, or fruit in a store. This will ignore all of the dictionary values youve created and only look at the model. It should be used according to the blog above when the use case is ideal.
What #data_henrik answered was partially correct. But it doesn't seem like Watson Assistant "automatically" learns the preferred #Entity just by simply inputting the pure (plain-text) Examples into the #Intent. In fact, that step was required. But we still need to do one more step.
After keying in the good plain-text Examples into the #Intent, we then still need to "right click" on the text-string of the possible #Entity entry, and then choose (teach Watson) the correct #Entity name from the dropdown list appeared.
Only then Watson starts to understand such; this #Intent uses that #Entity, I suppose.
Thank you #data_henrik, and appreciate your hint.
So i'm setting up my ld+json structured data, using Schema.org schemas. I am adding products with Offers but they only have a single price parameter.
I also looked at PriceSpecification too, but there is only "range" and "price".
Should I use 2 PriceSpecifications (or 2 Offers?) with visibly different names, or is there another option I haven't come across? Don't want search engines to get confused.
Thanks for any help.
You can use multiple PriceSpecifications. However "typically, only the subclasses of this type are used for markup." UnitPriceSpecification would be the best fit, or the setup price can be of type DeliveryChargeSpecification.
Alternatively, you can use a single CompoundPriceSpecification with multiple priceComponent properties, each of type UnitPriceSpecification. "The name property of the attached unit price specification for indicating the dimension of a price component"
I'm working on a piece of structured data, in JSON-LD format (should it matter).
While looking through the price property page of Schema.org, I saw that you can also add text as price value. However, it doesn't seem to be documented anywhere what texts are allowed.
Does anyone know what texts are allowed?
I've tried to fill in random texts while using the Structured Data Testing Tool, but that gave an error that it didn't get recognised.
Schema.org doesn’t restrict (nor document/recommend) what kind of Text value the price property can have.
Most prices will have a Number value, and unless you have a good reason not to use it, you should go with Number, too, following their "Usage guidelines".
I guess possible reasons for expecting Text could be:
CMS that don’t (easily) allow to output the price separately from the currency symbol. Having "5 EUR" as price is better than not providing a price at all.
Authors that want to say "gratis" or "free" instead of "0".
I want to create a Eng<->Rus dictionary application. As far as I know, I need to use SQLite. But how can I implement the translation function? How can I find corresponding translation of the word requested by the user? Any help, guidance, tutorials will be appreciated.
http://en.wikipedia.org/wiki/FreeDict has a good collection of bilingual dictionaries, including eng-rus. It's under GPL.
If you need only eng->rus translation, this is basically a hashtable, where the english word is the key, and the list of corresponding russian words are the value.
If you need bidirectional translation, I would store each word as follows:
[word], [language], [set of corresponding translations]
The translation is easy then: you lookup the word W in language L, and return the set of possible translations.
You may want to have a look here too How do I initialize a store with default data in a CoreData application?
Also, it's probably a good thing to add some non-aggressive stemming and/or normalization, so that if I search for a plural (ie. eggs) it's resolved to the singular, or if I search a specific verbal form (ie. walking) it's resolved to the verb's infinitive.
Well, there are a lot of ways you could achieve this, but at the simplest level, consider using paired-arrays....two separate arrays. One contains English words, the second array containing the translated equivalents. You can then request a given term at a specified index, and access both terms for it.
In CoreData, you could specify a "Word" entity, with attributes of "English" and "Russian".