daisy / pipeline-mod-braille

!! NOTE: This project is now part of the pipeline-modules project !! | Braille Production Modules for the DAISY Pipeline 2
1 stars 4 forks source link

Support hyphenation in dotify:translate #44

Closed bertfrees closed 9 years ago

bertfrees commented 9 years ago

@joeha480 Is this even possible because there is no way to get all possible break positions from a BrailleTranslatorResult?

joeha480 commented 9 years ago

With pre-translation, I think you are right. There would have to be some addition to the API to support it. Not sure if that is needed though. We should discuss it.

bertfrees commented 9 years ago

OK, I think if it would already be possible we should support it. But otherwise I'm not sure we should go there unless you are planning to do pre-translation in some situations.

joeha480 commented 9 years ago

I have added a new translator interface to dotify.api:1.3.0 called BrailleFilter. It is a simpler version of BrailleTranslator in that it does not support non-standard hyphenation and e.g. number continuation. Instead, you get all hyphenation points in the result (which is a string).

Like the BrailleTranslator, the BrailleFilter has a factory and a factor service (and an SPI counterpart).

Dotify does not use these factories directly (for obvious reasons), but implementations of BrailleFilter can easily be adapted into BrailleTranslators, so it's no big deal to support the BrailleTranslator interface if you have a BrailleFilter.

dotify.translator.impl:1.2.0 has a BrailleFilter implementation for Swedish.

bertfrees commented 9 years ago

@joeha480 Your new API seems to work for me. The DotifyTranslatorImpl class now supports pre-translation with hyphenation.