Commit Graph

338 Commits (8e495870c2de5082cb11d0f20375a6c273f1e7f4)

Author SHA1 Message Date
Åke 8e495870c2 Feature/skill manager error checks (#1981)
* Attempt to create skill directory if not existing

* Handle missing priority skills

* Minor update of comments

* Handle skill load exception

Make sure an exception while trying to load/reload skill doesn't shutdown thread.

* Handle MsmException during SkillManager creation

If SkillManager can't be created due to an MsmException wait for network connection and retry.

* Update immediately if skill install file is missing

Missing skill install file indicates that this is a new venv and the requirements of the skills will need to be reinstalled.

* Add basic test for skill_manager

Basically only creating the skill_manager but it ensures that msm can be used on all supported python versions
2019-02-28 00:18:48 -06:00
Ale df7dfaa006 Update parse_it.py to 18.8.12 (#1990)
* update functions in parse_it.py
* update tests
* translate docstrings to english
2019-02-27 08:00:50 +01:00
Åke faf29d1fef
Merge pull request #2009 from MycroftAI/bugfix/voc-match
Fix behavior of MycroftSkills.voc_match()
2019-02-24 15:50:25 +01:00
Kris Gesling 6bfe8e26b0
Fix typo: "excepected" > "expected" 2019-02-24 17:04:14 +09:30
Åke Forslund 40eca55cf2 Expand .voc files in MycroftSkill.voc_match()
- Create a read_vocab_file() function that normal vocab loading and voc_match both uses. This function handles blank lines and comments
- Use a simpler regex instead of word logic to match
- Add a couple of test cases for the method
2019-02-22 18:49:01 +01:00
Åke Forslund 5614c5fb38 Add a couple of simple tests for german join_list 2019-02-19 08:08:23 +01:00
Åke 65a7197519
Merge pull request #1977 from ChristopherRogers1991/feature/issue-1959
Add extract_duration() method
2019-02-13 16:08:49 +01:00
Steve Penrod 065273bf4f New formatters: nice_duration() and join_list() (#1988)
* New formatters:  nice_duration() and join_list()

Adding two new formatting functions:
* nice_duration(duration, lang="en-us", speech=True)
  Accept seconds or duration and produce a nice sounding duration.
  Example:  nice_duration(61) == "one minute one second"
            nice_duration(61, speech=False) == "1:01"
* join_list(items, connector, sep=None, lang="en-us")
  Example:  join_list(["a", "b", "c"], "and") == "a, b and c"

This includes a translation helper that uses text files in the
mycroft/res/text/LANG/ directory, such as "second.word".
2019-02-13 12:52:35 +01:00
Ale 307910e53e update format_it.py test_format_it.py (#1984)
* Update format_it.py and tests
2019-02-11 18:07:14 +01:00
Chris Rogers cdf7dc3756 Use datetime.timedelta for extract_duration_en.
This is in support of issues-1959.
2019-02-03 12:16:36 -05:00
Chris Rogers 351381bca2 Fix pep8 issues.
This is in support of issues-1959.
2019-02-02 14:03:19 -05:00
Chris Rogers 534ca2aff9 All regressions in number parsing fixed.
This is in support of issues-1959.
2019-02-02 13:12:25 -05:00
Chris Rogers 6da1ec5c6e Fix regression in number parsing.
Fix regression that caused "X and one half" to parse as just X.

This is in support of issues-1959.
2019-02-01 23:24:45 -05:00
Chris Rogers f4eee8726a Refactor many methods in parse_en.
This improves the utility of the _ReplaceableNumber class, and updates
most of the number parsing functions to take tokens rather than text.
This simplifies the interactions between many of the functions, as there
is no need to convert back and forth between text and tokens.

This also adds some tests. Note that there are a few regressions that
will be fixed in a subsequent commit.
2019-02-01 23:04:54 -05:00
Chris Rogers cbebf957e4 Add tests for extract_duration_en.
This is in support of issues-1959.
2019-02-01 18:22:46 -05:00
Åke 31656d6294 Add tests for commented dialogs and DialogLoader (#1853)
* Add tests for DialogLoader

* Handle Path/PosixPath

LOG messages when files/directories were missing would fail when a PosixPath/Path object was sent to as argument. This uses format to get the correct string representation.

* Add test for dialog.get()
2019-01-31 02:34:44 -06:00
Chris Rogers 31760e6c9c Fix existing extract_duration tests.
This is in support of issues-1959.
2019-01-29 20:31:31 -05:00
Chris Rogers 9ff7fd5452 Fix issues with extractnumber_en_with_text
Issues fixed:
Lists, e.g. "some words one two three" would return (3, "one two three")
Negaitve words were not included in output, e.g. "negative five" would
return (-5, "five").

This is in support of issues-1959.
2019-01-29 19:53:30 -05:00
Chris Rogers 12e5fd603a Implement methods useful for extract_duration
Methods implemented include:

extract_number_with_text
extract_numbers_with_text
convert_words_to_numbers
extract_duration

This is in support of issues-1959. This continues the work of
returning the relevant text that corresponds to a number
parsed from a string.
2019-01-28 17:04:12 -05:00
Chris Rogers 3a9f11c67e Add extract_duration skeleton 2019-01-23 18:25:22 -05:00
Chris Rogers 12a55c4cb8 Issues-1962 - Fix/add tests for normalize 2019-01-21 18:44:20 -05:00
Åke Forslund f106f9603f Revert "Merge pull request #1889 from forslund/feature/threaded-emitter"
This reverts commit cb891ecf2f, reversing
changes made to 876b5393f7.
2019-01-17 11:11:43 +01:00
Matthew D. Scholefield cb891ecf2f
Merge pull request #1889 from forslund/feature/threaded-emitter
Run emitter using threadpool
2019-01-16 10:37:38 -06:00
G3RB3N 876b5393f7 Dev add nl nl (#1906)
* Added nl-nl voc, dialogs and formatter
2019-01-16 13:48:41 +01:00
Matthew Scholefield c3b7060330 Add failing unit tests for threaded event emitter 2019-01-15 12:32:32 -06:00
Åke 4e10339f55
Merge pull request #1912 from aleale99/dev
Updated:
- nice_date()
- pronounce_number()
2019-01-12 13:07:19 +01:00
Ale 3fc29e0e96
insert test and cleanup
specific test for  short_scale=True
2019-01-03 18:16:09 +01:00
Åke c92f92de4f Bugfix/mimic2 negative numbers (#1927)
* Fix mimic2 negative numbers

Make the regex extracting numbers also match negative numbers when preparsing phrases sent to the mimic2 service

* Update pronounce_number to use "minus" for negatives

After discussion in the chat it was suggested to use "minus" for negatives as default.

When scientific notation is used the term "negative " is still used.
2019-01-02 16:36:04 -06:00
Ale 57d439b6bd
Update test_format_it.py
correct pep 8 error line 218
2018-12-22 18:10:32 +01:00
Ale 499af68155
Update test_format_it.py
New tests for  nice_number(): 
    -test_specify_denominator
    -test_no_speech
New tests for pronounce_number
   -test_convert_hundreds
   -test_convert_scientific_notation
   -test_large_numbers
2018-12-22 11:25:01 +01:00
danielwine 7ec96b0d07 Add format_hu and update format.py along with tests 2018-12-04 15:09:20 +01:00
Åke Forslund 77c76416d3 Update "third one" test to match behaviour 2018-11-26 09:26:43 +01:00
Kris Gesling 32a3860bce Issue-1877 - fix ordinal followed by one
"Third one" will now return the expected 3 instead of 1.
2018-11-26 09:25:44 +01:00
Åke Forslund 7dcffab3f9 include skill_id in response
The intent_service now require the skill_id field to exist in the response, the converse request response now respons with the requested skill_id
2018-11-21 10:56:13 +01:00
JarbasAI 60d2905678 feature/extract multiple numbers from text (#1867)
Add extract_numbers() function

The function extracts all numbers from the input string and returns them as a list.
2018-11-19 12:39:59 +01:00
jarbasal fa2b3007a9 improve datetime parsing with long times and a couple
add support for decades, centuries, millemniums
add support for "within the hour", "in a second/minute",
add support for "a couple time_unit" and "a couple of time_unit"
2018-11-17 09:03:41 +01:00
Åke 3fc39e8ed2 Skilltester extension for Common Playback Skill functions (#1864)
* Add lt and gt to skill tester evaluation vocabulary

lt returns True if message item is LESS THAN the value in the config
gt returns True if message item is GREATER THAN the value in the config

* Add separate Exception for Skilltest errors

* Add support for common playback skill messages

CPS_query:

new test json possibilities
play_query: Emits a message that can be catched by CPS_match_query_phrase()
play_query_match: Structure with info of the expected match
  "phrase": matched phrase
  "confidence_threshold": The minimum confidence the phrase should result in

Example:
{
  "play_query": "the news",
  "play_query_match": {
    "phrase": "the news",
    "confidence_threshold":  0.8
  }
}

"play_start": Emits message that can be catched by CPS_start using sub-fields.
  "phrase": matched phrase
  "callback_data": dict with info for the function

Example:
{
  "play_start": {
    "phrase": "the news",
    "callback_data": {
    }
  },
  "expected_data": {"__type__": "mycroft.audio.service.play"}
}
2018-11-16 17:58:17 -06:00
jarbasal d9a905c8b1 extract date time improvements 2018-11-07 04:14:21 +00:00
Åke a8ad991029
Merge pull request #1848 from nielstron/feature/unittest_dialog
Test: dialog component
2018-10-16 17:03:04 +02:00
Matthew D. Scholefield 6f0489423c
Merge pull request #1618 from forslund/feature/test-report-loading-issues
Add info when skill fails to load during tests
2018-10-15 11:21:49 -05:00
Niels Mündler 66705f4c1e Add multiple line tests
Add tests for dialogs with multiple lines, remove comment test as it didn't work
Also fix unittest for unknown templates

==== Fixed Issues ====
1829

====  Tech Notes ====
NONE - explain new algorithms in detail, tool changes, etc.

====  Documentation Notes ====
NONE - description of a new feature or notes on behavior changes

==== Localization Notes ====
NONE - point to new strings, language specific functions, etc.

==== Environment Notes ====
NONE - new package requirements, new files being written to disk, etc.

==== Protocol Notes ====
NONE - message types added or changed, new signals, APIs, etc.
2018-10-15 02:48:07 +02:00
Niels Mündler 75b2ead5f0 Include better test names and real working tests
This is the template for commits to mycroft-core and also an example of
a commit message. To use this template, change the first line (think of
it as a "headline" for the commit) and then edit this message with a
longer description of the change.  To be nice, keep lines to 72
characters or less (The first two lines of this template are exactly
that length).  Also use imperative writing, e.g. "Fix broken code" or
"Implement my new feature", not "Fixes the broken code" or
"Implemented my new feature".

Sections below can then be filled out and edited as appropriate.
Unused sections can optionally be removed.

Please fill this out carefully.  This moment is when the code is
clearest in the mind of you, the foremost expert in this change.
Please pause to think of side effects and impacts.

==== Fixed Issues ====
NONE - replace with associated issue numbers, e.g. #123, #304

====  Tech Notes ====
NONE - explain new algorithms in detail, tool changes, etc.

====  Documentation Notes ====
NONE - description of a new feature or notes on behavior changes

==== Localization Notes ====
NONE - point to new strings, language specific functions, etc.

==== Environment Notes ====
NONE - new package requirements, new files being written to disk, etc.

==== Protocol Notes ====
NONE - message types added or changed, new signals, APIs, etc.
2018-10-15 00:36:15 +02:00
Niels Mündler b4b52a5c23 Add dialog unittest
==== Fixed Issues ====
1829

====  Tech Notes ====
NONE - explain new algorithms in detail, tool changes, etc.

====  Documentation Notes ====
NONE - description of a new feature or notes on behavior changes

==== Localization Notes ====
NONE - point to new strings, language specific functions, etc.

==== Environment Notes ====
NONE - new package requirements, new files being written to disk, etc.

==== Protocol Notes ====
NONE - message types added or changed, new signals, APIs, etc.
2018-10-15 00:36:15 +02:00
Niels Mündler 1b16b4dbaf Include problematic input from #1718 as test
Fix trillion being saved with wrong number (10e10 instead of 10e12)

==== Fixed Issues ====
1718

====  Tech Notes ====
NONE - explain new algorithms in detail, tool changes, etc.

====  Documentation Notes ====
NONE - description of a new feature or notes on behavior changes

==== Localization Notes ====
NONE - point to new strings, language specific functions, etc.

==== Environment Notes ====
NONE - new package requirements, new files being written to disk, etc.

==== Protocol Notes ====
NONE - message types added or changed, new signals, APIs, etc.
2018-10-09 13:18:13 +02:00
Niels Mündler 7c9ae548da Fix pronouncing of fairly large numbers and simplify terms
==== Fixed Issues ====

====  Tech Notes ====
NONE - explain new algorithms in detail, tool changes, etc.

====  Documentation Notes ====
NONE - description of a new feature or notes on behavior changes

==== Localization Notes ====
NONE - point to new strings, language specific functions, etc.

==== Environment Notes ====
NONE - new package requirements, new files being written to disk, etc.

==== Protocol Notes ====
NONE - message types added or changed, new signals, APIs, etc.
2018-10-09 01:12:03 +02:00
Niels Mündler a01f11f30a Fix large numbers in short and long scale, include tests 2018-10-09 00:08:14 +02:00
Åke 83e1ed1d3c
Merge pull request #1815 from JarbasAl/feature/cross_context
feature: allow adapt context across skills
2018-10-08 22:57:04 +02:00
Åke Forslund b761f02dfb Make ContextManager handle cross intent context
This makes a cross context call be treated as one level when calculating the probability. this makes previous contexes not be completely invalidated when a cross context call is sent.
2018-10-08 14:17:52 +02:00
jarbasal 0eb397f0db unittest 2018-09-26 20:22:23 +01:00
Åke Forslund 8a77892821 Fix test_setup issue in discover_test.py 2018-09-26 09:58:52 +02:00