hocr-proofreader icon indicating copy to clipboard operation
hocr-proofreader copied to clipboard

select multi word

Open nikhilchh opened this issue 6 years ago • 19 comments

is there a way to enhance it in a way that i can select multiple words from hovering UI. And then use the combined content and combined bounding box to annotate things ?

nikhilchh avatar Nov 22 '18 10:11 nikhilchh

That's the plan :-) ... When having more time, I'll implement all that editing features ... currently it's more a reader than an editor ;-) Contributions are welcome :-)

not-implemented avatar Nov 22 '18 10:11 not-implemented

Thanks for the reply.

Can you tell what do I have to modify to make it work my local image and hocr file. ? Do I just have to provide the path of hocr and image somewhere in the code ? I tried to make a demo folder and added .hocr and .jpg there. But no success yet.

NOTE: I am very new to javascript/html .

nikhilchh avatar Nov 22 '18 14:11 nikhilchh

Just think of "main.js"/"index.html" as an example how to use the library.

There you can specify an URL for the hOCR file. The images should be referenced inside the hocr-file as relative path (relative to the baseUrl which is also set via hocrProofreader.setHocr(hocr, hocrBaseUrl);).

not-implemented avatar Nov 22 '18 14:11 not-implemented

OK, but in your example code, there is no hocr file and image. Can you please send your demo.hocr file so that I can see how exactly you write the information about the image inside hocr file.

And instead of passing URL can i just specify the path of the base directory where i keep .hocr file ?

The demo web link you have shared has a demo folder which contains pag1.jpg but there is not hocr file in that folder.

nikhilchh avatar Nov 22 '18 14:11 nikhilchh

Sure, the hOCR-File is referenced here as relative URL with the base directory (an URL can always be a relative path ;-)): https://github.com/not-implemented/hocr-proofreader/blob/master/main.js#L35

Just inspect my demo installation for the hOCR-File which is here: https://www.not-implemented.de/hocr-proofreader/demo/demo.hocr

The "page1.jpg" is rerefenced in the hOCR file (relative to the basePath):

<div class='ocr_page' id='page_1' title='image "page1.jpg"; bbox 0 0 2480 3507; ppageno 0'>

So is is loaded from: https://www.not-implemented.de/hocr-proofreader/demo/page1.jpg :-)

not-implemented avatar Nov 22 '18 16:11 not-implemented

ok cool. thanks for the detailed response. Does the image has to be "jpg" format only ? Because I wasn't successful with png or jpeg format.

OK. I was able to make it work. But no hovering or blue boxes. I can see image and hocr text now.

nikhilchh avatar Nov 23 '18 12:11 nikhilchh

All images supported by browsers should be fine. From this librarys point of view it's just a path/URL which is displayed as image by the browser. I do not know why PNG should not work.

not-implemented avatar Nov 23 '18 12:11 not-implemented

OK. I was able to make it work. But no hovering or blue boxes. I can see image and hocr text now.

Do I have to turn it on or something.

nikhilchh avatar Nov 23 '18 12:11 nikhilchh

Seems the CSS is missing. Just check for errors in the browser console/network tab, and maybe fix path in index.html

not-implemented avatar Nov 23 '18 12:11 not-implemented

Maybe my hocr is different from what your code expects. image

error i get:

image

I think it is related to scan_res line 304 hocr-proofreader.js

Someelse also had this issue i guess.

nikhilchh avatar Nov 23 '18 13:11 nikhilchh

I changed the code. and hard code the value to 300. image

And now i got this: image

nikhilchh avatar Nov 23 '18 13:11 nikhilchh

Hovering on image is working but not on hocr (no boxes on hocr portion (right)). Getting closer :D

nikhilchh avatar Nov 23 '18 13:11 nikhilchh

Also realised my hocr file doesn't have x_font and x_fsize. I think I will try to hard code this as well.

nikhilchh avatar Nov 23 '18 13:11 nikhilchh

Yes there may be a lot of small things that differ in hOCR files. Currently I focused on implementing the UI. When having more time, I'll improve the hOCR details.

For now you have to patch those hardcoded things until it fits your needs ;-)

not-implemented avatar Nov 23 '18 14:11 not-implemented

getting error : "Error loading url "demo/demo.hocr": HTTP connection error". have placed demo.hocr and page1.jpg in demo folder. could you please suggest.

ak2911 avatar May 15 '19 10:05 ak2911

@ak2911 you have to serve the application over a Webserver - or use Firefox - it supports loading local files via AJAX.

not-implemented avatar May 15 '19 20:05 not-implemented

Thanks for your reply. Not in Firefox, but it loaded in web server. Also image-hocr click/pointing not working other than header text. Any suggestion if you could please provide.

ak2911 avatar May 17 '19 05:05 ak2911

The whole project is still a proof-of-concept of the GUI ... there are still a lot of things to do :-)

not-implemented avatar May 17 '19 06:05 not-implemented

Thank you :) . Will try to check at my End. Once again thanks for the utility and your replies :)

ak2911 avatar May 17 '19 06:05 ak2911