Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Workshop

Notices

Reply
 
Thread Tools Search this Thread
Old 10-27-2009, 01:01 PM   #1
Elfwreck
Grand Sorcerer
Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.
 
Elfwreck's Avatar
 
Posts: 5,185
Karma: 25133758
Join Date: Nov 2008
Location: SF Bay Area, California, USA
Device: Pocketbook Touch HD3 (Past: Kobo Mini, PEZ, PRS-505, Clié)
Change single quotes to double quotes

Does anyone know any batch methods for converting single quotes, but not apostrophes, to double quotes?

I'm OCR'ing a scanned book, and I want a final version I can read without twitching. I'm considering using Word's find-and-replace to change space-apostrophe into space-dblquote, and apostrophe-space into dblquote-space. Especially since this book seems to favor apostrophe-s even for words that end with s. (Yeats's. Moss's. Democritus's.)
Elfwreck is offline   Reply With Quote
Old 10-27-2009, 02:06 PM   #2
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,536
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by Elfwreck View Post
Does anyone know any batch methods for converting single quotes, but not apostrophes, to double quotes?
For goodness' sake, don't change 'em all!
Jellby is offline   Reply With Quote
Old 10-27-2009, 02:18 PM   #3
Elfwreck
Grand Sorcerer
Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.
 
Elfwreck's Avatar
 
Posts: 5,185
Karma: 25133758
Join Date: Nov 2008
Location: SF Bay Area, California, USA
Device: Pocketbook Touch HD3 (Past: Kobo Mini, PEZ, PRS-505, Clié)
Quote:
Originally Posted by Jellby View Post
For goodness' sake, don't change 'em all!
Presumably not all; I suppose there are probably single quotes within the double quotes that are supposed to stay that way. But I might have an easier time replacing them all, and then manually fixing, than just trying to manually change them.
Elfwreck is offline   Reply With Quote
Old 10-27-2009, 04:11 PM   #4
ahi
Wizard
ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.
 
Posts: 1,790
Karma: 507333
Join Date: May 2009
Device: none
Quote:
Originally Posted by Elfwreck View Post
Presumably not all; I suppose there are probably single quotes within the double quotes that are supposed to stay that way. But I might have an easier time replacing them all, and then manually fixing, than just trying to manually change them.
If it isn't too heavily formatted, I could run my WIP version of Pacify.py on an RTF you email me (you know where) and it might leave you in reasonably good shape.

Or, if you are feeling brave, I could send you the WIP version of Pacify.py... but you'll need Python 3 installed.

- Ahi
ahi is offline   Reply With Quote
Old 10-27-2009, 04:17 PM   #5
Elfwreck
Grand Sorcerer
Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.
 
Elfwreck's Avatar
 
Posts: 5,185
Karma: 25133758
Join Date: Nov 2008
Location: SF Bay Area, California, USA
Device: Pocketbook Touch HD3 (Past: Kobo Mini, PEZ, PRS-505, Clié)
Quote:
Originally Posted by ahi View Post
If it isn't too heavily formatted, I could run my WIP version of Pacify.py on an RTF you email me (you know where) and it might leave you in reasonably good shape.

Or, if you are feeling brave, I could send you the WIP version of Pacify.py... but you'll need Python 3 installed.
Python terrifies me slightly more than BookDesigner.

It's not heavily formatted, and when I get the basic OCR correction done, I'll send it to you. (40 pages down, 600 to go. Sigh.)
Elfwreck is offline   Reply With Quote
Old 10-27-2009, 04:20 PM   #6
ahi
Wizard
ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.ahi ought to be getting tired of karma fortunes by now.
 
Posts: 1,790
Karma: 507333
Join Date: May 2009
Device: none
Quote:
Originally Posted by Elfwreck View Post
Python terrifies me slightly more than BookDesigner.

It's not heavily formatted, and when I get the basic OCR correction done, I'll send it to you. (40 pages down, 600 to go. Sigh.)
Sounds good.

- Ahi
ahi is offline   Reply With Quote
Old 10-27-2009, 06:52 PM   #7
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Here are some Python regexs I wrote to do exactly what you want... I know Python scares you but learning some type of regex (Python, Perl, sed...) is a very powerful tool especially if you are editing books regularly.
user_none is offline   Reply With Quote
Old 10-27-2009, 07:20 PM   #8
Patricia
Reader
Patricia ought to be getting tired of karma fortunes by now.Patricia ought to be getting tired of karma fortunes by now.Patricia ought to be getting tired of karma fortunes by now.Patricia ought to be getting tired of karma fortunes by now.Patricia ought to be getting tired of karma fortunes by now.Patricia ought to be getting tired of karma fortunes by now.Patricia ought to be getting tired of karma fortunes by now.Patricia ought to be getting tired of karma fortunes by now.Patricia ought to be getting tired of karma fortunes by now.Patricia ought to be getting tired of karma fortunes by now.Patricia ought to be getting tired of karma fortunes by now.
 
Patricia's Avatar
 
Posts: 11,504
Karma: 8720163
Join Date: May 2007
Location: South Wales, UK
Device: Sony PRS-500, PRS-505, Asus EEEpc 4G
I've just done this, in order to get the quotation marks consistents in a short story collection, pieced from various sources. This is what I did:

1. Search for double quotes (used for internal quotations). Replace with @ or # as a placeholder.
2. Replace single-quote plus space, and space plus single quote with doublequotes and spaces.
3. Replace @ or # with single-quotes.
4. Then check the lot, just in case. (Sometimes authors add punctuation immediately after closing a quotation.)

I did all this in Word, then put the edited version into Book Designer.
Patricia is offline   Reply With Quote
Old 10-27-2009, 07:56 PM   #9
Elfwreck
Grand Sorcerer
Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.
 
Elfwreck's Avatar
 
Posts: 5,185
Karma: 25133758
Join Date: Nov 2008
Location: SF Bay Area, California, USA
Device: Pocketbook Touch HD3 (Past: Kobo Mini, PEZ, PRS-505, Clié)
Quote:
Originally Posted by user_none View Post
Here are some Python regexs I wrote to do exactly what you want... I know Python scares you but learning some type of regex (Python, Perl, sed...) is a very powerful tool especially if you are editing books regularly.
Ahhm... advice for a clueless Windows user? What version should I use for Vista? (Suggestions to remove Vista and replace with Ubuntu will not be well-received; my husband's flight-sim game won't run on Linux. AFAIK, neither will FineReader. And my kids hate OpenOffice.)

FWIW, my programming skills:
I can write very very simple .bat files for dos. VERY simple. With Google to help me figure out the commands I need. And backing up all the files first, in case I accidentally erase them all with the wrong command.
Elfwreck is offline   Reply With Quote
Old 10-27-2009, 07:59 PM   #10
Elfwreck
Grand Sorcerer
Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.
 
Elfwreck's Avatar
 
Posts: 5,185
Karma: 25133758
Join Date: Nov 2008
Location: SF Bay Area, California, USA
Device: Pocketbook Touch HD3 (Past: Kobo Mini, PEZ, PRS-505, Clié)
Quote:
Originally Posted by Patricia View Post
1. Search for double quotes (used for internal quotations). Replace with @ or # as a placeholder.
2. Replace single-quote plus space, and space plus single quote with doublequotes and spaces.
3. Replace @ or # with single-quotes.
4. Then check the lot, just in case. (Sometimes authors add punctuation immediately after closing a quotation.)

I did all this in Word, then put the edited version into Book Designer.
That's about what I'm considering, with the complication that the quote marks are often inside the punctuation. But I can search for quote-comma-space, quote-question-space, and quote-period-space instead of just quote-space.

I'm just annoyed that it's disrupting the spellcheck; FineReader stops on all the words with an apostrophe at the end to ask me if it's misspelled. And FR's search-and-replace is much more limited than Word's; I don't want to do the replacing there.
Elfwreck is offline   Reply With Quote
Old 10-27-2009, 10:08 PM   #11
frabjous
Wizard
frabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
frabjous's Avatar
 
Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
Quote:
Originally Posted by Elfwreck View Post
Ahhm... advice for a clueless Windows user? What version should I use for Vista?
Well, first things first... uninstall Windows and install Arch-Linux...

Just kidding.

Python's re module should run under Python 2.6.4, on any OS, I would think. (I'm just learning myself, though.) User_none hasn't given you a full script though. I think the intent was just to provide the actual regex expressions which you could use inside another script, or just with a text editor that does RegEx search and replaces in a way compatible with Python's, or a very similar way. I imagine there are such editors for Windows. I don't know what they are, mind you...

