Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 09-06-2015, 04:05 PM   #31
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 201
Karma: 62362
Join Date: Jul 2015
Device: Sony
Thanks for all these suggestions and comments. When I get time, I will look at implementing some of the ideas presented above:

@Doitsu: Thanks for the directory code and experimental plugin - I will experiment with your plugin as soon as I have time.

@gipsy: Thanks for the code for Greek ePubs. I will incorporate this code in the next version of the plugin.

@DiapDealer: As you do not really recommended accessing script properties/methods directly, I will try the solution offered by Doitsu; I will update from Doitsu's solution when the hunspell/dictionaries is incorporated into the plugin launcher framework.
CalibUser is offline   Reply With Quote
Old 09-06-2015, 04:10 PM   #32
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,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by CalibUser View Post
@Doitsu: Thanks for the directory code and experimental plugin - I will experiment with your plugin as soon as I have time.
Even though my code works, you may want to use the updated version by DiapDealer, because his version is more robust and also more elegant.
Doitsu is offline   Reply With Quote
Advert
Old 09-06-2015, 05:43 PM   #33
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,645
Karma: 127838196
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Doitsu View Post
Even though my code works, you may want to use the updated version by DiapDealer, because his version is more robust and also more elegant.
But there's no attachment for the plugin with the changes.
JSWolf is offline   Reply With Quote
Old 09-09-2015, 02:39 PM   #34
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 201
Karma: 62362
Join Date: Jul 2015
Device: Sony
The plugin has been updated so that it will automatically find the folder for the spelling dictionary using code suggested by Doitsu and DiapDealer.

I have also incorporated code from gipsy to manage Greek letters.

@gipsy:I had to represent the Greek characters as unicode numbers since my editor cannot handle unicode characters! If you get time, please check that the code works for Greek texts in case I have mistyped the unicode numbers.
CalibUser is offline   Reply With Quote
Old 09-09-2015, 06:25 PM   #35
gipsy
Connoisseur
gipsy began at the beginning.
 
Posts: 81
Karma: 10
Join Date: Nov 2013
Device: Kobo Aura HD
@CalibUser
Change them to this and there are fine

EDIT: Sorry they didn't work with the replace in unicode code

For example the "γΰρω" is changed to "γ\u03CDρω"

EDIT 2: For some reason the hyphen doesn't work at me now.

I think I found the reason...
In windows...
The ePubTidyTool.json has the DictFile path as
Code:
 "DictFile": "C:\\Users\\pm\\AppData\\Local\\sigil-ebook\\sigil\\user_dictionaries\\WordDictionary.txt",
to the previously version was
Code:
  "DictFile": "C:/Users/pm/AppData/Local/sigil-ebook/sigil/hunspell_dictionaries/WordDictionary.txt",

Last edited by gipsy; 09-10-2015 at 02:04 AM.
gipsy is offline   Reply With Quote
Advert
Old 09-10-2015, 05:07 AM   #36
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,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by gipsy View Post
EDIT: Sorry they didn't work with the replace in unicode code

For example the "γΰρω" is changed to "γ\u03CDρω"
Because of the idiotic rather counterintuitive way that Python handles Unicode strings, you'll have to use the actual characters instead of the Unicode codes if you want to avoid the whole Python Unicode encode/decode mess.

Change the following line from:

Code:
	CorrectText("Changed \u03CD to \u03B0", r'\u03B0', r'\u03CD')
to

Code:
	CorrectText("Changed \u03CD to \u03B0", r'ΰ', r'ύ')
This'll change γΰρω to γύρω.
Doitsu is offline   Reply With Quote
Old 09-10-2015, 05:14 AM   #37
gipsy
Connoisseur
gipsy began at the beginning.
 
Posts: 81
Karma: 10
Join Date: Nov 2013
Device: Kobo Aura HD
That's correct Doitsu :P
i'm gonna send the code to CalibUser because his editor cannot handle greek characters.
gipsy is offline   Reply With Quote
Old 09-14-2015, 04:03 AM   #38
gipsy
Connoisseur
gipsy began at the beginning.
 
