MycroftAI / lingua-franca

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

Feature Request: Expand units for speaking #111

Open nielstron opened 6 years ago

nielstron commented 6 years ago

Just like the currently available methods nice_number for converting an integer to a nicely speakable version, there could be a method nice_unit or expand_unit for converting string containing units to a speakable string.

i.e. "The power plant produced 10Wh today" => "The power plant produced ten watt hours today" "The bathroom temperature is 22 C" => "The bathroom temperature is twenty two degrees celsius"

There exist tools for unit extraction from unstructured text like quantulum (or its python3 equivalent with further development quantulum3). These tools can be used (or supply a method, see inline_parse_and_expand at quantulum3), to convert the unit into a string.

It can be a very helpful method, used to expand wikipedia articles, wolframalpha answers or home assistant replies.

forslund commented 4 years ago

This is something for lingua-franca now. Closing the issue here.

JarbasAl commented 4 years ago

2 closes this once merged