brailleapps / dotify.translator.impl

Provides an implementation of the translator interfaces in dotify.api
GNU Lesser General Public License v2.1
0 stars 4 forks source link

WIP: Add swedish short words filter #5

Open carl-textalk opened 5 years ago

carl-textalk commented 5 years ago

This is a concept of how to implement support for Swedish short script word translation. Please review these changes and give feedback whether this is a good start or not.

kalaspuffar commented 5 years ago

@bertfrees @joeha480

joeha480 commented 5 years ago

@carl-textalk @kalaspuffar It looks fine.

I would suggest changing terminology from "short script" to contracted braille. If you are going to support different levels of contraction, you can use the term grade. In the factory implementations (that you have yet to complete), you might have something like this:

The term "contracted" should typically be used for the most contracted option, unless that's a highly unusual option.

There's also a possibility to use other numbers, for example:

The grade system isn't really used in Sweden, so you should talk with @BWestling about what makes the most sense.

Also, I see that you have copied some code from SimpleUCharReplacer. That code is very old and perhaps not a very good template.

Style wise, I prefer to avoid using wildcard imports (e.g. java.util.*) and I prefer to use tabs over spaces. Since these things are highly debatable, I can't say it's wrong, and I am even hesitant to bring it up. All I can say is that nearly 100% of the code use specific imports and tabs, and adding this code as it is would make it less tidy. If I were to merge this, I would probably change this in the process.

bertfrees commented 5 years ago

I assume that U+2820 is the capital sign, so maybe put this in a constant? Makes it easier to read the code I think. Or just a comment would be fine too.

Of course I'm interested in the sv_SE-short-words.xml file as this could be used to make a Liblouis version of the translator (and also for our test data which we maintain here). But that's stuff for later maybe. Incidentally, a cool idea for Dotify could be to support our YAML test file format (or a subset of it). This could be a good starting point for implementing some of the Liblouis tables in Java.

carl-textalk commented 5 years ago

Hello! Thanks for the input. I have made some changes and would be interested to hear your thoughts @joeha480.