This removes the whole mycroft.util.lang submodule replacing it with a
minimum needed set of functions
extract_datetime: when a date was missing en-us would return the current date
to not mess up existing skills. This is no longer the case, if an
utterance doesn't contain a date the function will return None as
indicated by the docstring
The functions are still there providing the docstrings but calling the
lingua_franca functions.
Note, there is a INTENTIONAL addition of an inconsistence. Making the
extract_datetime return todays date instead of None as is documented.
This needs to be removed as soon as the mycroft default skills have been
added.
The check for "this" performed in the case of "this quarter of an hour"
was copy/pasted in a large checkin. The change it made to
daySpecified made no difference since the or in the later code
looked for an unspecified absolute hour. I can come up with no
senseable phrase that matches the conditions and couldn't even
create a nonsensical phrase that made a difference.
Since all of the existing unit tests pass without this code,
I'm going to just remove it.
- Fix: isFractional_es() parsed fractions incorrectly
- Update: earlier commit msg suggested another fix:
- Month parsing not fixed
- Several failing tests (skipped) document problem
- TODO and an issue also created
- Substantially improve parse_es.py test coverage
- TODO or comment several found bugs
- Many lines remain uncovered, incl possible bugs
- Fix bug causing extractnumber_es to return a sum instead of a list
- Add Spanish parser to extract_numbers and extract_number
==== Fixed Issues ====
Closes#2310
==== Tech Notes ====
Further obscures #2056: short_scale and ordinals parameters added to the
Spanish parsers, but they don't do anything. Present for compat only.
There is a TODO for this.
==== Localization Notes ====
It's all Spanish stuff!
This will require a native Spanish speaker to analyze the relationship
between extractnumber and isFractional, and determine why certain
fractions do not parse correctly. There is a TODO for this.
- Remove unreachable conditions from parse_en:1122-1133
- input string passed through clean_string() on line 763
- articles stripped from input before line 1122
- removed conditions relied on presence of "the" in input
- Improved test coverage on parse_en.py by approx 65 statements
- Directly test certain helper functions which are difficult to
invoke indirectly
- Add tests for certain missed conditions
- Approx. 20 uncovered statements remain
Add one more optional parameter: bool clock, always produces
digital clock-like output. "0h 3m" becomes "0:03:00".
Has no effect on resolutions YEARS or DAYS, and MINUTES won't print hrs.
- Companion enum:
mycroft.util.format.TimeResolution
offers YEARS, DAYS, HOURS, MINUTES, SECONDS, or MILLISECONDS
- Will only return ms if MILLISECONDS is chosen. Default: SECONDS
- Update tests
==== Fixed Issues ====
#2333
==== Tech Notes ====
extract_datetime("day after tomorrow") attempted to check the previous
word. This resulted in an index error. Fixed by introducing a nested
condition. Seems to have solved it.
A similar bug is present in other parts of this file, such as line 843.
I have also discovered a number of other oddities, but they may be
outside the scope of this issue. At least Mycroft can now extract from
"day after tomorrow."
==== Localization Notes ====
I haven't checked parsers for any other languages.
This handles capture portals as well.
The standard connection logic is now
Check outside ip is reachable and after that check that www.google.com
is resolvable and connectable.
TODO: create endpoint on backend with known response to perform check
upon.