Microsoft Speech Synthesizer Lexicon not working - botframework

I have followed the example here for adding a custom lexicon to my speech SSML. However, it is being ignored. I tried it with my own lexicon and also with the sample. At first the sample seemed to work, but when I removed the lexicon it still expanded out BTW as "By the Way" so it appears it was having no impact for the sample either.
For reference, here is the sample code used to create the lexicon
<?xml version="1.0" encoding="UTF-8"?>
<lexicon version="1.0"
xmlns="http://www.w3.org/2005/01/pronunciation-lexicon"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/01/pronunciation-lexicon
http://www.w3.org/TR/2007/CR-pronunciation-lexicon-20071212/pls.xsd"
alphabet="ipa" xml:lang="en-US">
<lexeme>
<grapheme>BTW</grapheme>
<alias>By the way</alias>
</lexeme>
<lexeme>
<grapheme> Benigni </grapheme>
<phoneme> bɛˈniːnji</phoneme>
</lexeme>
</lexicon>
And here is the sample SSML (in which the lexicon is ignored)
<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis"
xmlns:mstts="http://www.w3.org/2001/mstts"
xml:lang="en-US">
<voice name="en-US-JennyNeural">
<lexicon uri="MY_PATH_TO/customlexicon.xml"/>
BTW, we will be there probably at 8:00 tomorrow morning.
Could you help leave a message to Robert Benigni for me?
</voice>
</speak>
I have tried accessing the lexicon from local storage as well as from a site hosted by Azure App Service. I also looked to see if the Javascript had any sort of "addLexicon" method within SpeechConfig or SpeechSynthesizer, but I couldn't find anything. Anyone have any ideas why this isn't working and what I need to do to fix it?

