MycroftAI / lingua-franca

Mycroft's multilingual text parsing and formatting library
Apache License 2.0
75 stars 79 forks source link

Cannot extract numbers hyphenated with word eg "2-day" #211

Open krisgesling opened 3 years ago

krisgesling commented 3 years ago

Describe the bug Some STT engines hyphenate the day count (i.e. 3-day). This is not currently handled by extract_number(). Can remove the hyphen if it is there as a work around, but would be nice to cover this scenario natively.

Are there are scenarios where "{number}-{word}" should not be extracted as a number?

I'm also interested in whether this affects other languages.

To Reproduce

        self.assertEqual(extract_number("give me the 2-day forecast"), 2)
        self.assertEqual(extract_number("3-day cruise"), 3)

Expected behavior Ability to extract numbers hyphenated to another word.

Context Identified in: https://github.com/MycroftAI/skill-weather/pull/185

ChanceNCounter commented 3 years ago

Are there are scenarios where "{number}-{word}" should not be extracted as a number?

Apartment/suite numbers, perhaps. Nothing else springs to mind.

Also the names of droids