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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 03-04-2016, 12:02 PM   #16
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 21,083
Karma: 20800854
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: K4NT, Galaxy Tab 2(RIP)
Quote:
Originally Posted by eschwartz View Post
We have a sticky thread you can post this in.




@theducks, would you mind fixing the thread title for that sticky? I think it predated Function-Replace mode.

"Saved Search" ==> "Saved Search/Regex Functions"

Done
theducks is offline   Reply With Quote
Advert
Old 03-05-2016, 09:12 AM   #17
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,171
Karma: 2204557
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Hi

This approach is very promising and interesting as it allows to correct some recurrent OCR mistakes (after a dictionary check).

In French, we have a list of hundreds of words that deserve to be checked out of OCR. With such an approach, of course, you can't avoid false positives, which means we need not to correct them but just to highlight them, to be able later to speed up a manual checking.

I give one example, if you find "trame" which is a correct but fairly rare word, 98% of the time, it should be written "traine". It makes sense to highlight it.

However, I do not know how to write a single entry.

Could some kind soul write a code paragraph example of this Calibre function allowing me to highlight "trame"?
roger64 is offline   Reply With Quote
Old 03-05-2016, 09:55 AM   #18
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: 31,851
Karma: 8697710
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Simply modify the function to wrap the word in some markup instead of correcting it, so instead of replacing the word trame with its correction, replace it with <span class="mistake">trame</span>

Then you can use another search to jump to these words one by one and correct them or not, as you like.
kovidgoyal is offline   Reply With Quote
Old 03-05-2016, 08:14 PM   #19
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,171
Karma: 2204557
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
@kovidgoyal

Thanks for your neat idea which is so simple that I understood it.

Now to try it.

Last edited by roger64; 03-05-2016 at 08:17 PM.
roger64 is offline   Reply With Quote
Old 03-11-2016, 08:02 AM   #20
Arjayem
Casual Member
Arjayem began at the beginning.
 
Arjayem's Avatar
 
Posts: 3
Karma: 10
Join Date: Mar 2016
Location: UK
Device: Kindle paperwhite
Posting

smack: If that's aimed at me, I'd be happy to oblige, Regex Functions seems an apt tag. BUT I'm new to this, and the suggestion goes way over my head, can you step through it ?






Quote:
Originally Posted by eschwartz View Post
We have a sticky thread you can post this in.




@theducks, would you mind fixing the thread title for that sticky? I think it predated Function-Replace mode.

"Saved Search" ==> "Saved Search/Regex Functions"

Arjayem is offline   Reply With Quote
Advert
Old 03-11-2016, 01:39 PM   #21
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,223
Karma: 83049275
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
YOU just repeat your post, in that sticky thread.

@theducks has already performed the moderator administration duties I asked for.
eschwartz is offline   Reply With Quote
Old 03-11-2016, 01:50 PM   #22
BetterRed
null operator
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: 9,284
Karma: 7810051
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by eschwartz View Post
YOU just repeat your post, in that sticky thread.

@theducks has already performed the moderator administration duties I asked for.
Rather than the OP doing doing that, and to avoid having 'duplicate' posts, I suggest theducks merges this thread into the sticky "Saved Search/Regex Functions" thread.

BR
BetterRed is online now   Reply With Quote
Old 03-11-2016, 02:14 PM   #23
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 21,083
Karma: 20800854
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: K4NT, Galaxy Tab 2(RIP)
Quote:
Originally Posted by BetterRed View Post
Rather than the OP doing doing that, and to avoid having 'duplicate' posts, I suggest theducks merges this thread into the sticky "Saved Search/Regex Functions" thread.

BR
I am worried about breaking things
The forum (Mod actions) prompts are a bit
theducks is offline   Reply With Quote
Old 03-11-2016, 03:34 PM   #24
BetterRed
null operator
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: 9,284
Karma: 7810051
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Moderator Notice
Merge done
BetterRed is online now   Reply With Quote
Old 05-08-2017, 11:54 PM   #25
nqk
Addict
nqk began at the beginning.
 
Posts: 226
Karma: 10
Join Date: Feb 2012
Device: Samsung Galaxy Tab 8.9
Dear you guys,

Please help me with a regex function to move found searches to "endnotes.html" file in the book. I picked a code from this forum, which looks like this.
Code:
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
    endnotes = open('D:\endnotes.txt', 'a')
    notes = match.group()+'\n'
    endnotes.write(notes)
    return ''
replace.file_order = 'spine'
This works, yes. It moves all the texts found to the external endnotes.txt and I would manually copy them to endnotes.html that I create in the book.

What I would like to do is have them written directly to the endnotes.html (or even create the file if not there already).

Thanks.
nqk is offline   Reply With Quote
Reply

Tags
conversion, errors, function, ocr, spelling

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference in Manual Search and Saved Search phossler Editor 4 10-04-2015 01:17 PM
Regex-Functions - getting user input CalibUser Editor 5 07-14-2015 03:27 PM
Help - Learning to use Regex Functions weberr Editor 1 06-13-2015 02:59 AM
About saved searches and regex Carpatos Editor 18 09-11-2014 12:27 AM
Limit on length of saved regex? ElMiko Sigil 0 06-30-2013 04:32 PM


All times are GMT -4. The time now is 04:48 PM.


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