More specifically I would like to get the labels in french, so instead of:
"labelAnnotations": [
{
"mid": "/m/019sc",
"description": "black",
"score": 0.95744693
},
{
"mid": "/m/07s6nbt",
"description": "text",
"score": 0.9175479
},
{
"mid": "/m/01zbnw",
"description": "screenshot",
"score": 0.8477094
}]
I would like to get:
"labelAnnotations": [
{
"mid": "/m/019sc",
"description": "noir",
"score": 0.95744693
},
{
"mid": "/m/07s6nbt",
"description": "texte",
"score": 0.9175479
},
{
"mid": "/m/01zbnw",
"description": "capture d'écran",
"score": 0.8477094
}]
Or is Google Translate API my only solution currently?
Google Cloud Vision API LABEL_DETECTION are returned in English only. The Cloud Translate API can translate English labels into any of a number of other languages.
Reference Detect Labels
Related
I'm trying to get all profiles using ~all option with this endpoint
https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles
It doesn't return all profiles due to ~all for accounts. If I include account ID instead of ~all, then it returns profiles based on that account id - which are missing when used with ~all option.
https://www.googleapis.com/analytics/v3/management/accounts/89478503/webproperties/~all/profiles
Am I doing something wrong or is this GA API bug?
I sugst you look into using account summaries list
GET https://www.googleapis.com/analytics/v3/management/accountSummaries
This will return all the account information for a user.
{
"kind": "analytics#accountSummaries",
"username": "me#gmail.com",
"totalResults": 15,
"startIndex": 1,
"itemsPerPage": 1000,
"items": [
{
"id": "59183475",
"kind": "analytics#accountSummary",
"name": "Cube Analytics",
"webProperties": [
{
"kind": "analytics#webPropertySummary",
"id": "UA-59183475-1",
"name": "Cube Analytics",
"internalWebPropertyId": "93305066",
"level": "STANDARD",
"websiteUrl": "XXXXXXX",
"profiles": [
{
"kind": "analytics#profileSummary",
"id": "115455750",
"name": "Alaternate",
"type": "WEB"
},
{
"kind": "analytics#profileSummary",
"id": "97191919",
"name": "All Web Site Data",
"type": "WEB"
},
{
"kind": "analytics#profileSummary",
"id": "178538323",
"name": "MobileView",
"type": "APP"
}
]
}, ]
}
By using this call you should only need to make one call and get all of the information back.
I am trying to create swagger json and trying to check it's validity in
http://editor.swagger.io
Upon validating the json, the above mentioned editor gives the following error:
Schema error should NOT have additional properties
additionalProperty: components
Jump to line 0
If for some reason I can't define an element named components at root level where i am going to have some sort of json schema, what is the right way to do a $ref on the schema for requestBody for an API operation as I intend to do as seen in my example below. Also, do you see anything wrong with my swagger json ?
My swagger json for swagger2.0 look like this.
{
"swagger": "2.0",
"info": {
"version": "1.0",
"title": "My swagger API",
"contact": {
"name": "myName",
"email": "abc#gmail.com"
}
},
"host": "localhost:1234",
"basePath": "/",
"tags": [{
"name": "someTagName",
"description": "this is a try"
}],
"components":{"schemas": {"myEndPoint": ""}},
"paths": {
"/myEndPoint": {
"post": {
"tags": ["some-tag"],
"summary": "myEndPoint endpoint will give you something",
"description": "some description will go here",
"operationId": "getMyEndPoint",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "somePayload",
"description": "somePayload is what this is",
"required": true,
"schema": {
"$ref": "#components/schemas/myEndPoint"
}
},
{
"in": "header",
"name": "Authorization",
"description": "auth token goes here",
"required": true,
"type": "string"
}],
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request"
}
}
}
}
}
}
You are mixing up OpenAPI 3.0 and 2.0 syntax. The components keyword is used in OpenAPI 3.0. In OpenAPI/Swagger 2.0, reusable schemas live under definitions:
"definitions": {
"myEndPoint": {
...
}
}
Make sure to also change the $ref to
"$ref": "#/definitions/myEndPoint"
I have been using OpenRefine 2.6 Beta 1 w/o problems since its release, and later, with the reconciliation service at:
http://reconcile.freebaseapps.com/reconcile
However, in the past fee days, I have not been able to use it all. If I go to the URL:
http://reconcile.freebaseapps.com/
and type the multiple query:
{
"query": "Ford",
"type": "/people/person",
"properties": [
{
"pid": "/people/person/place_of_birth",
"v": "Detroit"
}
]
}
I obtain:
{
"result": [
{
"id": "/m/0j8pb6y",
"name": "Ford",
"type": [
{
"id": "/people/person",
"name": "Person"
},
{
"id": "/common/topic",
"name": "Topic"
},
{
"id": "/geography/mountaineer",
"name": "Mountaineer"
}
],
"notable": [],
"score": 1.1546246,
"match": false
},
{
"id": "/m/01vd3gv",
"name": "Ford",
"type": [
{
"id": "/common/topic",
"name": "Topic"
},
{
"id": "/music/artist",
"name": "Musical Artist"
}
],
"notable": [],
"score": 1.0330245999999998,
"match": false
},
{
"id": "/m/0cmdhzt",
"name": "James Meredith",
"type": [
{
"id": "/common/topic",
"name": "Topic"
},
{
"id": "/people/person",
"name": "Person"
},
{
"id": "/military/military_person",
"name": "Military Person"
},
{
"id": "/people/deceased_person",
"name": "Deceased Person"
}
],
"notable": [],
"score": 0.0681692,
"match": false
}
],
"duration": 369
}
But if I try a simple query:
{
"query": "Ford"
}
I get:
Status: error Error:undefined
Any insights into what's happening with the reconciliation service? Is there any other service I could use to replace freebaseapps.com?
Thanks
Try this in Queries Parameter at http://reconcile.freebaseapps.com/
{
"q0": {
"query": "Ford"
}
}
For some reason, single queries are not accepted in Query Parameter but in Queries Parameter in the format above. I have not tested this in OpenRefine, so you might have to modify it.
I don't know for certain about the date, but Freebase was announced earlier this year as being shutdown by Jun 30, 2015, for some services. Maybe service is intermittent until full shutdown? Sorry, this answer probably doesn't help much.
I would like to use the Freebase Api to determine if a certain thing refers to an entity (e.g. person, tv show, ...). For instance "how i met your mother" refers to a TV show, "lana del rey" is a singer. However if something is not an entity, I would like to know that as well.
Unfortunately the Freebase search api gives me quite a few false positives for things that are not clear entities, even with the parameter exact=true and prefix=false:
For instance: https://www.googleapis.com/freebase/v1/search?query=girl&exact=true
[
{
"mid": "/m/0ytdbkr",
"name": "Naked girl",
"notable": {
"name": "Film character",
"id": "/film/film_character"
},
"lang": "en",
"score": 5.222793
},
{
"mid": "/m/0y4k26c",
"name": "Sexy girl",
"notable": {
"name": "Film character",
"id": "/film/film_character"
},
"lang": "en",
"score": 4.754522
},
{
"mid": "/m/0yg73tt",
"name": "Call girl",
"notable": {
"name": "Film character",
"id": "/film/film_character"
},
"lang": "en",
"score": 4.567947
},
{
"mid": "/m/0w1sb51",
"name": "Gorgeous girl",
"notable": {
"name": "Film character",
"id": "/film/film_character"
},
"lang": "en",
"score": 4.526981
},
{
"mid": "/m/03p0tvg",
"id": "/user/girl",
"name": "girl",
"lang": "en",
"score": 4.465735
},
{
"mid": "/m/05p197",
"id": "/en/bad_girl_movies",
"name": "Bad girl movies",
"notable": {
"name": "Film genre",
"id": "/film/film_genre"
},
"lang": "en",
"score": 4.464571
},
....
]
}
What's an "exact" match in this context?
If you simply want an exact name & type match, you can get that using the MQLRead API instead of the Freebase Search API. If you're looking for something different, you need to be more specific about what you seek...
I am curious if I can control the results of a query so that it will not display the a particular field in the query. For instance...
query:
[{
"id": null,
"name": null,
"type": "/people/person"
}]
result:
{
"result": [
{
"type": "/people/person",
"id": "/en/jack_abramoff",
"name": "Jack Abramoff"
},
{
"type": "/people/person",
"id": "/en/bob_ney",
"name": "Bob Ney"
},...
I have tried this...
[{
"id": null,
"name": null,
"type": [{
"id": "/people/person",
"limit": 0
}]
}]
Which gives me ...
{
"result": [
{
"type": [],
"id": "/en/jack_abramoff",
"name": "Jack Abramoff"
},
{
"type": [],
"id": "/en/bob_ney",
"name": "Bob Ney"
},...
I am wondering if there is a way to just get this
{
"result": [
{
"id": "/en/jack_abramoff",
"name": "Jack Abramoff"
},
{
"id": "/en/bob_ney",
"name": "Bob Ney"
},...
No, there is no way to do this. Why would you need to do this? Once you parse the JSON data in your application its very easy to just ignore any values that you don't need. The APIs support using gzip compression so you don't have to worry about the response size either. If you're really optimizing for speed you might consider switching to the Search API which looks like this:
https://www.googleapis.com/freebase/v1/search?filter=(all+type:/people/person)