Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 01-09-2021, 04:35 AM   #1
Ashjuk
Fanatic
Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.
 
Ashjuk's Avatar
 
Posts: 500
Karma: 3498633
Join Date: May 2011
Location: Surrey, UK
Device: Kobo Aura One, Sony PRS 600/650
Search and Replace

I am having a few issues with search and replace that I can't seem to find an answer to.

How do I make S&R case sensitive?

How do I make S&R find and replace whole words only?

I have done a number of S&Rs on a whole book and have found that it appears to not only replace words with the same case but those of the opposite case too - i.e. a search for color to replace with colour will also replace Color with colour.

Another issue I have come across is that if the search term I am looking for - as a whole word - is embedded in another word that appears to get changed too.

I have looked in preferences and can't seem to see anything that relates to this.
Ashjuk is offline   Reply With Quote
Old 01-09-2021, 07:17 AM   #2
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by Ashjuk View Post
How do I make S&R case sensitive?
After you press Ctrl+F, you should be able to change Mode to "Case Sensitive".

Quote:
Originally Posted by Ashjuk View Post
How do I make S&R find and replace whole words only?
If you change Mode to "Regex", you can use Regular Expressions.

In Regular Expressions, \b = a word boundary... so if you wanted to search for a whole word:

Search: \bcolor\b
Replace: colour

Note: Regular Expressions are already case sensitive, so that won't match "Color" or "Colors". And since it's whole words, it won't match "colorimeter" or "technicolor".

Alternate Method

Your best bet will probably be Sigil's fantastic Tools > Spellcheck > Spellcheck.

This allows you to search through all words in a book in an easy-to-read list.

In there, you're also able to select a word, then "Change Selected Word to":

Click image for larger version

Name:	Sigil.Spellcheck.Color.png
Views:	196
Size:	6.7 KB
ID:	184638

Last edited by Tex2002ans; 01-09-2021 at 07:21 AM.
Tex2002ans is offline   Reply With Quote
Advert
Old 01-09-2021, 07:50 AM   #3
Ashjuk
Fanatic
Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.
 
Ashjuk's Avatar
 
Posts: 500
Karma: 3498633
Join Date: May 2011
Location: Surrey, UK
Device: Kobo Aura One, Sony PRS 600/650
Thanks Tex2002ans - that seems to be just what I was looking for.
Ashjuk is offline   Reply With Quote
Old 01-09-2021, 08:27 AM   #4
Ashjuk
Fanatic
Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.
 
Ashjuk's Avatar
 
Posts: 500
Karma: 3498633
Join Date: May 2011
Location: Surrey, UK
Device: Kobo Aura One, Sony PRS 600/650
I have tried the Spellcheck option as suggested by Tex2002ans and I get the following result -
https://www.mobileread.com/forums/at...1&d=1610198353

The language has defaulted to US English (the book was published in the US) so it is now picking up words that I have already corrected to UK spelling as being misspelled.
I have tried clicking on the Language column to see if I can change it to UK English so that it spellchecks against the default UK dictionary, but there appears to no way to do that.

What am I missing?
Attached Thumbnails
Click image for larger version

Name:	spellcheck.jpg
Views:	259
Size:	101.4 KB
ID:	184639  
Ashjuk is offline   Reply With Quote
Old 01-09-2021, 08:47 AM   #5
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 703
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
How is Sigil to know a word is in British and not American?
If the main language is set to US, individual phrases in British must be clearly marked:
Code:
<span xml:lang="en-GB">colour</span>
Maybe it seems difficult, but if I have a whole book in Polish, and only a few dialogues in French, Italian or Spanish, it is obvious for me to mark the correct languages in these specific places. Then not only the spell check in Sigil works correctly, but also – what is equally important – appropriate readers can distinguish the language and for visually impaired people such expressions are read in correct languages by correct voices, and additionally words in foreign languages are hyphenated according to dictionaries assigned to these languages, not the main language in the e-book.
BeckyEbook is offline   Reply With Quote
Advert
Old 01-09-2021, 09:16 AM   #6
Ashjuk
Fanatic
Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.
 
Ashjuk's Avatar
 
Posts: 500
Karma: 3498633
Join Date: May 2011
Location: Surrey, UK
Device: Kobo Aura One, Sony PRS 600/650
Sorry Becky, I'm not sure I understand you.

The book was written with US spellings and all I want to do is spellcheck it against the default UK dictionary.

The spellcheck pop-up has spotted that it's a US book -as the language column has been set to that - so it's telling me that UK spellings are wrong.

All it appears to be doing at the moment is highlight words that it considers are misspelt in American and NOT those that are misspelt in UK English because it's checking against a US dictionary - which I don't have set as my default.

Oh, and the language in the opf is - <dc:language>en</dc:language>

Last edited by Ashjuk; 01-09-2021 at 09:18 AM.
Ashjuk is offline   Reply With Quote
Old 01-09-2021, 10:30 AM   #7
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,688
Karma: 5444398
Join Date: Nov 2009
Device: many
In Sigil Preferences: set your Primary Spellcheck dictionary to English-Great Britain.