(Do keep in mind however that you can run Ubuntu from a live CD or in a virtual box if you're so enamored of your precious Windows....)
frabjous is offline   Reply With Quote
Old 10-27-2009, 11:11 PM   #12
Elfwreck
Grand Sorcerer
Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.Elfwreck ought to be getting tired of karma fortunes by now.
 
Elfwreck's Avatar
 
Posts: 5,185
Karma: 25133758
Join Date: Nov 2008
Location: SF Bay Area, California, USA
Device: Pocketbook Touch HD3 (Past: Kobo Mini, PEZ, PRS-505, Clié)
Quote:
Originally Posted by frabjous View Post
(Do keep in mind however that you can run Ubuntu from a live CD or in a virtual box if you're so enamored of your precious Windows....)
Am contemplating getting a Linux CD. I am not "enamored" of Windows so much as "used to it, and stuck with it." I've got software that I'm *very* practiced with, that I'm told doesn't translate well, or at all. I'm not thrilled with Windows, but I very much like the Office 03 Suite, Adobe CS, FineReader, Pixedit, and my double-handful of tiny programs nobody's ever heard of that make my conversion projects easier. And I'm sure all those tiny programs have (better) Unix-ish versions... but I'd have to find them, and figure out how to use them.

Switching to Unix of any sort would mean learning a whole new OS *and* a whole new set of programs, from scratch. It's on the list of things I'd like to do if I ever have six months when I won't mind the frustration of not being able to do what I *know* the computer is supposed to do. (It's slightly above "learn Dvorak keyboard" on my personal list of projects. And "learn perl" is right behind "learn Sindarin" on my list of language skills to acquire.)

I've wanted to switch to Linux since, oh, just before Win-NT came out? I'm just not geek enough to manage it on my own, and the geekfriend who introduced me to Unix went off to Colorado to attend grad school. (Any real switch, as opposed to playing with a bootable disc, is probably waiting for a good friend who can visit my house at least twice a week, often on short notice, to remind me how to do complex procedures like "move files from one place to another" and "play this movie so it fills up the screen.")
Elfwreck is offline   Reply With Quote
Old 10-28-2009, 02:13 AM   #13
pepak
Guru
pepak has a spectacular aura aboutpepak has a spectacular aura aboutpepak has a spectacular aura aboutpepak has a spectacular aura aboutpepak has a spectacular aura aboutpepak has a spectacular aura aboutpepak has a spectacular aura aboutpepak has a spectacular aura aboutpepak has a spectacular aura aboutpepak has a spectacular aura aboutpepak has a spectacular aura about
 
Posts: 610
Karma: 4150
Join Date: Mar 2008
Device: Sony Reader PRS-T3, Kobo Libra H2O
I like to use this regular expression:
Code:
Search = ([>_])'(.*?[^a-z_])'([<_])
Replace = $1{opening_quote}$2{closing_quote}$3
(replace _ in the search string with space)
It is intended for HTML source with reasonable typography (e.g. proper punctuation before closing quotes) and can't handle some situations (words starting with an apostrophe followed by real opening quotes), but apart from that it performs surprisingly well.
pepak is offline   Reply With Quote
Old 10-28-2009, 10:21 PM   #14
Ankh
Guru
Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.Ankh ought to be getting tired of karma fortunes by now.
 
Ankh's Avatar
 
Posts: 714
Karma: 2003751
Join Date: Oct 2008
Location: Ottawa, ON
Device: Kobo Glo HD
Quote:
Originally Posted by Elfwreck View Post
Ahhm... advice for a clueless Windows user? What version should I use for Vista? (Suggestions to remove Vista and replace with Ubuntu will not be well-received; my husband's flight-sim game won't run on Linux. AFAIK, neither will FineReader. And my kids hate OpenOffice.)
If you have sufficient disk space (a machine that can run MS Vista has more than adequate processor and memory) you can install (free) vmware player, install Ubuntu (or any other OS) and run it as a virtual machine. Works well for occasional use. Most of ebook related processing is light on resources...

You don't have to remove Vista or inconvenience your family.
Ankh is offline   Reply With Quote
Old 10-29-2009, 11:01 PM   #15
AlbertaCowboy
Guru
AlbertaCowboy ought to be getting tired of karma fortunes by now.AlbertaCowboy ought to be getting tired of karma fortunes by now.AlbertaCowboy ought to be getting tired of karma fortunes by now.AlbertaCowboy ought to be getting tired of karma fortunes by now.AlbertaCowboy ought to be getting tired of karma fortunes by now.AlbertaCowboy ought to be getting tired of karma fortunes by now.AlbertaCowboy ought to be getting tired of karma fortunes by now.AlbertaCowboy ought to be getting tired of karma fortunes by now.AlbertaCowboy ought to be getting tired of karma fortunes by now.AlbertaCowboy ought to be getting tired of karma fortunes by now.AlbertaCowboy ought to be getting tired of karma fortunes by now.
 
AlbertaCowboy's Avatar
 
Posts: 819
Karma: 171672846
Join Date: Jan 2009
Location: Alberta, Canada
Device: PRS-350, PRS-650, iPhone 6, NVIDIA Shield K1
I use "eBook Tidy", which has a "change single quote to double quote" function. This function changes what the program percieves as being quotes and does a pretty good job of leaving apostrophes alone. The only problem with ebook tidy is that it only handles text. Pictures get wiped out of the material as soon as it is imported. Works great for novels and text only books though. I'm pretty sure if you Google ebook tidy it leads you to the download page.
AlbertaCowboy is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Single quotes to double quotes? lunixer General Discussions 35 10-10-2010 05:47 AM
Dealing with double quotes " in URL kinurev Recipes 6 10-03-2010 09:57 AM
convert straight quotes to curly quotes alansplace Calibre 3 09-25-2010 03:51 PM
Quotes novels.books Astak EZReader 4 10-26-2009 09:56 PM


All times are GMT -4. The time now is 07:56 PM.


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