sshniro/line-segmentation-algorithm-to-gcp-vision

rtl support

Opened this issue · 1 comments

hi,
please add rtl support.
just add an option to lang
and dont do the reverse in lines 21 and 22;

// rtl support

if(dir === 'rtl' ){
lines = lines;
rawText = raw;
}
else{
// reverse to use lifo, because array.shift() will consume 0(n)
lines = lines.reverse();
rawText = rawText.reverse();
}

Hi @danbete ,

Thank you for the suggestion, as mentioned it will be good to have as a configuration parameter to the library.

algorithm.initLineSegmentation(api_data, lang_configuration))

The default value for this can be left to right.

I will try to add support to the configurations sooner. Bu if you are interested then you can send a PR with the aforementioned changes.