0

I extracted text layer in XML from DjVu file, using djvutoxml tool from the DjvuLibre library. I have a text layer XML divided by lines.

What should I use to reformat lines to words?

I have this:

<LINE coords="a,b,c,d">Blabla1 blabla2 blabla3 blabla4.</LINE>

I want to change to:

<WORD coords="a,b,c,d">Blabla1</WORD>
<WORD><CHARACTER coords="a,b,c,d"> </CHARACTER></WORD>
<WORD coords="a,b,c,d">blabla2</WORD>
<WORD><CHARACTER coords="a,b,c,d"> </CHARACTER></WORD>
<WORD coords="a,b,c,d">blabla3</WORD>
<WORD><CHARACTER coords="a,b,c,d"> </CHARACTER></WORD>
<WORD coords="a,b,c,d">blabla4.</WORD>

or:

<WORD coords="a,b,c,d">Blabla1</WORD>
<WORD coords="a,b,c,d">blabla2</WORD>
<WORD coords="a,b,c,d">blabla3</WORD>
<WORD coords="a,b,c,d">blabla4.</WORD>

(Information about the whitespace do not interest me.)

"a,b,c,d" are representative characters for the cordinates.

Is there a free tool to divide lines into words?

Is the extractor set incorrectly, or has this already occurred when creating a DjVu file? (The application creates a text layer with lines rather than words.)

  • The text layer is added to the DJVU file by running some OCR software, that is what combines the characters into lines, not words. There is no way, without looking at the original glyphs in the graphics layer, what the coordinates are for the different words. Knowing how wide each character is, is not enough, especially if there is variable width spacing to fill out lines in the original image. Maybe re-OCR with different settings? – Anthon Jul 9 '18 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.