Then try spellchecking again. If there are still issues, then look for lang or xml:lang attributes set to en-US someplace in the html.
KevinH is offline   Reply With Quote
Old 01-09-2021, 10:50 AM   #8
Ashjuk
Fanatic
Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.Ashjuk ought to be getting tired of karma fortunes by now.
 
Ashjuk's Avatar
 
Posts: 500
Karma: 3498633
Join Date: May 2011
Location: Surrey, UK
Device: Kobo Aura One, Sony PRS 600/650
Thanks Kevin,

My default dictionary was already set to English - Great Britain, but your second suggestion was the problem as the headers all had lang="en-US" xml:lang="en-US in them.

I have removed the -US from them and Spellcheck now works as it should and only picks up UK misspelled words.

I will remember to look for that in the future.
Ashjuk is offline   Reply With Quote
Old 02-25-2021, 03:39 AM   #9
isaacbh
Connoisseur
isaacbh makes omelettes without breaking eggs.isaacbh makes omelettes without breaking eggs.isaacbh makes omelettes without breaking eggs.isaacbh makes omelettes without breaking eggs.isaacbh makes omelettes without breaking eggs.isaacbh makes omelettes without breaking eggs.isaacbh makes omelettes without breaking eggs.isaacbh makes omelettes without breaking eggs.isaacbh makes omelettes without breaking eggs.isaacbh makes omelettes without breaking eggs.isaacbh makes omelettes without breaking eggs.
 
Posts: 59
Karma: 98196
Join Date: Mar 2015
Location: Israel
Device: Kobo Aura H20
Quote:
Originally Posted by BeckyEbook View Post
How is Sigil to know a word is in British and not American?
If the main language is set to US, individual phrases in British must be clearly marked:
Code:
<span xml:lang="en-GB">colour</span>
Should I set both lang and xml:lang in a span? This is for epub 2.
isaacbh is offline   Reply With Quote
Old 02-25-2021, 04:47 AM   #10
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 703
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
Although it does not make sense, entering both will not hurt, and may help the disabled. It is important to correctly declare the correct language. Why? Well, the disabled use various software to read the text. The software is different – one program recognizes "lang", the next "xml:lang", and another recognizes both.

So typing both IMHO is not a bad idea.

But I know that there are people here who have the opposite opinion.

http://kb.daisy.org/publishing/docs/html/lang.html
BeckyEbook is offline   Reply With Quote
Old 02-25-2021, 11:17 AM   #11
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by Ashjuk View Post
I have removed the -US from them and Spellcheck now works as it should and only picks up UK misspelled words.

I will remember to look for that in the future.


Quote:
Originally Posted by isaacbh View Post
Should I set both lang and xml:lang in a span? This is for epub 2.
Yes.

If you only have one set, you can add the other using regex.

1. If you only have lang:

Code:
<span lang="en-GB">colour</span>
Search: <span lang="([^"]+)">
Replace: <span lang="\1" xml:lang="\1">

2. If you only have xml:lang:

Code:
<span xml:lang="en-GB">colour</span>
Search: <span xml:lang="([^"]+)">
Replace: <span lang="\1" xml:lang="\1">

Both will give you:

Code:
<span lang="en-GB" xml:lang="en-GB">colour</span>
Side Note: Although like BeckyEbook, lang is extremely helpful when dealing with completely different languages (Italian, Spanish) within an English book.

In your case, it would probably be better to mark the entire book + each chapter as "en" (English).

This would handle both American + British spellings, and then you can set your dictionary to handle which red squigglies you want to see.

(Obviously, you'd go with the superior American dictionary/spellings!!! )

Related Side Note: And IF you're going around marking all "foreign words" within a book, back in 2019 I wrote:

"Is there a way to use the selection in a Saved Search?" (Post #29)

All you'd have to do is change my <i> into <span>.

The instructions were for Calibre, but the same exact steps should apply in Sigil too.

Quote:
Originally Posted by BeckyEbook View Post
Although it does not make sense, entering both will not hurt, and may help the disabled.
Entering both is good practice.

lang = HTML
xml:lang = XML

Most tools I've seen handle both, but there could be tools that only parse one or the other. (For example, a purely XML program might only understand xml:lang.)

Last edited by Tex2002ans; 02-25-2021 at 11:33 AM.
Tex2002ans is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search and Replace Rellwood Library Management 2 06-21-2018 07:53 PM
Regex in search problems (NOT Search&Replace; the search bar) lairdb Calibre 3 03-15-2017 07:10 PM
save multiple search/replace, or search/replace multiple ebooks user743 Editor 12 04-12-2014 02:38 AM
search and replace - drops blanks in replace ? cybmole Conversion 10 03-13-2011 03:07 AM
Search and replace in 0.2.0 paulpeer Sigil 7 03-13-2010 11:59 AM


All times are GMT -4. The time now is 06:00 PM.


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