Add stress marks to phoneme events #1700
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've added stress marks to phoneme events.
The implications of this are large for using
eSpeak-ng
as a phonemizer. It means that it's now possible to get accurate mappings between the phonemized word and the original word (up till now it was pretty much impossible). This is huge for many applications that use it as a side-tool.I have tested this for several weeks now, with many languages, and it seems to work correctly and produce results that should be identical to calling
espeak_TextToPhonemes
when the phonemes are in IPA mode (I haven't tested Kirshenbaum phoneme names though, but they should work as well - it's just that I'm using it via Emscripten and the IPA output flag is "burned" into the code).This is the main method I've added to output the phoneme names with stress marks:
(The local constant
const char stress_chars[] = "==,,''";
is somewhat of a "hack". This should be a global constant, but I didn't want to modify other methods to use this)That method is based, almost exactly, on a code fragment I found in
GetTranslatedPhonemeString
:However, the way it's done now - it's a minor breaking change.
I guess it would be better to enable this feature via a flag, but I don't have sufficient knowledge of the codebase to implement something like that.
I'll give this code to you people to decide how and if you want to integrate it.
I have more code to contribute: For example: I've enhanced the Emscripten port to support events (and phoneme events in particular), and I've tested it extensively for more than 6 months now.