Posts: 81
Karma: 10
Join Date: Nov 2013
Device: Kobo Aura HD
CalibUser if you can copy-paste them in your editor those are some fixes for now.
Or tell me how to send them to you
Code:
#------------------------ Greek character corrections -------------

	#Fixes '…' when PDFd as ...
	CorrectText("Changed ... to …", r'\.\.\.', r'…')

	#Fixes 'στη' when PDFd as σιη
	CorrectText("Changed σιη to στη", r'σιη', r'στη')

	#Fixes 'στη' when PDFd as σιη
	CorrectText("Changed σιη to στη", r' σι(ον|ο) ', r' στ\1 ')

	#Fixes 'στις' when PDFd as σιις
	CorrectText("Changed σιις to στις", r'σιις', r'στις')
	
	#Fixes 'Άκουσ' when PDFd as Ακόυσ
	CorrectText("Changed Ακόυσ to Άκουσ", r'Ακόυσ', r'Άκουσ')
	
	#Fixes 'γι’' when PDFd as γΓ,γΡ
	CorrectText("Changed γΓ γΡ to γι’", r'(γΓ|γΡ)', r'γι’')

	#Fixes 'ντι' when PDFd as νπ
	CorrectText("Changed νπ to ντι", r'νπ', r'ντι')
	
	#Fixes 'Γι’' when PDFd as ΓΓ
	CorrectText("Changed ΓΓ to Γι’", r'ΓΓ ', r'Γι’ ')

	#Fixes 'σχεδίαζ' when PDFd as σχέδιαζ
	CorrectText("Changed σχέδιαζ to σχεδίαζ", r'σχέδιαζ', r'σχεδίαζ')
	
	#Fixes '\u0388' when PDFd as 'E "E
	CorrectText("Changed 'E,\"E to \u0388", r'(\'|\")(\u0395)', r'Έ')

	#Fixes \u038E when PDFd as 'Y or "Y
	CorrectText("Changed 'Y,\"Y to \u038E", r'(\'|\")(\u03A5)', r'Ύ')

	#Fixes \u038A when PDFd as 'I or "I
	CorrectText("Changed 'I,\"I to \u038A", r'(\'|\")(\u0399)', r'Ί')

	#Fixes \u038C when PDFd as 'O or "O
	CorrectText("Changed 'O,\"O to \u038C", r'(\'|\")(\u039F)', r'Ό')

	#Fixes \u0386 when PDFd as 'A or "A
	CorrectText("Changed 'A,\"A to \u0386", r'(\'|\")(\u0391)', r'Ά')

	#Fixes \u0389 when PDFd as 'H or "H
	CorrectText("Changed 'H,\"H to \u0389", r'(\'|")(\u0397)', r'Ή')

	#Fixes \u038F when PDFd as '\u03C9 or "\u03C9
	CorrectText("Changed '\u03C9,\"\u03C9 to \u038F", r'(\'|\")(\u03C9)', r'Ώ')

	#Fixes \u03CD when PDFd as \u03B0
	CorrectText("Changed \u03CD to \u03B0", r'ΰ', r'ύ')

	#Fixes \u03CD when PDFd as \u03B0
	CorrectText("Changed ε' to έ", r'ε\'', r'έ')

Last edited by gipsy; 09-14-2015 at 04:41 AM.
gipsy is offline   Reply With Quote
Old 09-14-2015, 02:13 PM   #39
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 201
Karma: 62362
Join Date: Jul 2015
Device: Sony
I have updated the plugin to process Greek errors as suggested by Gipsy - I haven't been able to test the update using a Greek text as I am not familiar with this language.
CalibUser is offline   Reply With Quote
Old 09-14-2015, 02:15 PM   #40
gipsy
Connoisseur
gipsy began at the beginning.
 
Posts: 81
Karma: 10
Join Date: Nov 2013
Device: Kobo Aura HD
Quote:
Originally Posted by CalibUser View Post
I have updated the plugin to process Greek errors as suggested by Gipsy - I haven't been able to test the update using a Greek text as I am not familiar with this language.
I'm gonna test them :P
Thanks CalibUser

They work fine. The only problem is that it doesn't process the Hyphens. Maybe windows doesn't recognize the path in ePubTidyTool.json
Code:
  "DictFile": "C:\\Users\\owner\\AppData\\Local\\sigil-ebook\\sigil\\user_dictionaries\\WordDictionary.txt",

