10-19-2016, 11:57 AM | #1 |
Member
Posts: 10
Karma: 10
Join Date: Oct 2016
Device: none
|
Unable to use spellcheck dictionary for italicizing words
In Sigil, Preferences>Spellcheck Dictionaries, I have added a dictionary called "Sanskrit" by selecting "Add" and pasting the words from a .txt file. Since these words exist in the .xhtml files, now I would like to italicize them. How to do it? Could the said dictionary file be used to Find and Replace to italicize the words? If the said dictionary can somehow be displayed (currently, there exists "Add to Dictionary" but not Display Dictionary), a user can click on any displayed word to reach its location on the .xhtml file to italicize it.
|
10-19-2016, 12:32 PM | #2 |
Grand Sorcerer
Posts: 27,595
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
The short answer is, you can't. Not with a spellcheck dictionary anyway. Spellcheck Replace doesn't differentiate between font-variants. And it's not intended to alter the formatting of the found word. Replacing misspelled words with Spellcheck deals with spelling only. Formatting doesn't enter into it.
You'll have to italicize them manually, or with a standard find and replace action (regex or otherwise). Last edited by DiapDealer; 10-19-2016 at 12:36 PM. |
Advert | |
|
10-19-2016, 01:20 PM | #3 |
Grand Sorcerer
Posts: 5,604
Karma: 23165369
Join Date: Dec 2010
Device: Kindle PW2
|
@sjhawar:
As DiapDealer has already suggested, you might be able to use the built-in Regex search feature to wrap all Sanskrit words in italics tags. Depending on the number of Sanskrit words in your custom dictionary, you might be able to use a single Regex expression to do this. Locate your user dictionary using the following instructions and attach it to your post: 1. Select Edit > Preferences > Open Preferences Location. 2. Double-click user_dictionaries. (If it's a rather large user dictionary, indicate the total number of lines and post the first 15 lines.) Last edited by Doitsu; 10-19-2016 at 01:24 PM. |
10-19-2016, 01:36 PM | #4 |
Grand Sorcerer
Posts: 27,595
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
A plugin could also be written that could access a user dictionary and attempt to italicize the words it contains. But it would prove problematic determining whether or not a particular word was already italicized or not.
|
10-19-2016, 01:53 PM | #5 |
actually it is /var/log
Posts: 341
Karma: 2994236
Join Date: Sep 2012
Location: usually Europa
Device: prs t1
|
For a few words you can use Tools->Spellcheck. Clicking on the word in "Word" column will bring you to this word in "Code View" window. The rest, alas, has to be done manually.
|
Advert | |
|
10-19-2016, 02:49 PM | #6 |
Resident Curmudgeon
Posts: 74,537
Karma: 129670952
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
One way to do this is to spellcheck in English and when you come upon the Sanskrit as misspelled, then you can manually make sure it's italicized.
|
10-20-2016, 12:34 AM | #7 |
Member
Posts: 10
Karma: 10
Join Date: Oct 2016
Device: none
|
>For a few words you can use Tools->Spellcheck. Clicking on the word in "Word" column >will bring you to this word in "Code View" window.
The above is a good idea to manually italicize if somehow all the words from my dictionary called "Sanskrit" are displayed in "Code View" window. |
10-20-2016, 12:46 AM | #8 | |
Member
Posts: 10
Karma: 10
Join Date: Oct 2016
Device: none
|
Quote:
http://www.mediafire.com/file/jvh45l...it268words.txt |
|
10-20-2016, 12:54 AM | #9 | |
Member
Posts: 10
Karma: 10
Join Date: Oct 2016
Device: none
|
Quote:
http://www.codeproject.com/Tips/1003...n-a-Word-Docum Using the Code Create a new macro in Word and paste in the following code (tested in version 2010). When you run the macro, all words in your document that are not Dutch, but are US/UK English, are formatted in italics, unless they were already italic, in which case they are formatted normally (assuming that surrounding words are in italics, so we highlight the word in question by making it normally formatted). Sub ItalicizeEnglish() If Application.Documents.Count < 1 Then MsgBox "No documents are open!" Return End If ActiveDocument.Content.LanguageID = msoLanguageIDDutch ActiveDocument.Content.NoProofing = False For Each w In ActiveDocument.SpellingErrors If Not ItalicizeIfInLanguage(w, msoLanguageIDEnglishUS) Then b = ItalicizeIfInLanguage(w, msoLanguageIDEnglishUK) End If Next End Sub Function ItalicizeIfInLanguage(w, lan) As Boolean oldlan = w.LanguageID w.LanguageDetected = False w.LanguageID = lan If w.SpellingErrors.Count = 0 Then w.Font.Italic = Not w.Font.Italic ItalicizeIfInLanguage = True Else w.LanguageID = oldlan ItalicizeIfInLanguage = False End If End Function |
|
10-20-2016, 01:36 AM | #10 |
null operator (he/him)
Posts: 20,653
Karma: 26966376
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
@sjhawar - Since you've mentioned Word, the e-Book Tools Word add-in has a feature that will Mark (highlight colour) all occurrences of words in a designated list.
Once marked you can use Word's Search and Replace to italicise the highlighted words, and then remove the highlights. The Add-in has a raft of other features - including ePub Import and Export, and my favourite - Dialogue Checking BR |
10-20-2016, 02:28 AM | #11 | |
Member
Posts: 10
Karma: 10
Join Date: Oct 2016
Device: none
|
Quote:
|
|
10-20-2016, 04:30 AM | #12 | ||
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Quote:
That being said, depending on the source, the Sanskrit could already be identified in the text as being another language as the source with the lang attribute. If so, one S&R could suffice. Quote:
You could opt to import your ePUB into Word, run the Mark tool and then export again to ePUB. You are the only one that could determine if it would be worth the time. |
||
10-20-2016, 04:42 AM | #13 | |
null operator (he/him)
Posts: 20,653
Karma: 26966376
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
BR |
|
10-20-2016, 06:15 AM | #14 |
Grand Sorcerer
Posts: 5,604
Karma: 23165369
Join Date: Dec 2010
Device: Kindle PW2
|
@sjhawar:
IMHO, the easiest solution would be to import a Saved Search group. The Saved Search .ini format is pretty straightforward and can be easily generated from a list with a spreadsheet program or a script. A typical Save Search file looks like this: Code:
[search_entries] 1\Name=Group Name/Search Name 1\Find=Find1 1\Replace=Replace1 2\Name=Group Name/Search Name 2\Find=Find2 2\Replace=Replace2 size=2 To import and use a Saved Search: 1. Press CTRL+F to display the Find and Replace window and select Regex, if isn't already selected. 2. Unzip sanskrit.ini from sanskrit.ini.zip. 3. Select Tool > Saved Searches. 4. Right-click in the Saved Searches window, select Import and import sanskrit.ini. This should create an Imported group, if it doesn't already exist. (The group might also be added as a subgroup to the first selected Saved Search group.) 5. Click Imported, highlight Sanskrit and click Load Search. 6. In the Saved Searches window, click Find followed by Replace or Replace/Find. If you didn't use italics elsewhere in the book you could also click Replace All and then double-check all italics tags. It goes without saying, that you should make a backup of your book, before testing this potentially very dangerous method!!! Last edited by Doitsu; 10-20-2016 at 06:18 AM. |
10-20-2016, 09:02 AM | #15 |
Member
Posts: 10
Karma: 10
Join Date: Oct 2016
Device: none
|
>You could opt to import your ePUB into Word, run the Mark tool and then export again to ePUB.
I already did that but what happens is that all my endnotes become unclickable when I convert from epub to doc. |
Tags |
dictionary, find and replace, italicize, spellcheck |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to use a spellcheck dictionary for italicizing | sjhawar | Introduce Yourself | 3 | 10-19-2016 05:56 PM |
Unable to select words in a PDF | brennus | Kobo Reader | 2 | 09-17-2015 03:17 PM |
Add Spellcheck Dictionary | Leonatus | Editor | 6 | 02-12-2015 12:16 PM |
SPELLCHECK NATION: Does SpellCheck have a dark side? | cbaehr | Self-Promotions by Authors and Publishers | 10 | 11-07-2010 12:45 PM |
PDF to MOBI conversion - unable to detect any words | qwerty123456 | Calibre | 1 | 07-22-2010 07:54 AM |