SethRobinson / UGT

Universal Game Translator - Uses Google's Cloud Vision to read and speak dialog from any image/game in any language
https://www.codedojo.com/?p=2426
Other
120 stars 24 forks source link

Often times the sentence is not unique and it splits, so when doing machine translation it is never correct #45

Open Cloudstrifeff7 opened 1 year ago

Cloudstrifeff7 commented 1 year ago

Good morning, I am trying to get the text with UGT on Tactics Ogre Reborn but often times the sentence is not unique and it splits, so when doing machine translation it is never correct. I tried editing auto_glue settings but I didn't solve it.

Here are some examples. So is it possible to get a single sentence? Thank you very much!

image

NO... THIS WON'T END WELL. AND WHAT DO WE "GAIN" BY TAKING THEIR LIVES, ANYWAY?

image

THE TURMOIL OF THE LAST WAR HAS ONLY JUST SETTLED, AND YOU'D START ANOTHER?

SethRobinson commented 1 year ago

Hmm.. For me it worked 2 out of 3 times, but I guess it kind of depends on zoom levels.

Two things to try:

One: If the problem is it's decided it's not dialog and is processing it as "line by line" (white text), then press D, and it will change to green and 'connect' them together into one sentence.

Two: If it's actually separated them completely, try raising a few settings in your config.txt file.

By default, it will have this:

auto_glue_vertical_tolerance|0.20

;set higher to auto-glue things more even when the next line doesn't start at the same horizontal place
auto_glue_horizontal_tolerance|0.30

You can set it to 0.30 and 0.40 for instance and it will tend to glue things together more aggressively.

Cloudstrifeff7 commented 1 year ago

Hmm.. For me it worked 2 out of 3 times, but I guess it kind of depends on zoom levels.

Two things to try:

One: If the problem is it's decided it's not dialog and is processing it as "line by line" (white text), then press D, and it will change to green and 'connect' them together into one sentence.

Two: If it's actually separated them completely, try raising a few settings in your config.txt file.

By default, it will have this:

auto_glue_vertical_tolerance|0.20

;set higher to auto-glue things more even when the next line doesn't start at the same horizontal place
auto_glue_horizontal_tolerance|0.30

You can set it to 0.30 and 0.40 for instance and it will tend to glue things together more aggressively.

Thank you very much for your answer. I also solved with another method although the translation does not happen directly with UGT but with another program. With UGT I put the text in the clipboard and through another program that automatically captures the contents of the clipboard and translates I set that "\n" becomes "" (or " "). This way I get a single sentence! It would not hurt to give the possibility to replace certain characters with others or to put an option with UGT in config where you give the possibility to remove the detected "\n" so that you have several sentences in one sentence. This is because having removed "\n" the unique phrase occurs each time.