-
Notifications
You must be signed in to change notification settings - Fork 49
Problems pronouncing times and dates #14
Comments
This would be a great enhancement to add to gruut 🙂 I'm not currently working on something for this, so I'd be interested to hear from anyone about approaches that have been tried. My first instinct would be to add date and time regular expressions to each language.yml file, and then use a combination It'll be important to understand how dates and times are commonly pronounced for each language. Beyond month/day ordering, it matters if it should be e.g., "23 April" or "April 23rd". Any resources on those kinds of things would be very helpful! |
In German this topic is a little nightmare since all the pronunciations depend on what is happening around the date or time and if its singular or plural etc. 🙈 . All TTS developers arrive at this point sooner or later I guess and find some way to handle it. I'm not sure if the Mozilla people already thought about it? In Mary-TTS it was implemented somehow ... I think ... let me double-check. I think the most sophisticated way would be to approach this like an NLU problem. Collect a large number of sentences, mark the date and time, define the correct replacement, create some magical ANN, cast magic, let the system learn the rules 😝 😅 |
I just double-checked Mary-TTS behavior and its kind of funny ^^. I think they let Java reformat the date because if you use:
and if you flip the numbers like this:
... well I guess its better than nothing :-D [UPDATE]: Regular expressions for English in Mary-TSS seem to be rather strict and simple:
[UPDATE 2]:
If you point me in the right direction I could maybe spend some time playing with regular expressions and parsing for German and English :-) Some inspirations from Mary Java test code: link |
I've made a first pass at this in a side branch of gruut. It's pretty simplistic, but I'm curious what you think. For each language (currently just U.S. English), there is a set of datetime pattern triplets. Each triplet contains:
The I have some basic time examples working too (e.g., What do you think of this approach as a first pass? |
First impression is good 👍 . I'm just a little bit concerned about the question of how to distinguish Is it possible to run tests in a very basic environment (without installing all the big libraries)? I could clone the lib and create some test sentences. [EDIT] |
Ah, I've thought of that! Kind of a cop-out, but
Sure, give me some time and I can get a small script together.
This seems a bit to me like the cardinal vs. ordinal difference for numbers ("one" vs. "first"). I get around this in gruut by having a default (cardinal in this case), and then having a Any idea what these different sense of a date are called? |
I didn't quite get that, where is this suffix
Its a result of the declension of words which is basically non-existent in English (except for singular<->plural) 🙈 4.10.2021 (10/4/2021) can be: "the fourth of October" -> "der vierte Oktober" (Nominativ) |
As someone from a land where 4/10/2021 is "the fourth of October, Twenty-Twenty-One", locale-aware handling of dates is a plus... :) Here's a couple of thoughts on the topic... Input vs Output LocaleOne aspect of this issue that I think hasn't yet been mentioned is that locale-aware can be split into:
While my initial gut feeling is that I'd always want output based on my locale, on reflection it may depend on the content. e.g. if I'm reading a novel maybe its truer to the text for the American character to say "I'm looking forward to July Fourth Twenty Twenty-Two". Limited Set of Valid/Ambiguous DatesIn terms of date parsing, the other aspect to keep in mind is that there's only a limited number of valid dates (or equally, a limited number of ambiguous dates). So, for example, if a possible date is "20/6/2021" then it can un-ambiguously only be "20 June 2021". So perhaps a little more "intelligence" is also possible in terms of parsing--and maybe correct parsing is even possible in more circumstances: e.g. when a non-ambiguous date is encountered before an ambiguous date to select the correct format option for a specific document that contains some ambiguous dates. |
Potentially useful date format-related resources:
Other: |
It looks like the English and German voices fail to pronounce dates and times like this (only ones I've tested):
English:
4/23/2021, 5:02:54 PM
German:
23.4.2021, 17:02:51
I know this is a widely discussed problem in the TTS field and not so easy to solve, but maybe there is some smart python library that does the work ;-). A small script using regular expressions could be a start, but to make this work for every language there has to be some ML based procedure I guess.
Maybe you are already working on something? ^^
The text was updated successfully, but these errors were encountered: