Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 10-12-2021, 04:08 PM   #1
FrankJH
Member
FrankJH began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Oct 2021
Location: Stuttgart, Germany
Device: Galaxy Tab S7+
Dictionary as Epub

Dear All,

so far, my Google researches concerning this subject haven't been successful, so I took the liberty to ask a question here.

I'd like to create my own dictionaries.

I developped some Java-routines which are able to download specific sections from the English and French Wiktionary, process them and are able to output them in HTML.

Using CSS-Stylesheets, one can achieve a very good readability, but there's one problem.

I made a test with approximately 6000 entries ... these entries are linked via the table of contents to the explanations - this mean: a lot of href's.

It turned out to very slow ... anyway, it is also slow if I open my self-compiled dictionary page in a browser.

Obviously, using href's is not the best way to handle this ...

Has anyone of you experiences with a dictionary as an epub?

I guess one has to use a database ... but is this possible within an epub?

I think we have to use Javascript for these purposes ... but maybe I'm wrong ...

I'd also like to implement an index search ... this means: I use an input prompt, while typing the search term, proposals/term completions will be shown, e.g. if I type in the search term "for", proposals like "for", "forbidden", "foresake" will be shown.

If anybody has solved this problem, it would be very nice if he (or she) would share these experiences with me.

Best wishes, and thank you in advance, Frank

P.S. Please feel free to tell me that my ideas are wrong or if something of this kind won't work ...
FrankJH is offline   Reply With Quote
Old 10-12-2021, 05:58 PM   #2
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by FrankJH View Post
I guess one has to use a database ... but is this possible within an epub?
I think we have to use Javascript for these purposes ... but maybe I'm wrong
I experimented with this some time ago and found out that it's theoretically possible to embed a sqlite database in an epub and query it using a sqlite JavaScript library.
If you open my proof-of-concept epub3 file with Calibre Editor or Apple Books you should get single-word German definitions, if you click on book, house or mouse in the second paragraph.
However, if you look at the source files, you'll notice that the size of the 6 word demo database is already 164KB, which makes this approach impractical.

BTW, there's an IDPF dictionary proposal that nobody seems to be interested in.

You might want to look into creating Stardict dictionaries. They're supported by many Android epub apps and KOReader.

You could also simply convert your epubs to Kindle books and read them with one of the free Kindle apps, which come with excellent free dictionaries.

(You could also convert HTML source files (with custom markup) to Kindle dictionaries with KindleGen.)
Attached Files
File Type: epub Click_test_epub3.epub (412.2 KB, 222 views)
Doitsu is offline   Reply With Quote
Advert
Old 10-19-2021, 08:48 AM   #3
FrankJH
Member
FrankJH began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Oct 2021
Location: Stuttgart, Germany
Device: Galaxy Tab S7+
Hello Doitsu, thanks a lot for answering!

I see: I have to experiment a little ...

Kind regards, Frank
FrankJH is offline   Reply With Quote
Old 10-19-2021, 11:54 AM   #4
Sarmat89
Evangelist
Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.
 
Posts: 482
Karma: 2267928
Join Date: Nov 2015
Device: none
That's just another example of inadequacy of EPUB "standard" for real-life applications.
Sarmat89 is offline   Reply With Quote
Old 10-19-2021, 12:17 PM   #5
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,645
Karma: 5433388
Join Date: Nov 2009
Device: many
Given their size and need for direct or indexed access, dictionaries should really be provided as a system level service or networked resource and not as an epub (IMHO), and this really has nothing to do with the epub standard and more to do with inadequate or non-expandable e-reading devices.
KevinH is online now   Reply With Quote
Advert
Old 10-06-2022, 08:37 AM   #6
FrankJH
Member
FrankJH began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Oct 2021
Location: Stuttgart, Germany
Device: Galaxy Tab S7+
Hello Doitsu, it was last year - but I came back to your idea with the database now.

Or if someone else is able to help here ...

I created a large database with 2000 entries ... the size is 800 kb, but the performance
seems not to be the problem ...

