I haven't been able to set the language to spanish in the watson-js speech to text api. I think I've tried every variation of the following line:
, xarg: "Content-Language=es-us"
Has anybody achieved this? How?
exports.ATT_CREDS = {
client_id:"client_id"
, client_secret:"client_secret"
, access_token:"access_token"
, scope: "SPEECH"
, context: "Generic"
, access_token_url: "https://api.att.com/oauth/token"
, api_domain: "api.att.com"
, content_type: "audio/wav"
, xarg: "Content-Language=es-us"
};
Problem solved: documentation on watson's API was wrong. After a couple of emails it got corrected. It was something with the xarg variable. It's updated now.
AT&T Speech API
Related
In an older JavaScript app I used keyword-query to search for document properties, and I could add the 'DlcDocID' field (Document id) to be retrieved.
I am currently developing an Spfx version of the app, and use pnp.sp.search to get document data. This way I can get the UniqueId and the DocId, but not the Document Id. How can I have this parameter included in the search results?
Extra:
I am using 1.3.11, and this code
pnp.sp.search(
{
Querytext:query,
RowLimit:rows,
StartRow:start,
SelectProperties: ["DocId"
, "UniqueId"
,"FileType"
,"ServerRedirectedEmbedURL"
, "ServerRedirectedPreviewURL"
,"LastModifiedTime"
,"Write"
,"Size"
,"SPWebUrl"
,"ParentLink"
,"Title"
,"HitHighlightedSummary"
,"Path"
,"Author"
,"LastModifiedTime"
,"DlcDocID"
],
But DlcDocID is never retrieved.
Looking at the docs, DlcDocID should be retrievable (it's queryable and retrievable by default). Have you tried using SearchQueryBuilder and selectProperties?
const q = SearchQueryBuilder().text(yourQuery).
.rowLimit(10).processPersonalFavorites.selectProperties('*', 'DlcDocID');
const results = await sp.search(q);
SearchQueryBuilder reference
The issue was that the pnp
SearchResult interface didn't have the DlcDocID in this version. Adding it solved the problem.
I am creating a bot using dialogflow-fulfillment, and I am using Google Place API to pull additional information about hospitals.
I have made a dummy response, for the sake of example, that is returned by Google Place API, here is the link: http://www.mocky.io/v2/5c2b9f9e3000007000abafe3
{
"candidates" : [
{
"formatted_address" : "140 George St, The Rocks NSW 2000, Australia",
"name" : "Museum of Contemporary Art Australia",
"photos" : [
{
"height" : 3492,
"html_attributions" : [
"\u003ca href=\"https://maps.google.com/maps/contrib/105784220914426417603/photos\"\u003eKeith Chung\u003c/a\u003e"
],
"photo_reference" : "CmRaAAAAaGaCX-kivNEaJ-z97AduTYgW3d98uv53-8skNrS1k1GTgOtiQ1-Z2gfWJydrpkrshuV_kHPKizl088dezEJgIxYGoTWqtJgah-u_I46qNNYMfUbk8LKBZqxzkHyIL1nWEhBO6lPa0NgvlyLGBrXpXFPUGhT0lAUj_oCiOWV2MEYdBeKf-kTtgg",
"width" : 4656
}
]
}
],
"status" : "OK"
}
I need to parse values of my choice from the JSON returned by Google Place API. For example, If I had to parse value of 'name' from the JSON above using Python, I would do this:
import requests, json
api_key = ''
r = requests.get('https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=Museum%20of%20Contemporary%20Art%20Australia&inputtype=textquery&fields=photos,formatted_address,name&key=' + api_key)
x = r.json()
y = x['candidates']
print(y[0]['name'])
Above code for the job is lucid and works perfectly. Considering my inexperience in Nodejs, would you please let me know something similar in Nodejs to parse the value, for instance, the value of 'name'?
Your valuable reply will encourage me.
P.S: Humbly, the question involves first making a call to Google Place API and then parsing values from the returned JSON. Please follow the steps given in Python code above for better understanding.
Get the API response in an async HTTP request (there are tons of npm libraries like request to help you automatically set headers etc), then use standard library JSON.parse(body) to get an plain JavaScript object which contains a structured representation of the API response.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
I'm requesting out of a node application via the nodejs sdk:
paypal.payment.create({ ... }, function (err, transaction) {
fn(err, transaction);
});
The shipping_address payload looks like this:
{
recipient_name : 'Max Mustermann',
line1 : 'Neue Schönhauser Str 18', // the 'ö' causes error
line2 : 'Vorderhaus, links',
city : 'Berlin',
country_code : 'DE',
postal_code : '10178',
state : 'BE',
type : 'residential'
}
The utf-8 character in line1 key's value causes a MALFORMED_REQUEST error. If I replace it by oe everything works fine.
Does paypal's REST api understand utf-8?
Do I have to setup the character encoding somewhere?
Thx
Issue was due to incorrect Content-Length getting set from the nodejs sdk and not the API. We have fixed the SDK and published the latest version to npm. Please use 0.6.4 version which has the fix for the same. Thanks for reporting.
It should accept this, yes, of course. Let me check this for you as it shouldn't throw an error on that.
I've got this problem that I can't solve. Partly because I can't explain it with the right terms. I'm new to this so sorry for this clumsy question.
You can see my goal here ...
I am using NicEdit in that i am getting so many options default But i don't want that all i want set only some of specific options.
Any ideas ?
Please read the manual of nicEditor.
var NicEditconfig = {
iconsPath : '/img/nicEditorIcons.gif',
buttonList : ['bold','italic','underline','ol','ul']
};
var NE = new nicEditor(NicEditconfig);
NE.panelInstance("IDofTextarea");
I am new to ES and trying to search using java apis. I am unable to figure out how I can provide filed specific boosting using the java apis.
Here is the example:
My index document looks like:
_source": {
"th_id": 1,
"th_name": "test name",
"th_description": "test desc",
"th_image": "test-img",
"th_slug": "Make-Me-Smart",
"th_show_title": "Coast Tech Podcast",
"th_sh_category": "Alternative Health
}
When i search for keywords I want to boost the results higher if they found in the "th_name" compared to they're found in some other fields.
Currently I am using below code to do search:
QueryBuilder qb1 = QueryBuilders.multiMatchQuery(keyword, "th_name", "th_description", "th_show_title", "th_sh_category");
SearchResponse response = client.prepareSearch("talk").setTypes("themes")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH).setQuery(qb1)
.setFrom(start).setSize(maxRows)
.setExplain(true).execute().actionGet();
Is there anything I can do at query time to boost the document if the keyword is found in "th_name" field compared to found in other fields?
The accepted answer did not work me. ES version I am using is 6.2.4.
QueryBuilders.multiMatchQuery(keyword)
.field("th_name" ,2.0f)
.field("th_description")
.field("th_show_title")
.field("content")
Hope it helps someone else.
Edit: This has changed and does no longer work in ES 6.x and upwards.
You should also be able to boost a field directly in the Multi-match query:
"The multi_match query supports field boosting via ^ notation in the fields json field.
{
"multi_match" : {
"query" : "this is a test",
"fields" : [ "subject^2", "message" ]
}
}
In the above example hits in the subject field are 2 times more important than in the message field."
In the java-api, just use the MultiMatchQueryBuilder:
MultiMatchQueryBuilder builder =
new MultiMatchQueryBuilder( keyword, "th_name^2", "th_description", "th_show_title", "th_sh_category" );
Disclaimer: Not tested
You can use "BoostingQuery"
http://www.elasticsearch.org/guide/reference/query-dsl/boosting-query.html
javadoc : https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/query/BoostingQueryBuilder.java