Commit Graph

91 Commits (dev)

Author SHA1 Message Date
Kris Gesling 3495acf9ab
Merge pull request #3003 from Joanguitar/dev
Add reusable PadatiousMatcher to speed up intent matching
2021-10-21 12:25:34 +09:30
Åke Forslund 693100e8c6 Match keyword entity terms in Mycroft with Adapt
This changes the internally used names for entities and entity values when
sent on the messagebus and used interanally in the intent service from start / end to entity_value and entity_type.

This makes the terminology easier to understand and follow across into Adapt.

The old terms are still included and usable for compatibility but should be
removed in an upcoming major release (22.02).
2021-09-26 19:15:17 +02:00
Joan 863e7844d1 Padatious doesn't need to run 3 times 2021-09-16 12:48:23 -04:00
Daniel McKnight 600aa76206
Add 'utterances' to message emitted to skill intent handler (#2997)
* Add 'utterances' to message emitted to skill intent handler

* Reformat comment to resolve PEP warnings

* Update comments per PR feedback

* Cut line-length for style compliance

Co-authored-by: Kris Gesling <kris.gesling@mycroft.ai>
2021-09-13 11:15:57 +09:30
Kris Gesling e75a05557b docstring cleanup 2021-05-11 15:10:32 +09:30
Kris Gesling 6327ac5dbb
Upgrade Lingua Franca to v0.4.1 (#2890)
**Update Lingua Franca to v0.4.1**

The update from Lingua Franca v0.2.x to v0.4.x includes few
breaking changes.
- Some API methods have been updated.
- Mycroft-core tests have been updated to reflect improvements in
  Lingua Franca's formatting and parsing.
- add LF default lang setting method to config.locale 
  including warning that this method will change in the future
- Add TODO's for 21.08 - moving more methods to LF
- simplify loading and setting default of languages in Skills service
- Remove unneeded wrappers for Lingua Franca functions
- Fix documentation of format and parse utils
- Fix test warnings
2021-05-08 08:34:02 +09:30
Kris Gesling a399b19fd6
Merge pull request #2849 from forslund/refactor/clean-intent-service
Remove intent-service backwards compatibilities
2021-03-11 15:26:26 +09:30
Åke Forslund 203e1fc740 Remove intent-service backwards compatibility
- Remove unused ContextManager import from mycroft.skills.intent_service
- Remove Old 'intent_failure' -> fallback handler
- Remove handling of fallback messages without the fallback_range
parameter
2021-03-07 12:59:59 +01:00
Kris Gesling 5ca342621d add skill_id to error msg 2021-02-08 16:57:07 +09:30
JarbasAI f1d7141bf2
fix/intent_api (#2786)
* fix/fix/intent_api

* get active skills

* fix/intent_api

* fix/intent_api

* typos

Co-authored-by: jarbasal <jarbasai@mailfence.com>
2020-12-31 12:56:44 +09:30
Åke Forslund fe4daa2565 Update Query api methods 2020-08-19 18:24:59 +02:00
Åke Forslund 8089411d93 Fix warnings from pylint in intent_service.py
- Add missing docstrings
- fix short variable names
- restructure return code
2020-08-13 09:28:23 +02:00
Åke Forslund 618daac9a4 Pair utterances with normalized versions
- Move setting original utterance to the respective intent service
- Remove botch limiting the intent service to a single STT hypothesis
2020-08-13 09:28:18 +02:00
Åke Forslund 008ab372fd FallbackService encapsulating fallback calls 2020-08-13 08:18:51 +02:00
Åke Forslund bb8d4e3c1f Generalization of intent service Episode IV
Simplify the handle_utterance into a list of intent matching functions
run in order until a match is found.

The resolution order is

- Converse
- Padatious High Confidence
- Adapt
- Fallback High priority
- Padatious Medium Confidence
- Fallback Medium priority
- Padatious Last ditch effore
- Fallback Low priority

This collects the many parts of where intent is handled into a single
location handling the entire flow.

The idea is that, in the end, all the skill calling should be done from
this method. The main intent parsers does this but the converse and
fallback still calls directly.
2020-08-13 08:12:53 +02:00
Åke Forslund 4c87bc23d4 Move padatious service to within the IntentService 2020-08-13 08:12:53 +02:00
Åke Forslund e93d23f0df Split out adapt from the intent_service. 2020-08-13 08:12:53 +02:00
Åke Forslund e9760cdce8 Normalize the lang code to lowercase only
This suites lingua franca better
2020-08-10 07:41:50 +02:00
Åke Forslund 6edaa58558 set active lang to configured if missing from STT
If the STT doesn't send a lang code fallback to configured language
instead of hardcoded en-us
2020-08-10 07:41:44 +02:00
Åke 28c3a61e1c
Merge pull request #2503 from forslund/bugfix/converse-error
Bugfix Converse error
2020-04-02 07:45:00 +02:00
Åke Forslund 35d9558998 Handle communication failure with converse handler 2020-03-24 10:42:07 +01:00
Åke Forslund f0a6d1a714 Minor clean up of intent_service.py
- Remove print statement
- Remove unused import
- Updated some docstrings
2020-03-15 19:23:25 +01:00
Åke Forslund 4982af46b1 Add check for empty skill IDs
Only allow non-empty skill IDs into the list of active skills
2020-03-15 19:23:25 +01:00
Åke Forslund 8e61019451 Copy the list of active skills during operations
A skill can be missed if a skill is removed (due to an error) from the
list during iteration
2020-03-15 19:23:25 +01:00
Åke Forslund 58f0ac8b9e Simplify the converse callings
Remove the use of the separate error message and use the wait_for_reply method
to get the converse result. The error message is left to guarantee
compatibility.
2020-03-07 11:11:21 +01:00
Åke Forslund 1fcaffa363 Use copy in loops where the len of active_skills may change 2020-03-03 21:41:03 +01:00
Åke Forslund ed4c6f7248 Fix resetting of converse state on STT failure
The handler was silently failing when the STT doesn't receive any data.
2020-03-02 11:25:23 +01:00
Åke 1afedb2dd2
Merge pull request #2468 from JarbasAl/feat/intent_api
intent api
2020-02-24 08:40:36 +01:00
jarbasal 3728e2013b norm utterances 2020-02-24 08:23:35 +01:00
jarbasal 74d07f0fdc Fix lang parameter 2020-02-24 08:23:26 +01:00
jarbasal 1e00347834 message fix 2020-02-24 07:46:46 +01:00
jarbasal d3037f2ba1 move to intent_service_interface 2020-02-24 07:46:46 +01:00
jarbasal f1c55cc809 padatious match 2020-02-24 07:46:46 +01:00
jarbasal 16f91c8ebe add regex 2020-02-24 07:46:46 +01:00
jarbasal 532bcc2b2a intent api 2020-02-24 07:46:46 +01:00
Åke Forslund e1fa0e3ad2 Set context from previous message when doing converse 2020-02-22 09:35:03 +01:00
Åke Forslund 1a0432255c Handle missing message idents in converse
Handle the case where context exists but without ident
2020-02-21 07:57:46 +01:00
Chris Veilleux 364c3991e7 fixed a spelling error 2019-09-28 12:55:31 -05:00
Åke Forslund 245a4cb698 Refactor adapt intent data loading routines
- The data loading no longer require the bus
- Add an intent service interface class for better testing
- Update test cases
2019-08-30 13:00:26 +02:00
Åke Forslund f5cdeb76ce Move open_intent_envelope to intent_service 2019-08-30 13:00:26 +02:00
Åke Forslund 466f187eb7 Remove extra LOG statement 2019-03-28 23:29:07 +01:00
Åke d2e6d310ad Run normalized also when raw matches None (#2073)
If no match was found for the non-normalized utterance it would jump to
the exception handler for StopIteration skipping the normalized step
altogether

This changes the next/StopIteration system for list comprehensions
2019-03-28 15:43:28 -05:00
Åke Forslund 381999d5a8 Minor issues
- padatious sentence defaults
- A bit more explanation about the adapt message utterance
2019-03-28 14:50:50 +01:00
Steve Penrod 342c730a97 Normalize utterances before intent handling
Previously Padatious intent matches were performed on non-normalized text, meaning that things like "what's the weather" wouldn't match a Padatious intent but
"what is the weather" would.

The "utterance" in Adapt intent data will still be non-normalized even if the intent match occurred on a normalized utterance. Retaining the existing behavior.

The "intent_failure" data.  In there, "utterance" is always the raw version, "norm_utt" is the normalized one.

Also added better debugging info for intent matching to the log.

Also addresses a rare issue with the old code where the Adapt context could
have been updated even if the Adapt intent wasn't actually invoked due to
a higher Padatious intent match.
2019-03-28 14:48:26 +01:00
Åke dfa714c56d
Merge pull request #2059 from MycroftAI/feature/padatious-priority
Adjust and document Padatious loose fallback priority
2019-03-21 23:38:25 +01:00
Steve Penrod 41773a039a Adjust and document Padatious loose fallback priority
The loose (conf > 0.5) Padatious match was previously occurring as Fallback
priority 99. The AIML fallback at priority 90 would consume lots of
utterances, interferring with many skills.  Now Padatious runs at priority
89.

Additionally, added documentation of the intent and fallback system, including
guidelines for priorities.
2019-03-21 17:16:07 -05:00
Steve Penrod 44f60ec6f3 Change default lang to None, not English
Much of the code used "en-us" as the default value when not specified.
This limited the internationalization potential.  Changing the default
to None and adds the ability to define the default lang code from other
locations in code.  E.g.

```python

from mycroft.util.lang import set_default_lang

set_default_lang("en-us")
print("English date: "+nice_date(dt))

set_default_lang("de-de")
print("German date: "+nice_date(dt))
```

This allows easier localization of Skills by having the framework set the default without any changes necessary by the Skill writers.

Other minor changes:
* Changed the default return value of get_gender*() to None instead of False
2019-03-14 10:57:31 +01:00
Åke Forslund be72733abb Fix context checks
- intent_service
- MycroftSkill
2019-02-26 15:46:12 +01:00
Åke Forslund 38701a9790 Remove inheritance from object
Inheriting from object isn't necessary in python3.
2019-01-11 09:24:21 +01:00
JarbasAI 29310363d7 fix converse (#1884)
- Fix Exception on non-existing instances crashes the handle_converse_request()
- Report error to intent service
- Cleanup of converse related code.
2018-11-20 14:31:49 +01:00