Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 04-19-2014, 07:26 AM   #1
bobbert1234
Junior Member
bobbert1234 began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Apr 2014
Device: samsung galaxy tab 10.1
Multiple English Spelling Dictionaries

Hi

The new spelling check facility is great - thanks to Kovid. Does anyone know if there a way of enabling 2 English dictionaries simultaneously so eg US and British English are let through the check? Sorry if I have missed an obvious answer.

Thanks for any replies
bobbert1234 is offline   Reply With Quote
Old 04-19-2014, 05:04 PM   #2
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
I don't think there's any easy way.

See also https://www.mobileread.com/forums/sho...8&postcount=37

Maybe mrmikel has found a combined dictionary - but then again, if he had then I'm sure he would have posted something.

BR
BetterRed is offline   Reply With Quote
Advert
Old 04-19-2014, 05:19 PM   #3
mrmikel
Color me gone
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
nope. I saw something that suggested combining them, but I don't understand the structure. Nor did I see any program to do so, but that seems like it might be something that someone could do.

http://code.google.com/p/hunspell-merge/downloads/list is a merge utility for hunspell. Looks like a java setup, but I don't know just how they relate one to the other, otx vs hunspell.

Here is website for roll your own.:
http://www.suares.com/index.php?page_id=25&news_id=233

Last edited by mrmikel; 04-19-2014 at 05:29 PM.
mrmikel is offline   Reply With Quote
Old 04-20-2014, 12:10 AM   #4
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by mrmikel View Post
nope. I saw something that suggested combining them, but I don't understand the structure. Nor did I see any program to do so, but that seems like it might be something that someone could do.

http://code.google.com/p/hunspell-merge/downloads/list is a merge utility for hunspell. Looks like a java setup, but I don't know just how they relate one to the other, otx vs hunspell.

Here is website for roll your own.:
http://www.suares.com/index.php?page_id=25&news_id=233
@mrmikel & bobbert1234 - otx is the way that hunspell dictionaries are packaged for Open Office - they are just another zip

If you copy the .otx and rename to zip, then you can unarchive to a folder and it will have the .dic(tionary) and .aff(ix) files, which is what calibre and sigil use.

The java program seems to merge the diff and aff files that Sigil ships OK, and for Sigil you only need to put the merge dictionaries into its hunspell_dictionaries folder and then select the merged name in its preferences for spell checking. I have attached a zip with the four merged files. I have done very limited testing. The dictionary name is en_gb_us. As always, if it eats your book... Caveat Emptor.

The program is a bit fiddly in windows, I had to play around a bit to get the 'hang of it' - basically you need to get the .dic files and corresponding .aff files that you want to merge into the one folder, select the two or more .dic files in its list and hit the merge button.

Calibre requires OXT files. I didn't work out how to merge the other files (8 of them) that are packaged into an OXT file - nor will I be doing so.


Added - The attachment cannot be used in the Calibre Book Editor - it can be used by Sigil, more investigation/work is required to create a combined OXT file, which is what calibre needs.


BR
Attached Files
File Type: zip en_gb_us.zip (355.0 KB, 305 views)

Last edited by BetterRed; 04-20-2014 at 07:02 PM.
BetterRed is offline   Reply With Quote
Old 04-20-2014, 06:22 AM   #5
mrmikel
Color me gone
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
Thanks, will test it out.
mrmikel is offline   Reply With Quote
Advert
Old 04-20-2014, 06:55 PM   #6
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
In another thread mrmikel posted this https://www.mobileread.com/forums/sho...5&postcount=53

Quote:
Originally Posted by mrmikel View Post
Thanks for the try on the dictionary, but it fails when I try to install to calibre with:
calibre, version 1.33.0
ERROR: Failed to import dictionaries: Failed to import dictionaries from J:/Our Documents/Etexts/en_gb_us.oxt. Click "Show Details" for more information

Traceback (most recent call last):
File "site-packages\calibre\gui2\tweak_book\spell.py", line 112, in accept
File "site-packages\calibre\spell\import_from.py", line 70, in import_from_oxt
File "site-packages\calibre\utils\zipfile.py", line 1008, in open
File "site-packages\calibre\utils\zipfile.py", line 970, in getinfo
KeyError: "There is no item named u'META-INF/manifest.xml' in the archive"
@mrmikel - The zip I posted can only be used with Sigil by copying the contents to the Sigil\hunspell_dictionaries folder and then selecting en_gb_us.

