Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 04-19-2019, 02:53 AM   #16
heythereimkira
Junior Member
heythereimkira began at the beginning.
 
heythereimkira's Avatar
 
Posts: 7
Karma: 10
Join Date: Apr 2019
Device: Kobo H20 Edition 2
Quote:
Originally Posted by khahoon View Post
Hi

I downloaded couple stardict dictionaries and Penelope tool. However I am having a brain squeeze with penelope`s usage. I used thousands of command line tools but this one is giving me hard time. I do not understand why I need to convert from one language to another one when all I need to convert one format of dictionary to another format of dictionary.

I would appreciate if someone can give me the right command line for what I need.

I want to use norwegian dictionary in Kobo. So i have the dictionary and I want to convert to Kobo format. That is all I need.

thanks
I have been trying to make a Norwegian dictionary too, but I can't understand how to use Penelope. If you were able to cretaa a Norwegian – English dictionary would you mind sharing it?
heythereimkira is offline   Reply With Quote
Old 04-19-2019, 06:32 PM   #17
EbokJunkie
Addict
EbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blue
 
Posts: 229
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
Quote:
Originally Posted by heythereimkira View Post
I have been trying to make a Norwegian dictionary too, but I can't understand how to use Penelope. If you were able to cretaa a Norwegian – English dictionary would you mind sharing it?
Please read post#5. If you have questions just ask.
EbokJunkie is offline   Reply With Quote
Old 04-21-2019, 05:01 AM   #18
heythereimkira
Junior Member
heythereimkira began at the beginning.
 
heythereimkira's Avatar
 
Posts: 7
Karma: 10
Join Date: Apr 2019
Device: Kobo H20 Edition 2
Quote:
Originally Posted by khahoon View Post
Hi

I downloaded couple stardict dictionaries and Penelope tool. However I am having a brain squeeze with penelope`s usage. I used thousands of command line tools but this one is giving me hard time. I do not understand why I need to convert from one language to another one when all I need to convert one format of dictionary to another format of dictionary.

I would appreciate if someone can give me the right command line for what I need.

I want to use norwegian dictionary in Kobo. So i have the dictionary and I want to convert to Kobo format. That is all I need.

thanks
Hi, I can’t seem to grasp how to make a Norwegian Bokmål dictionary either. Would you mind sharing yours? I would really appreciate it
heythereimkira is offline   Reply With Quote
Old 04-22-2019, 12:04 AM   #19
EbokJunkie
Addict
EbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blue
 
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:
Replace all these lines with the following 3 lines of text:

Code:
    try: 
        raise ValueError('') 
    except Exception as error:
When placing replacement text be careful to positioning text on each line:
- 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
This command invokes Python 3.4 and runs penelope script.
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
8. Script penelope 3.1.3 is able to combine two or more input dictionaries into one output dictionary. For example, one can combine Norwegian-English and Norwegian-Norwegian explanatory dictionaries so that successful lookup will display the unified vocabulary entry. The order of entries into this unified entry is defined by the order of input dictionaries listed in parameter -i.
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.
EbokJunkie is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 12:03 AM.


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