I'm transcribing various mp3 files in Spanish. I'd like to use IBM Watson's speech to text API using R and am following the instructions in this tutorial (http://rpubs.com/Cartwheel/stt). I'm able to successfully transcribe a test mp3 file with English audio using this code, but I haven't figured out a way to modify it to listen for Spanish audio (the default language is American English).
This is the main function from the tutorial for transcribing mp3s. As it is, it successfully transcribes English audio. In this function, url, username, and password are defined previously.
watson.speech_to_text.recognize <- function(audio_file)
{ return(POST(url=paste(url,"/v1/recognize",sep=""),
authenticate(username,password),
add_headers("Content-Type"="audio/mp3"),
body = (file = upload_file(audio_file))
))}
I've tried changing the url ending to something like the following, but have had no success.
"{url}/v1/recognize?model=ex-MX_BroadbandModel"
Related
In google translate website, if we translate it shows translation and also pronounce of the word.
But when I use the Google translate rest API, it only return the translation, I need pronounce of the word same as website.
My Rest API
https://translation.googleapis.com/language/translate/v2?key=myApiKey&q=%D8%A7%D9%84%D8%A8%D8%B3%D8%AA%D8%A7%D9%86&source=ar&target=en
I may miss something, is any extra parameters there to retrieve these extra information?
Translating a word from the alphabet of one language to another(get the pronuntiation), is named transliteration and it is not supported by Cloud Translate API yet.
However, there is a feature request filed for the same. You can vote for this feature by clicking "+1" and "STAR" mark to recieve updates on it.
I was also looking for the same answer.
I haven't found a way to get Pronuntiation with the Google Translate API yet.
However, I found a way to get it through the Python library.
You can use the Python googletrans library.
The code is as follows.
You must use googletrans library 3.1.0a0 to avoid errors.
# pip install googletrans==3.1.0a0
from googletrans import Translator
translator = Translator()
SENTENSE = "안녕하세요. 반갑습니다."
LANGUAGE_CODE = translator.detect(SENTENSE).lang
k = translator.translate(SENTENSE, dest=LANGUAGE_CODE)
print(k)
print(k.text)
print(k.pronunciation)
Output:
Translated(src=ko, dest=ko, text=안녕하세요. 반갑습니다., pronunciation=annyeonghaseyo. bangabseubnida., extra_data="{'translat...")
안녕하세요. 반갑습니다.
annyeonghaseyo. bangabseubnida.
I'm trying to download a csv file of data corresponding to the chart on the below website:
http://vixcentral.com/
If I click on the menu button on the top right of the chart there's an option to download the chart data into a csv.
The issue is that that button seems to generate a download link that only works temporarily, so I'm unable to use a regular downloader such as read_csv or rio::import to pull the file into R.
It seems both the chart and the download link are generated by the Highcharts javascript.
Is there any straightforward way to download this data into R by figuring out the link?
Or does it have to be a scraping excercise?
If you right-click on the screen and press 'Inspect Element', then go to the 'Network' tab, you can see xhr requests being done to obtain data (for example while clicking around the different charts).
You noted that you're interested in the result of http://vixcentral.com/ajax_update/?_=1590762673737.
The number in the end of this URL is the Unix epoch of the current time. That's why it changes.
There is a little bit of security from scraping in the sense that they try to block requests that do not come from their own site. By setting the header X-Requested-With to "XMLHttpRequest", it works. You can view the headers used for this request by clicking on it in the 'inspect element' screen of your browser. There are a bunch of headers being set, and by removing each one and testing, I found out that this is the only one that's needed for your purpose.
Below reads the data and parses it into an R object using jsonlite.
res <- httr::GET("http://vixcentral.com/ajax_update/?_=1590762673737",
add_headers("X-Requested-With" = "XMLHttpRequest"))
res_text <- content(res, "text")
jsonlite::fromJSON(res_text)
I can get basic html text to flip 180*, but I'd like to know how to get a whole Doc in my Drive file to flip using a standalone script (so I can do it repeatedly). I'm aware I can get a doc, open the scripts editor and then use my flippin' project to flip the doc I called, but I don't know what the syntax looks like. My first flippin' success was pasting text into the .html file as simply as possible and using:
function doGet() {
return HtmlService.createHtmlOutputFromFile('Page');
getContent()
}
I just test ran it from the dialog box as a web app. But I'm interested in building this one command feature out into several different domains to get experience with the variety of possibilities available in GAS. Anyone care to tutor me? Please?!...
Am working on an xls survey form which when I loaded onto ODK to look for errors it produced this error"You must have a sheet named(case-sensitive):survey"which I dont quite understand.
It's referring to the worksheet in your excel file. Instead of the normal "Sheet 1" etc it needs to be named "survey".
I recommend you use http://ona.io to load and manage your forms. You can sign up and create an account there.. then your profile URL becomes the server URL that you have to enter in the ODK Collect app on the phone. They have given a basic example xlsform that should help you get started.. https://ona.io/examples/
Further documentation on making XLSForms : http://xlsform.org
Objectives -
Open the target app using AutoIy
Take a printscreen (ALT + PRTSCREEN) of the opened app(step 1)
Open a new word document
Paste the screenshot on word document
Issue:
I am able to complete the first two step, however I am not able to paste the screenshot in Word document.
Root Cause
I am able to take the print screen using SEND ("!{PRINTSCREEN}") and open word document using UDF _WORD_DOCADD, but I am not able to paste from clipboard. The issue is, when I am using WinWaitActive to activate the document, the document is still not active and hence SEND ("^V") is not working.
You are using Send incorrectly to send the Ctrl+V. With a capitol V, it will be interpreted by AutoIt as Ctrl+Shift+V (see helpfile for details). Instead what you want to use is Send("^v").
WinWaitActive does not activate the document, it simply waits for it to become active, use WinActivate to activate word.
The correct way to paste though is to use the word com object, something like: $oWord.Activedocument.Range.paste. That will work without word being active or visible.
Also, there are better ways to screenshot than sending Alt+Printscreen.
All these steps are very well documented, and have been done many times before.
I found a way to solve my problem. Steps followed are -
Simulate ALT + PRNTSCRN
Open Clipboard
GetData from Clipboard as BITMAP
Save the data as JPG using GDIPLUS_IMAGE_SAVETOFILE
Use DOCADD to open new document and _Word_DocPictureAdd to save the image to word document.