I had hoped my previous post made it clear that it can't be used with Calibre. I've added a paragraph to make it clear.

They can't be used by calibre as it requires an OXT file. Whilst an OXT is a rebadged ZIP, it contains files in addition to the .dic(tionary) and .aff(ix) files as in

Code:
META-INF
    manifest.xml
*en_US.aff
 th_en_US_v2.dat
*en_US.dic
*hyph_en_US.dic
 th_en_US_v2.idx
 license.txt 
 affDescription.txt
 changelog.txt
 dictionaries.xcu
 description.xml
So far we've demonstrated that a combined dictionary is feasible, but we don't have a specific solution for calibre. I don't know enough about OXT files in part because I don't use Open Office. Perhaps someone who uses OO, could investigate if/how one could merge the other files, also I don't know which of the other files calibre actually uses.

I find it odd that this issue (combining dictionaries) has arisen in the context of the calibre book editor, with a quick search I couldn't find anything similar in the Sigil forum

BR

Last edited by BetterRed; 04-20-2014 at 07:14 PM.
BetterRed is offline   Reply With Quote
Old 04-20-2014, 11:30 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,856
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
@BR: All calibre needs in an oxt file if the .aff and .dic files and the .xcu file that specifies the metadata (which you should be able to just copy from another oxt and alter slightly).
kovidgoyal is offline   Reply With Quote
Old 04-21-2014, 12:23 AM   #8
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by kovidgoyal View Post
@BR: All calibre needs in an oxt file if the .aff and .dic files and the .xcu file that specifies the metadata (which you should be able to just copy from another oxt and alter slightly).
I sort of guessed that might be one - I assume it's where you get locale

I'll have a closer look when I get home this evening

BR
BetterRed is offline   Reply With Quote
Old 04-21-2014, 07:08 AM   #9
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
I've created an oxt with GB and US spellings that seems to work - tested on calibre portable with words like labour/labor, realise/realize, saviour/savoir.

You'll need to rename the attached zip to oxt.

I used the GB & US dictionaries from Sigil as the 'baseline', which I think are the same as those shipped with calibre. And I followed Kovids guidance to create a 'merged' dictionaries.xcu file - I have no idea whether I've done it the best or even the right way.

I installed it with the preferred variant set to United Kingdom. After installing it you have to set en_gb_us as the preferred dictionary.

The calibre dictionaries have a file called locale - I couldn't figure out how to get a sensible set of values for it out of the oxt. But its just a list of country codes so I created it by hand after I installed the oxt (see below). I combined what calibre puts in the shipped GB and US locale files.

Note the absence of locales such as en-AU, en-SG, en-HK, en-ZA etc. But it seems to work in AU and I would assume elsewhere too. I think these are the language 'variants', I'm not entirely sure as to their raison d'être, maybe they're something to do with language tags in the xhtml

Code:
en-GB
en-BS
en-BZ
en-GH
en-IE
en-IN
en-JM
en-NZ
en-TT
en-US
en-PH
If you want to try the attached oxt then I SERIOUSLY recommend you test it with a calibre portable install that you're prepared to throw away if something breaks.

I don't want support this 'thing', I regard it as something less than a proof of concept prototype.

I took an interest in mrmikels query as to the availability of a combined US/UK dictionary only because I was recently delving into Sigils dictionaries regarding a problem I was having with apostrophes in its spell checker. I personally have no use for a combined dictionary.

It would probably be better if such a dictionary came from one of the Open Office variants. I'm not interested in getting involved with that either, I think the version of OOo I have (not installed) is circa 2005.

That said I'll try answer any questions and pass on knowledge about how I 'constructed' the oxt, the hard-yards were done by the java proggie that mrmikel found

BR
Attached Files
File Type: zip en_gb_us.zip (5.25 MB, 249 views)