I'm using Calibre to develop my dictionary ..

While editing the epub with Calibre, all went fine ... the database query works!

But if I choose "View" in Calibre, it doesn't work anymore ...

I use two html's ... the first for the input, the second as display. The problem must be
my submit function on the first page:

Code:
function submit()
{

    var params = new URLSearchParams();
    console.log("submit");
    params.append("DATA", "res"); //document.getElementById("myInput").value);
    window.location="./display.html"; //?"+params.toString();
}
Apparently, the "window.location" is the problem here ... in the "View" of calibre, I see
Code:
{"version":1,"tree":{"n":"html","c":[{"n":"head","x":"\n ","l":"\n","c":[{"n":"title","x":"word click test","l":"\n "},{"n":"script","l":"\n ","a":[["src","META-INF/jquery-1.11.3.min.js"],["type","text/javascript"]]},{"n":"script","l":"\n ","a":[["src","META-INF/wiktionary-parser.js"]]},{"n":"script","l":"\n ","a":[["src","META-INF/sql.js"],["type","text/javascript"]]},{"n":"script","l":"\n ","a":[["src","META-INF/script.js"],["type","text/javascript"]]},{"n":"script","x":"\n\n\n function init() {\n console.log(\"Init ...\");\n var params = new URLSearchParams(window.location.search);\n\n first = \"res\";//params.get(\"DATA\");\n document.getElementById(\"searchterm\").innerHTML = first;\n console.log(first);\n var outputdef = $(\"#def_pons\");\n getPonsDBInfo(first, function (data) {\n outputdef.html(\"","l":"\n ","c":[{"n":"b","x":"publicus","l":"\tStaatssklave, Unterbeamter, Polizist"},{"n":"br","l":"\");\n let s = data.toString();\n console.log(\"BD = \"+s);\n //s = data.join();//data.forEach(element => s += element);\n\n console.log(\"BD = \"+s);\n\n // outputdef[0].innerHTML=data;\n\n console.log(\"BD = \"+data.length);\n outputdef.html(data);\n // document.getElementById(\"#def_pons\").value=data[0];\n });\n }\n "}]},{"n":"br","l":"\n"}]},{"n":"body","x":"\n ","l":"\n\n","a":[["class","card"],["onload","init()"]],"c":[{"n":"a","l":"\n ","a":[["href","javascript:void(0)"],["data-ENfGg6KL7U9zSnuyGrNEu7","{\"name\": \"main.html\", \"frag\": \"\"}"]],"c":[{"n":"img","a":[["src","back.png"],["height","40px"],["width","40px"],["data-calibre-src","back.png"]]}]},{"n":"br","l":"\n\n "},{"n":"div","x":"\n ","l":"\n","a":[["id","lucere"]],"c":[{"n":"div","x":"\n ","l":"\n ","a":[["class","chapterbar"]],"c":[{"n":"span","l":"\n ","a":[["id","searchterm"]]}]},{"n":"div","x":"\n \n \n Defintionen\n ","l":"\n ","a":[["class","imagebar"]]},{"n":"div","x":"\n ","l":"\n\n ","a":[["class","section"]],"c":[{"n":"div","x":"\n ","l":"\n ","a":[["class","items"]],"c":[{"n":"div","x":"\n ","l":"\n ","a":[["class","tab_content"],["id","dict_tab_101"],["style","display:block"]],"c":[{"n":"div","x":"\n ","l":"\n ","a":[["class","part_main"]],"c":[{"n":"div","x":"\n ","l":"\n ","a":[["class","collins_content"]],"c":[{"n":"div","x":"\n \n ","l":"\n ","a":[["id","def_pons"],["class","explanation_item"]]}]}]}]}]}]},{"n":"div","x":"\n ","l":"\n ","a":[["class","imagebar"]],"c":[{"n":"img","l":"English\n ","a":[["src","british_flag.jpg"],["class","smallimage"],["data-calibre-src","british_flag.jpg"]]}]},{"n":"div","x":"\n ","l":"\n ","a":[["class","tab_content"],["style","display:block"]],"c":[{"n":"div","x":"\n ","l":"\n ","a":[["class","part_main"]],"c":[{"n":"div","x":"\n ","l":"\n ","a":[["class","collins_content"]],"c":[{"n":"div","x":"\n ","l":"\n ","a":[["class","explanation_item"]],"c":[{"n":"p","x":"\n ","l":"\n ","a":[["id","en"],["class","explanation_box"]]}]}]}]}]}]}]}]},"ns_map":["http://www.w3.org/1999/xhtml"]}
It is the content of my display, but it is shown as some kind of JSON object or so ...

