Setting a flag in LUIS for BING spell check - azure-language-understanding

I've connected bing spell check to my LUIS app, but I need to change the mode flag from 'proof' to 'spell'. Is there a possible way to do so while keeping the process automated.

The bing spell check API uses the default mode of "Proof" if you have integrated the API from your application/bot directly, Changing the mode value to "spell" should set the search to spell.
If you are adding the spell check endpoint URL directly with the LUIS API each and every call must include the required information for spelling corrections to work correctly.
The endpoint URL needs the spellCheck parameter to "true" along with the value of bing-spell-check-subscription-key.
https://{region}.api.cognitive.microsoft.com/luis/v2.0/apps/{appID}?subscription-key={luisKey}&spellCheck=true&bing-spell-check-subscription-key={bingKey}&verbose=true&timezoneOffset=0&q={utterance}
The response from this endpoint for a misspelled word should suggest "alteredQuery" for the utterance passed. For example:
{
"query": "How far is the mountainn?",
"alteredQuery": "How far is the mountain?",
"topScoringIntent": {
"intent": "Concierge",
"score": 0.183866
},
"entities": []
}

Related

Teams Bot Adaptive Card action.Submit returns undefined but works in Bot Emulator

I am having an issue with Teams Bot adaptive card action submit, when testing Bot Emulator it works as expected, but when it's published and performing the same action in Teams conversation, the action submit returns undefined.
I have attempted with both adaptive card version 1.0, and version 1.3, the issue is the same in both cases.
Anyone know a solution for this?
The other answer provides some useful background, but I think it's only applicable to specific scenarios - I think the issue you're having here is that you're sending a raw string value in the data property ("My Action") which Teams doesn't like, but the emulator doesn't mind at all. You can see more about that described in this Microsoft blog post. You should instead be sending an actual object. I describe it in more detail in this answer: QnA Maker Bot AdaptiveCards: how to add Data object in C#.
What #billoverton is referring to is a specific use case where you want the button behaviour to be, for instance, actually putting a message into the text stream as a response, as well as sending it to your bot. There are various options for these specific use cases, as described here, but they are optional if you want this specific behaviour. If you're happy for the user to click the button and that to simply invoke the message to your bot, you don't need the "msteams" section in the data payload.
A "standard" action.submit won't work in Teams. You need to add an msteams object under the data attribute. I'm guessing you are using a standard definition like
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "My Action",
"data": "My Action"
}
]
}
For Teams, it instead needs to look like this:
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "My Action",
"data": {
"msteams": {
"type": "imBack",
"value": "My Action"
}
}
}
]
}
Of course when you do this, it won't work in the emulator or any non-teams channel. I've seen some people update their onMessage handler to account for this by extracting the value so a single card definition can work for both channels, but it made the selection a backchannel event for one of the channels (can't remember if it was web or Teams) which was not the experience I was looking for. So instead, I just conditionally display a Teams or non-Teams card based on channel. For example:
if (context.activity.channelId == 'msteams') {
var welcomeCard = CardHelper.GetMenuCardTeams();
} else {
var welcomeCard = CardHelper.GetMenuCard();
}
If you are not using a helper to generate your cards you can define them explicitly here, though I do recommend using a helper to keep things clean. This does mean that you need to maintain two versions of your cards, but for me it was worth it to ensure a consistent experience across channels.

Get teamId in message extension handler

When developing a message extension for Microsoft Teams, is it possible to retrieve the ID of a team where the user is invoking the message extension command without first adding the bot to that team?
I can do this when the bot is added to the team manually based on TeamsInfo.getTeamDetails(), however, I don't really need (or want) to add the bot to the team for my goal. All I need is the channel ID (which is available from the context/conversation) and the ID of the underlying team. Retrieving the team details without the bot being added beforehand errors with "The bot is not part of the conversation roster".
Have a look at the ChannelData property on the Activity class, that should give what you need. You can read more about it here.
Here's an example of the underlying payload, for interest:
"channelData": { "eventType": "channelCreated", "tenant": { "id": "72f988bf-86f1-41af-91ab-2d7cd011db47" }, "channel": { "id": "19:693ecdb923ac4458a5c23661b505fc84#thread.skype", "name": "My New Channel" }, "team": { "id": "19:693ecdb923ac4458a5c23661b505fc84#thread.skype" } }
we had the same trouble with the Team documentation and APIs.
However for that specific case, we found a solution that may work for you. I will say is more a hack than a solution. But it worked on my use case. It will only work on messages with attachments.
When the context is received in a message, the message contains an attachments array. Each attachment object has a contentUrl. Inside that url is the mailNickname for the group. That mailNickname field represents a readeable unique id. The format is something like sites/{mailNickname}/General.
from there you can retrieve the field and use the Groups Graph API.
With a query like this one:
https://graph.microsoft.com/v1.0/groups?$filter=startswith(mailNickname, 'themailNicknameFromcontenturl')
You will get the group full information, including the aadGroupId
In general, is a nightmare to work with Teams documentation. Hope this hack helps you.

How to search Zoho custom module using API v2?

I am using an access token with ZohoCRM.modules.custom.READ.
When I send a GET request to https://www.zohoapis.com/crm/v2/Custom/search, I get the following error.
{
"code": "INVALID_MODULE",
"details": {},
"message": "the module name given seems to be invalid",
"status": "error"
}
What am I doing wrong and how do I define the module I am trying to pull data from (it is called CustomModule2)?
Figured it out...
First, needed to go to https://crm.zoho.com/crm/{org_id}/settings/modules to find the actual name of CustomModule2 which is Adresses livraison.
Then, needed to go to https://crm.zoho.com/crm/{org_id}/settings/api/modules to find the API name for Adresses livraison which is Adresses_livraison.
Finally, needed to go to https://crm.zoho.com/crm/{org_id}/settings/api/modules/CustomModule2?step=FieldsList to find the API name of the field I wanted to use as a search criteria (it was Compte].
The final query using httpie is as follows.
http GET https://www.zohoapis.com/crm/v2/Adresses_livraison/search \
Authorization:"Zoho-oauthtoken {access_token}" \
criteria=="(Compte:equals:{account_id})"
Zoho is up there in the most awkward developer experiences I have encountered.
Just an update for anyone still looking into this, because I noticed that the links aren't always the same, depending on whether it's a sandbox or not, etc. So the steps are:
Go to your CRM page/dashboard and click on the Settings (cogwheel icon) on the top-right, next to your account image.
A bunch of items in panel boxes open. In the panel named "Developer Space" choose APIs
There it opens a bunch of tabs and sub-tabs and a Dashboard (As shown on the image below). The "Dashboard" sub-tab should be selected, all you have to do is switch to the sub-tab "API-Names"

How to setup Microsoft LUIS to detect composed names (dash separated)

I want to detect a person's name in LUIS, including a person with a composed name (eg: Mary-Anne)
Setup:
a simple custom entity for names
a pattern feature for dash separated words: ^\w*-\w*$
a feature Phrase List to try and get at least some examples working: [marc-andre, marie-anne, jean-marc]
I trained and published (on staging) and yet, it never detects the whole composed name, but instead will only return the first part as the entity (eg: entity is "marc" instead of "marc-andre").
Do you know how to configure LUIS to properly detect my composed name entity?
Update taking Denise' answer into account
In the Luis.ai UI, i didn't realize that while labelling an utterance, it is possible to click more than once to select multiple words while specifying an entity.
I was able to configure a simple custom entity like you describe. I posted the JSON that you can import into LUIS here.
Without seeing the JSON for your LUIS app it's hard to tell why it fails to recognize the dash-separated names - feel free to post the JSON for your LUIS app here. Sometimes a LUIS app won't recognize an entity due to a lack of labeling. A key part of getting LUIS to recognize an entity is labeling enough examples. A pattern feature is just a hint to LUIS -- you still need to define example utterances that have the labeled entity. For example, if you have defined an intent called MyNameIs and want to recognize the Name entity within them, you'll want to add a variety of utterances to the MyNameIs intent that contain dash-separated names, and label each name with the entity.
When I added the pattern feature I used + to indicate "one or more" in the regex instead of *. However, this difference shouldn't break your pattern feature.
Another problem that can happen with hyphens is in the JSON that LUIS returns. When you inspect the JSON result from LUIS you can see how the Name entity is identified. Notice that in the entity field, LUIS inserts spaces around the hyphen, but the startIndex and endIndex fields identify the indexes of the entity in the original utterance. So if you have code that parses the entity field without using startIndex and endIndex on the query field the behavior might not be as you expect.
{
"query": "my name is anne-marie",
"topScoringIntent": {
"intent": "MyNameIs",
"score": 0.9912877
},
"entities": [
{
"entity": "anne - marie",
"type": "Name",
"startIndex": 11,
"endIndex": 20,
"score": 0.8978088
}
]
}

What public information in a profile does the G+ People search API look into when performing a search?

I am talking about the functionality of the API that can be tested here: https://developers.google.com/+/web/api/rest/latest/people/search
I used to think it looks into all the public fields of a profile ("Specify a query string for full text search of public text in all profiles."), but it seems you can't search by email, telephone or some of the education and work information (even if the expected resulting profiles make this information public).
So my question is, what public data does this search use to retrieve its results? I can't find any documentation on this.
People: search
query string Specify a query string for full text search of public text in all profiles.
I found a random user. here I picked this guy because he had a lot of text in his profile.
Lets search on "gdesignart" This is part of his display name.
{
"kind": "plus#person",
"etag": "\"Sh4n9u6EtD24TM0RmWv7jTXojqc/W9DoYLbchkxsXWI_HhuWV6G7lJY\"",
"objectType": "person",
"id": "116044052555068441384",
"displayName": "Marcello Ghirardi (gdesignart)",
"url": "https://plus.google.com/116044052555068441384",
"image": {
"url": "https://lh3.googleusercontent.com/-IqYeJSv07cI/AAAAAAAAAAI/AAAAAAAAAPM/yw8nbO0Ho6g/photo.jpg?sz=50"
}
Works fine and I get a response.
Now lets try some text from his tagline or introduction arguably we could say this qualifies as public text on his profile.
I tried the following
G-Design®
è un brand
Pollutre of different world
None worked. If you look at the response the only thing in the response is the users display name. From my experience with other google APIs I can tell you that I don't think its going to let you search on any field that is not part of its response. So you are only going to be searching on DisplayName. For the fun of it I searched on his ID that didn't return anything either.
Answer: search is on display name only.
I would recommend adding this as a feature request if you link it here I will happily add my name to it. Google plus issue forum

Resources