Last edited by BetterRed; 04-21-2014 at 08:29 AM.
BetterRed is offline   Reply With Quote
Old 04-21-2014, 07:50 AM   #10
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by BetterRed View Post
You'll need to rename the attached zip to oxt.
Attached???
DoctorOhh is offline   Reply With Quote
Old 04-21-2014, 08:27 AM   #11
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by DoctorOhh View Post
Attached???
ta - Damn dog, why can't it stick to eating kids homework

BR
BetterRed is offline   Reply With Quote
Old 04-21-2014, 10:13 AM   #12
mrmikel
Color me gone
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
He's so attached to it he couldn't bear to part with it!
mrmikel is offline   Reply With Quote
Old 04-21-2014, 10:24 AM   #13
mrmikel
Color me gone
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
BR, understood that this experiment is making your feel like Dr. Frankenstein.

It doesn't quite work because it attaches to the US dictionary but does not add to it. Like you, I don't want to thrown out the US dictionary to find out.

I think it needs to be a private dictionary. But this is all too much work for idle curiosity.
mrmikel is offline   Reply With Quote
Old 04-21-2014, 05:52 PM   #14
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by mrmikel View Post
He's so attached to it he couldn't bear to part with it!
So it wasn't a dog that ate it, it was MR bear !

Quote:
Originally Posted by mrmikel View Post
BR, understood that this experiment is making your feel like Dr. Frankenstein.

It doesn't quite work because it attaches to the US dictionary but does not add to it. Like you, I don't want to thrown out the US dictionary to find out.

I think it needs to be a private dictionary. But this is all too much work for idle curiosity.
@mrmikel - Strangelove more like, Frankenstein never

User (private ?) dictionaries are not implemented as hunspell dictionaries, they're in %APPDATA%calibre\dictionaries\prefs.json

Kovid mentioned adding the ability to add a word-list into the spell checker.

Maybe my original idea of obtaining the differences between en_GB.dic and en_US.dic via a diff can be revived, perhaps it could be the input into the forthcoming 'add word-list' feature.

Or get one of the 'experts' over at libre or apache to build a combined oxt.

Active curiosity has been known to kill cats, but by and large its the way we humans learn - I'm not sure there's such a thing as 'idle curiosity', unless one includes 'vicarious interest' in its definition.

BR

Last edited by BetterRed; 04-21-2014 at 05:57 PM.
BetterRed is offline   Reply With Quote
Old 04-23-2020, 03:06 PM   #15
1v4n0
Groupie
1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.1v4n0 writes the songs that make the whole world sing.
 
Posts: 171
Karma: 40000
Join Date: Oct 2013
Device: kindle
Sorry for the gravedigging: I have the same problem as OP, but the dictionaries I'd like to merge are Italian, with French and/or German and/or English. I tried Hunspell Merge, but it doesn't seem to work with the Italian .dic file (I tried merging two other dictionaries and it does its job).
The command prompt gives some java errors which I have no idea what they mean (see below)
Spoiler:
Exception in thread "Thread-0" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
at hunspell.merge.DicReader.readLine(DicReader.java:3 2)
at hunspell.merge.FileReader.readFile(FileReader.java :29)
at hunspell.merge.DictionaryFile.readFiles(Dictionary File.java:113)
at hunspell.merge.HunspellMerge.createDictionariesImp l(HunspellMerge.java:339)
at hunspell.merge.HunspellMerge.access$1500(HunspellM erge.java:25)
at hunspell.merge.HunspellMerge$9$1.run(HunspellMerge .java:323)
at java.base/java.lang.Thread.run(Thread.java:834)

1v4n0 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New custom English dictionaries ShellShock Kobo Developer's Corner 166 09-22-2020 02:48 PM
[PocketBook Basic] Are there any Early Modern English to Modern English dictionaries? ProudCabbage PocketBook 2 11-04-2013 08:49 AM
PW Russian - English, Italian - English dictionaries? johanp Amazon Kindle 6 02-21-2013 02:48 PM
Spelling: English (UK) versus English (US) Graham Coulson General Discussions 96 09-20-2011 01:29 PM
Russian English Dictionaries stevegoldstein PocketBook 1 06-15-2011 06:17 AM


All times are GMT -4. The time now is 01:41 PM.


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