I don't understand why this works in the edit mode but not in the view ...

Any ideas where the problem could be?

Kind regards, Frank
FrankJH is offline   Reply With Quote
Old 10-12-2022, 05:51 AM   #7
FrankJH
Member
FrankJH began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Oct 2021
Location: Stuttgart, Germany
Device: Galaxy Tab S7+
Tried a lot in the meantime, but no success ...

I tested my script on Lithium, Moon Reader, Reasily on my Android tabler... different behaviour, but I haven't received the desired results.

To conclude: I think Epub has not been designed for such purposes.

So I decided to do something different: I'm going to develop my own Android app
using React Native.

For those who are interested: you can find tutorials on Youtube:
  1. 12 Language Dictionary App in React JS

    https://www.youtube.com/watch?v=Nz6Q...1PXv16JRF-5y_5
  2. Create a Dictionary with React and Tailwind css

    https://www.youtube.com/watch?v=BfnbPwqHhfY&t=634s
  3. Dictionary | React App

    https://www.youtube.com/watch?v=dX9O...kfaGVQ4Wm8hnPo

All these are programmed with React - I have to use React Native, so we have to "redevelop" the source ... it is going to take some time, bit I thinks it's worth the efforts.

If this is useful for you: simply search for "react native tutorial" on Youtube, there are excellent courses ...

For me, I use (2.) as a template, because Tailwind looks amazing in my eyes ...

Kind regards, Frank
FrankJH is offline   Reply With Quote
Old 10-12-2022, 06:39 AM   #8
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by FrankJH View Post
Code:
  window.location="./display.html"; //?"+params.toString();
}
Apparently, the "window.location" is the problem here ... in the "View" of calibre, …
I’m just spit balling here…I haven’t delved into the coding… but, would you need a second period in front of the window location??

window.location="../display.html"

That would normally designate a file in the same folder.
Turtle91 is offline   Reply With Quote
Old 10-20-2022, 02:09 PM   #9
FrankJH
Member
FrankJH began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Oct 2021
Location: Stuttgart, Germany
Device: Galaxy Tab S7+
Thanks for answering ... I gave it up, spend too much time at trying

React Native is interesting ... made some progresses, and my personal dictionary is under construction

Best wishes, Frank
FrankJH is offline   Reply With Quote
Old 10-20-2022, 05:02 PM   #10
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,433
Karma: 145525534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Sarmat89 View Post
That's just another example of inadequacy of EPUB "standard" for real-life applications.
Sorry but since the ePub standard seems to be concerned with creating human readable books, I fail to see how the inability to run a database application is an inadequacy?

By your logic, my bicycle would be inadequate since it does not have VTOL capability.
DNSB is online now   Reply With Quote
Reply

Tags
dictionary


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
.epub dictionary to .mobi dictionary ssaahh Amazon Kindle 1 10-02-2020 10:17 AM
dictionary in epub varad General Discussions 1 08-29-2012 12:35 PM
Creating Dictionary in Epub Krystl Workshop 8 04-13-2012 09:58 AM
ePUB English dictionary & ePUB Bible Sabrina Introduce Yourself 7 08-30-2010 10:30 PM


All times are GMT -4. The time now is 04:23 PM.


MobileRead.com is a privately owned, operated and funded community.