According to Microsoft, a path to the lexicon on your local machine does not work. It must be hosted on the web somewhere. If you have any app service plan, this is extremely lightweight (it's just hosting an XML file) so you can just create a new app service to host it. Of course if you have other methods to expose files via web uri that should work fine too.
Also, I was having issues with the hosted files using sapi alphabet. The alphabet abbreviation in the documentation is incorrect. It should be x-microsoft-sapi, not just sapi. Once I corrected that I was able to get both ipa (which is correct as ipa) and sapi lexicons working when hosted on a remote server.

Related

Generating Dynamic SSML from "HTTP Request" to be used on a "Get Input"

I'm wondering if anyone can be of assistance.
I am trying to generate some dynamic Amazon Polly SSML to be used on the Plivo PHLO platform. When someone dials into a particular number, they should be greeted with a custom message (in a particular language) and prompted to enter a number.
I have an HTTP request that hits my API, which receives the request and generates the SSML using Plivo's PHP Server SDK.
$response = new Response();
$speak_elem = $response->addSpeak($result['text'], ['language'=> 'en-US, 'voice'=>"Polly.Joanna"]);
Header('Content-type: text/xml');
die( $response->toXML() );
It seems to me that this HTTP Request is working perfectly and returning perfect SSML. When I copy and hard-code-paste the SSML into the Get Input node, it works OK.
<?xml version="1.0" encoding="utf-8"?>
<Response><Speak language="en-US" voice="Polly.Joanna">Welcome To 101 Broadway. For English, press 1.</Speak></Response>
However, when I try to add a Get Input component and link it's "prompt" audio to the resulting SSML, I am getting an error that says Invalid SSML (See Screenshots at the bottom).
WHAT I'VE TRIED
I've tried returning the SSML in plain XML and using {{HTTP_Welcome.response}}
I've tried returning the SSML as text in a JSON object called SSML and using {{HTTP_Welcome.response.SSML}}
I've tried returning the SSML both with and without the xml tag.
I've tried returning the SSML both with and without the Result tag.
I've tried taking a break and coming back to it. Hey, you never know.
No matter how I return the SSML, and how I try to link it to the Get Input prompt, I am unsuccessful. I'm starting to wonder if this is even possible?
Any help would be immensely appreciated. Thanks!
SCREENSHOT 1
SCREENSHOT 2
My name is Mohammed Huzaif, and I work for Plivo as a Developer Evangelist.
Unfortunately, the "GetInput node" in PHLO does not yet implement the feature you are searching for. The best option is to use a standard speak which is customisable in your way, which may have a less natural feel than SSML.
Currently, I've narrow information about your use case as of now but If you still want to use a custom SSML, I'd recommend utilising a framework instead of PHLO to design your call flow. Here's a tutorial that covers a few use cases by Plivo in several frameworks to help you develop one.
If you experience any problems, please feel free to contact our support team.

google safe browsing api url encoding (canonicalization)

In my application I am checking user-entered urls for malware by sending them to google.
To test getting a "malware found" reaction I used the url http://malware.testing.google.test/testing/malware
To my surprise this url was not marked as malware
In fiddling about I found out that when I enter a trailing slash, it does get picked up as malware.
In the documentation it says the url's need to be canonicalized.
Do any of you know of an implementation of this requirement? (preferably in c#)
Using the link ForguesR provided I have created this C# implementation.
It passes 26 out of the 33 tests from the google test suite found at: https://developers.google.com/safe-browsing/developers_guide_v3#Canonicalization
It has been deemed good enough for production since it doesnt catch the more obsure webpages.
Code: https://dotnetfiddle.net/xO9sWl
I am working on the same problem right now and the only thing I have found is a Java implementation in the jGoogleSafeBrowsing library. Unfortunately, it is stuck to v2 of the API.
Anyhow, you can have a look at the canonicalization code here. Be aware that :
this code is released as open-source under the Creative Commons NC-SA license;
this code may not pass the Google canonicalization test suit.

checking validity for standard SOAP web service

Is this a valid web service link since I tried ti import it several times to visual studio 2010 and 2012 and couldnt read it from code behind.
http://www.hotelston.com/ws/HotelService?wsdl
whats the service name I should call ?
Yes this is a valid WSDL and it is a WSI compliant WSDL as well. I ran the tests with SOAP UI and it appears to be fine. The service name is HotelService it has three ports one for SOAP 1.1 another for SOAP 1.2 and finally one for HTTP. It is document literal wrapped so cant see anything problematic.
I also imported the WSDL into a XML editor and had a look. It appears fine see image below.

xml to wbxml conversion for activesync in iOS

I have been trying to built an app which will communicate with MS-ActiveSync Exchange. I am stuck at the provisioning part. I need to send a post HTTP request with WBXML content in body. But I could not find anything anywhere to convert xml to wbxml for active sync.
There are some C based libraries available like wbxml2, but can I use them for active sync. There are no code pages provided in the library as mentioned in MS-Activesync Exchange documentation. Please help!!!
Use libwbxml. The package has xml2wbxml and wbxml2xml. Code pages are included.
save this as prov.xml:
<?xml version="1.0"?>
<!DOCTYPE ActiveSync PUBLIC "-//MICROSOFT//DTD ActiveSync//EN" "http://www.microsoft.com/">
<Provision xmlns="Provision:">
<Policies>
<Policy>
<PolicyType>MS-WAP-Provisioning-XML</PolicyType>
</Policy></Policies></Provision>
then:
xml2wbxml -a prov.xml -o prov.wbxml
You can manipulate wbxml as text.
In https://code.google.com/p/tz-push/
In javascript:
prov.wbxml = string.fromCharCode(0x03,0x01,0x6A,0x00,0x00,0x0E,0x45,0x46,0x47,0x48,0x03,0x4D,0x53,0x2D,0x57,0x41,0x50,0x2D,0x50,0x72,0x6F,0x76,0x69,0x73,0x69,0x6F,0x6E,0x69,0x6E,0x67,0x2D,0x58,0x4D,0x4C,0x00,0x01,0x01,0x01,0x01)
wbxml2xml and xml2wbxml are command line programs included with libwbxml. I know nothing about IOS development.
Have a look at https://tz-push.googlecode.com/files/towbxml.js it is xml to wbxml converter written in js. (Can be run in Thunderbird/Workspace or Firefox/Sratchpad.) I know this is not what you want but the code may point you in the correct direction. It uses Sax. So if you have a sax parser available should be easy to port.

Bing API Azure Marketplace: how to know whether there are more results?

I am using the Bing Search API in Windows Azure Marketplace (i.e., the API that replaces the old Bing 2.0 API, that expires on 1st August 2012). The Migration Guide provided by Microsoft states:
If there are no more pages of results, the /feed/link[#rel=’next’] property will no longer appear [...].
However, it seems that this is not always the case. For example, a News query for "Roger Federer" does not contain a link element:
Request: https://api.datamarket.azure.com/Data.ashx/Bing/Search/News?Query=%27"Roger+Federer"%27
Response:
<feed xmlns:base="https://api.datamarket.azure.com/Data.ashx/Bing/Search/News"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns="http://www.w3.org/2005/Atom">
<title type="text">"Roger Federer"</title>
<subtitle type="text">Bing News Search</subtitle>
<id>https://api.datamarket.azure.com/Data.ashx/Bing/Search/News?Query='"Roger Federer"'</id>
<rights type="text"/>
<updated>2012-07-26T15:43:03Z</updated>
<entry>
<!-- ... -->
</entry>
<!-- ... -->
</feed>
Nevertheless, there are more news: https://api.datamarket.azure.com/Data.ashx/Bing/Search/News?Query=%27"Roger+Federer"%27&$skip=50
Does anybody know where the problem might be? (Or where there is reliable documentation for the API?)
One thing to do is to update your BingSearchContainer.cs - I found there was an older version when I first started using it that caused me all sorts of problems like this. When I updated a lot of things started working.
I think the problem is that the BingSearchContainer is "fixing" your query and messing you up. Try the following:
Then try to do the query without the " marks. It will probably succeed and return results.
Try to use ' instead, you will probably get some results.
I think the container is escaping all your queries as a single phrase match by default. So just adding a search will work. Now when you really do have two phrases you need to search for... That I can't get working yet either.
I cannot reproduce this anymore: the response now contains a link element.
I suppose the Bing guys have fixed the problem in the meantime.

Resources