MycroftAI / adapt

Adapt Intent Parser
Apache License 2.0
712 stars 154 forks source link

object is not subscriptable #91

Closed ChristopherRogers1991 closed 5 years ago

ChristopherRogers1991 commented 5 years ago

It looks like there's a small error on 98 of intent.py: https://github.com/MycroftAI/adapt/blame/master/adapt/intent.py#L98

I'm not exactly sure why my current intent is ending up hitting this path (that apparently isn't hit by anything else), but the square brackets on the call to get should be parentheses. Otherwise this happens:

17:00:58.195 - mycroft.skills.intent_service:_adapt_intent_match:453 - ERROR - 'builtin_function_or_method' object is not subscriptable
Traceback (most recent call last):
  File "/home/chris/Code/mycroft-core/mycroft/skills/intent_service.py", line 440, in _adapt_intent_match
    context_manager=self.context_manager)]
  File "/home/chris/Code/mycroft-core/mycroft/skills/intent_service.py", line 437, in <listcomp>
    intents = [i for i in self.engine.determine_intent(
  File "/home/chris/Code/mycroft-core/.venv/lib/python3.6/site-packages/adapt/engine.py", line 123, in determine_intent
    best_intent, tags = self.__best_intent(result, remaining_context)
  File "/home/chris/Code/mycroft-core/.venv/lib/python3.6/site-packages/adapt/engine.py", line 73, in __best_intent
    i, tags = intent.validate_with_tags(parse_result.get('tags') + context_as_entities, parse_result.get('confidence'))
  File "/home/chris/Code/mycroft-core/.venv/lib/python3.6/site-packages/adapt/intent.py", line 167, in validate_with_tags
    best_resolution = resolve_one_of(tags, self.at_least_one)
  File "/home/chris/Code/mycroft-core/.venv/lib/python3.6/site-packages/adapt/intent.py", line 98, in resolve_one_of
    last_end_index = resolution.get[entity_type][-1].get('end_token')
TypeError: 'builtin_function_or_method' object is not subscriptable

PR incoming.