04-19-2019, 02:53 AM | #16 | |
Junior Member
Posts: 7
Karma: 10
Join Date: Apr 2019
Device: Kobo H20 Edition 2
|
Quote:
|
|
04-19-2019, 06:32 PM | #17 |
Addict
Posts: 229
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
|
|
04-21-2019, 05:01 AM | #18 | |
Junior Member
Posts: 7
Karma: 10
Join Date: Apr 2019
Device: Kobo H20 Edition 2
|
Quote:
|
|
04-22-2019, 12:04 AM | #19 |
Addict
Posts: 229
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
|
Step-by-step Penelope 3.1.3
Step-by-step procedure that uses latest (as of September 23, 2016) 3.1.3 version of Penelopa script (for Windows only (see also post #5) )
-------- Note: 3.1.3 has ability to build combined dictionaries, that is it has the capacity to merge a few input dictionaries into one dictionary with unified respective vocabulary entries (see below). -------- For example, you have Norwegian-English dictionary in Stardict format, you're intending to read Norwegian book and want to look up that dictionary on Kobo reader. Stardict dictionary consists of three files with extensions dict (or dict.dz), idx, and ifo. All three files have the same name. Compress all three files into a zip file with name of your choice, let it be dict.zip. Put dict.zip into any folder, let it be C:\Kobo dictionaries. 1. Install prerequisites: - Python 3.4 for 64bit Windows (checked version 3.4 only, 3.6 may have issues). On Python install, do not forget to set checkbox "Add python.exe to PATH". This will warrant that Python call from any Windows folder finds and starts python.exe. - lxml library for Python 3.4. Latest available Windows lxml installer for Python 3.4 is lxml-3.8.0.win-amd64-py3.4.exe (get it here). Note: You may install Python 3.4 for 32bit Windows but than you must install respective version of lxml (if you succeed to find one). 2. Download script penelope 3.1.3 from here (Source code (zip). 3. Unzip Penelope script and copy contents of folder penelope-master to folder of your choice (for further explanations let's name this folder D:\Converters\Kobo). You'll copy subfolders bin, penelope and a few other files. 4. Open subfolder bin and rename file penelope (this is actually python code without extention) as penelope.py. Copy renamed file to folder D:\Converters\Kobo. Now you can safely delete folder bin with its content. 5. Download file marisa.zip attached to the post #5. It contains two Windows executables I built from the open source Marisa code. Penelope script needs these executables to run correctly. Unzip and place both exe anywhere; I put them to C:\tmp. 6. Now there is some work to be done to slightly modify the penelope code. These modifications are imperative because we should be prohibited to script to use some additional module that contains marisa software. The point is this module demands you to install some Mictosoft environment for c++ development on your computer. To avoid this installation we stored marisa exe modules to C:\tmp (see paragraph 5 above). You'll see further that the command that runs the penelope script provides script with this location (C:\tmp in our example). Let's start the code modification. Go to penelope folder, find file format_kobo.py and open it in any text editor (say, free notepad++). Notepad++ (and some other text editors) is able to display line numbers. Find 9 lines with numbers from 67 through 75: Code:
67 try: 68 # call MARISA with marisa_trie module 69 import marisa_trie 70 trie = marisa_trie.Trie() 71 trie.load(tmp_path) 72 for pair in trie.items(): 73 dictionary.add_entry(headword=pair[0], definition=u"") 74 result = True 75 except ImportError as exc: Code:
try: raise ValueError('') except Exception as error: - first line (try) and third line (except...) should start exactly under the character 'k' in word 'key' at line 66 - second line (raise...) should start with at least one blank (space) character (better start this line with four spaces before word 'raise'). Save modified file format_kobo.py. 7. Open a command prompt window in the folder C:\Kobo dictionaries with your compressed Stardict dictionary dict.zip. To do this in Windows 10, open C:\Kobo dictionaries in Windows Explorer. Now left click at the blank space located at the RIGHT side of the text in address box. Text in address box will get highlighted in blue. Using keyboard enter command "cmd" (without quotes) and press Enter. The black command window appear with command prompt containing full path to C:\Kobo dictionaries folder. Now you can enter any command at the command prompt next to the blinking cursor. So, enter this command to run the script: Code:
python D:\Converters\Kobo\penelope.py -i dict -j stardict -f nor -t en -p kobo -o dicthtml-nor-en --marisa-bin-path C:\tmp Explanation of command parameters: Parameter -i dict points to the name of input dict.zip file containing three Stardict files (only name without extension). Parameter -f nor informs script that input language is Norwegian. Parameter -t en informs script that output language is English. Parameter -o dicthtml-nor-en specify name of output file containing Norwegian-English dictionary. Parameter --marisa-bin-path C:\tmp informs script that marisa exe files are located in the folder C:\tmp. Parameters -j stardict informs script that input dictionary is in Stardict format. Parameters -p kobo informs script that output dictionary is in Kobo format. If full path to the scrip penelope.py contains blanks then put this path in quotes " ", e.g. " D:\My Converters\Kobo\penelope.py". If scrip runs without errors than the following messages will display: Code:
[INFO] Reading input file(s)... [INFO] Reading input file(s)... done [INFO] Writing output file(s)... [INFO] MARISA cannot be imported as Python module. You might want to install it with: [INFO] $ [sudo] pip install marisa_trie [INFO] Running 'marisa-build' from 'C:\tmp' [INFO] Writing output file(s)... done [INFO] The following file(s) have been created: [INFO] dicthtml-nor-en.zip Imagine, you have two zipped Stardict dictionaries: nor_en.zip (Norwegian-English) and nor_exp/zip (Norwegian-Norwegian explanatory). To obtain combined dictionary that has unified vocabulary entries containing entry in English (from nor-en) displayed first and entry in Norwegian (from nor_exp) displayed second you should run this command: Code:
python D:\Converters\Kobo\penelope.py -i nor_en, nor_exp -j stardict -f en -t ru -p kobo -o dicthtml-en-ru --marisa-bin-path C:\tmp --sort-after --sort-by-headword Last edited by EbokJunkie; 04-22-2019 at 12:09 AM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Touch Custom dicts for Kindle App on Nook rooted | myself11 | Barnes & Noble NOOK | 0 | 01-16-2013 12:49 PM |
Other Fiction Harte, Bret: Eine Blaugras Penelope. (german) V1. 29 Aug 2012 | Frodok | ePub Books | 0 | 08-29-2012 05:39 PM |
"How's that shroud coming along, Penelope?": The Odyssey Thread | issybird | Reading Recommendations | 21 | 06-20-2012 07:48 PM |
Free Book (Kindle) - Penelope & Prince Charming | koland | Deals and Resources (No Self-Promotion or Affiliate Links) | 4 | 09-17-2010 09:21 PM |
Converting help? | mad4rombks | IMP | 7 | 01-06-2008 10:19 AM |