I am getting a SSML text in the JSON and trying to find out a standard way to parse this SSML format i.e
"text" : [ "<speak>Screen title <break strength='weak '/> Sign In <break strength='weak '/> </speak>" ]
for my tts application. But I find no way except doing manually. I need to fetch out the real string to be played using AVSpeechSynthesizer. Has anyone tried this before? Help!
Currently it is uttering the complete text->value with tags.
Well, I fixed it using the regular expression to parse SSML tags as suggested by #Carpsen90. There is no other way I found. But, thanks for all your help!
Related
I've seen a lot of answers about how to send PUT/DELETE/PATCH HTTP requests with thymeleaf, and it's by using th:method = "the_specific_method", but i haven't found the thymeleaf specification about that. Can anyone help showing me where is it?
Thanks in advance.
I've tried to google for the answer, but no luck.
th:method isn't special to Thymeleaf -- it's just like any other plain old attribute which will output the result of an expression to the method attribute. It doesn't do (or care about) anything else. You can put any string and/or string expression into it, and Thymeleaf will happily output it.
th:method="${'the_specific_method'}"
will output
method="the_specific_method"
without regards to whether or not it's valid. If you want to learn about the method attribute, you just need to learn about how method works in plain old regular html and how browsers (and/or Spring) work with it.
I try to write a crawler to get some information.But I find the word is different in webpage source.For example, the word Möller is Möller in html file.
I want to know how can I recover it after I get the html file.
Having fix this problem and provide the answer in case some beginner meet the same problem.
I use chr() to substitute the wrong code, for example use chr(246) to substitute ö
If there is better solution, please tell me.
I am grabbing data from a RSS feed dictionary and seems to be working, but the problem is it parses the symbol instead of actual currency. I am not sure what is the best way to go about this. Here is a tiny snippet of the code. I know there is NSLocale, but not sure if that is the best way to do this.
[currencyDict valueForKey:#"currency_symbol"];
You can get the list of Currency symbols here: http://www.forex-rates.biz/currency-symbols.htm
and use below code to Replace them.
yourstring= [yourstring stringByReplacingOccurrencesOfString:#"$" withString:#"$"];
You can get a similar Answer here.
I am writing an iOS app that downloads some data from a server that's not under my control. I am not using custom data detectors. The strings in the returned JSON still contain their HTML url tags, and I want to remove them because I want to display the strings in a UITextView, and these kind of strings
<strong>Instagram</strong> / <strong>Behance</strong>
<strong>Live Now</strong>
What I really want is this:
Instagram Behance
Live Now
What is the best way to go about this?
Should I strip the url tags from the text using regex?
Would I lose the link "descriptions" (in the above example, "Instagram" and "Behance") when I do that?
Would this be way easier using a UIWebView?
If this would be too hard/impossible, it'd be okay to only have the urls, without their descriptions.
Thank you!
Should I strip the url tags from the text using regex?
No. HTML is too complex to be properly parsed using a RegEx. You'll need an XML parser.
Would I lose the link "descriptions" (in the above example, "Instagram" and "Behance") when I do that?
You wouldn't have to using an XML parser. Using a RegEx, you might, especially if you can't control exactly what's returned.
Would this be way easier using a UIWebView?
Yep. That's what I would do, unless you have a good reason not to.
I'm trying to read and save Chinese characters written in websites !
For example:
html source code has this line:
title="网络歌手"
when I read this as NSString, the value returned is in the format like:
\UT0212\UT0999
something like that.
I have tried converting using gb2312 and utf-8, etc. encoders, but I don't quite get the exact Chinese. Sometimes I get close to Chinese, but not the exact words.
Any help is appreciated !
Regards,
Suraj
http://www.pinyin.info/tools/converter/chars2uninumbers.html
I believe you would have to convert the characters to unicode...similar to what they did in the above article