Last edited by gipsy; 09-14-2015 at 02:20 PM.
gipsy is offline   Reply With Quote
Old 09-14-2015, 02:39 PM   #41
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 201
Karma: 62362
Join Date: Jul 2015
Device: Sony
@gipsy: Strange that hyphens are not being processed. I have tested this facility on a Windows 7 PC and it is working (for English text). Are you having problems with Greek texts only, or are you also having problems with English text? Perhaps I need to go back to enabling the user to select the path for a the dictionary....however, when the new version of Sigil is published I will be looking at using the built-in dictionaries and hopefully that will resolve the problem.
CalibUser is offline   Reply With Quote
Old 09-14-2015, 03:09 PM   #42
gipsy
Connoisseur
gipsy began at the beginning.
 
Posts: 81
Karma: 10
Join Date: Nov 2013
Device: Kobo Aura HD
Quote:
Originally Posted by CalibUser View Post
@gipsy: Strange that hyphens are not being processed. I have tested this facility on a Windows 7 PC and it is working (for English text). Are you having problems with Greek texts only, or are you also having problems with English text? Perhaps I need to go back to enabling the user to select the path for a the dictionary....however, when the new version of Sigil is published I will be looking at using the built-in dictionaries and hopefully that will resolve the problem.
It's like it doesn't find (or load corectly) the WordDictionary.txt.
I make a WordDictionary.txt with only 2 english words and a epub with the 2 words hyphened.
It doesn't change them. Maybe it's a Windows 8 issue, I'm gonna test it in a Windows 7 virtual machine
gipsy is offline   Reply With Quote
Old 09-15-2015, 03:13 AM   #43
gipsy
Connoisseur
gipsy began at the beginning.
 
Posts: 81
Karma: 10
Join Date: Nov 2013
Device: Kobo Aura HD
I found a solution while searching....
in plugin.py i change the
Code:
	return(dictionary_path)
to
Code:
	return(dictionary_path).replace("\\","/")
and i get the directory without double slashes in ePubTidyTool.json

It worked for windows 8, Windows 10. I don't know if it's working in linux, or older Windows versions
gipsy is offline   Reply With Quote
Old 09-15-2015, 04:10 AM   #44
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,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by gipsy View Post
I found a solution while searching....
in plugin.py i change the
Code:
	return(dictionary_path)
to
Code:
	return(dictionary_path).replace("\\","/")
and i get the directory without double slashes in ePubTidyTool.json
In JSON files certain special characters (among them slashes and backslashes) need to be "escaped." I.e., they need to be written twice so as not to "confuse" the parser.

I.e., what you've found is a feature not a bug. If removing hyphens doesn't work, there's probably a problem with the encoding of the user dictionary, which needs to be saved as a utf-8 file.

Re-save the user dictionary as a utf8 file with Windows Notepad and rerun the plugin.

If removing hyphens still doesn't work, attach a short Greek sample epub file with hyphenation issues and the user dictionary that you use.
Doitsu is offline   Reply With Quote
Old 09-15-2015, 04:36 AM   #45
gipsy
Connoisseur
gipsy began at the beginning.
 
Posts: 81
Karma: 10
Join Date: Nov 2013
Device: Kobo Aura HD
Doitsu i test it and with a 2 english words dictionary and a 2 hyphened words epub. And it doesn't worked.
The Dictionary is as UTF-8 without BOM (as Notepad++says)

Ok. That's weird...
I test the latest version of the plugin with a portable sigil and the hyphens fix works fine
It doesn't work with the installed version of Sigil

To work with the installed version of Sigil you must have the path in json as
Code:
  "DictFile": "C:/Users/pm/AppData/Local/sigil-ebook/sigil/hunspell_dictionaries/WordDictionary.txt",
Damn windows 8

Last edited by gipsy; 09-15-2015 at 04:40 AM.
gipsy is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tidying Up My Kindle selectortone Calibre 2 07-17-2013 10:35 AM
developping a Plugin for Presentation files abdlink Plugins 4 04-15-2013 11:27 AM
Plugin to fix fb2 files oviksna Plugins 3 01-28-2013 08:53 AM
Tidying Up My Library JayLaFunk Library Management 2 09-20-2011 09:12 AM
Calibre 0.7.50 can't see plugin files mb_webguy Calibre 5 04-29-2011 03:41 AM


All times are GMT -4. The time now is 08:16 AM.


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