4

I have tried using API service:

response = requests.post('https://api.wit.ai/entities/wit$location/values?v=20160526', 
                         headers={'Authorization':'Bearer xxx'}, 
                         data=json.dumps({ "value":"London", 
                                           "expressions":["London"], 
                                           "metadata":"CITY_1234"}))

But the response i get is:

{'code': 'not-found',
 'error': "Entity '535a80ff-6399-4653-8b2a-c770dd014965' not found"}

I am pretty sure that entity named wit$location exists.

response = requests.get('https://api.wit.ai/entities/wit$location?v=20160526', 
                         headers={'Authorization':'Bearer xxx'})

And the response is:

{'builtin': True,
 'doc': '{"spanless":false,"short_desc":"specific position or '
        'address","long_desc":"Capture free text that\'s a typical location, '
        'place or address like `350 Cambridge Ave Palo Alto`, `925 Alma '
        'Street`, `SFO`, and `Sausalito, CA`.\\nUse wit/local_search_query for '
        'local place like `my flower shopt` and '
        '`Peet\'s`","examples":[{"expression":["meet me at","350 Cambridge Ave '
        'Palo Alto","at noon"],"response":"\\"entities\\" : {\\n      '
        '\\"location\\" : [ {\\n        \\"value\\" : \\"350 Cambridge Ave '
        'Palo Alto\\"\\n      } ]\\n    '
        '}","$$hashKey":"070"},{"expression":["go to","925 Alma '
        'street",""],"response":"\\"entities\\" : {\\n      \\"location\\" : [ '
        '{\\n        \\"value\\" : \\"925 Alma street\\"\\n      } ]\\n    '
        '}","$$hashKey":"07Z"},{"expression":["i need a ride to","Sausalito, '
        'CA",""],"response":"\\"entities\\" : {\\n      \\"location\\" : [ '
        '{\\n        \\"value\\" : \\"Sausalito, CA\\"\\n      } ]\\n    '
        '}","$$hashKey":"081"},{"expression":["I came '
        'from","SFO","?"],"response":"\\"entities\\" : {\\n      '
        '\\"location\\" : [ {\\n        \\"value\\" : \\"SFO\\"\\n      } '
        ']\\n    '
        '}","$$hashKey":"083"}],"similar_wisps":[{"name":"wit/local_search_query","$$hashKey":"072"}]}',
 'exotic': False,
 'id': '535a80ff-6399-4653-8b2a-c770dd014965',
 'lang': 'en',
 'lookups': ['free-text'],
 'name': 'location',
 'values': []}

I want to be able to add values to wit$location entity.

Pawel Gradecki
  • 3,476
  • 6
  • 22
  • 37
Anubhav Singh
  • 587
  • 2
  • 11

1 Answers1

0

As far as I know you can't edit/add to the built in entities. The reason is that maybe you would like to add all cities in star wars, or in your obscure area, but other people would not like to have them pop up.

My work around is to add an entity called "my_city" and add the cities you specifically want to recognize to that entity. In your code you simply check for one of the two entities when checking a location...

Hope this helps, and good luck!

rmeertens
  • 4,383
  • 3
  • 17
  • 42
  • I want to be able to add a text like 'I am new in Paris' to the entity 'wit$location' without the assistance of GUI and receieve a api response like: ``` [ { "confidence": null, "intent": "default_intent", "_text": "I am new in Paris", "entities": { "location": [ { "suggested": true, "confidence": 0.99637981156554, "value": "Paris", "type": "value" } ] } } ] ``` – Anubhav Singh Jul 15 '17 at 08:11