10-12-2021, 04:08 PM | #1 |
Member
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 ... |
10-12-2021, 05:58 PM | #2 | |
Grand Sorcerer
Posts: 5,636
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
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.) |
|
Advert | |
|
10-19-2021, 08:48 AM | #3 |
Member
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 |
10-19-2021, 11:54 AM | #4 |
Evangelist
Posts: 496
Karma: 2267928
Join Date: Nov 2015
Device: none
|
That's just another example of inadequacy of EPUB "standard" for real-life applications.
|
10-19-2021, 12:17 PM | #5 |
Sigil Developer
Posts: 8,109
Karma: 5450184
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.
|
Advert | |
|
10-06-2022, 08:37 AM | #6 |
Member
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(); } 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"]} 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 |
10-12-2022, 05:51 AM | #7 |
Member
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:
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 |
10-12-2022, 06:39 AM | #8 | |
A Hairy Wizard
Posts: 3,208
Karma: 19000001
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Quote:
window.location="../display.html" That would normally designate a file in the same folder. |
|
10-20-2022, 02:09 PM | #9 |
Member
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 |
10-20-2022, 05:02 PM | #10 | |
Bibliophagist
Posts: 39,798
Karma: 154147706
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
By your logic, my bicycle would be inadequate since it does not have VTOL capability. |
|
Tags |
dictionary |
|
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 |