View Single Post
Old 02-12-2020, 05:20 PM   #35
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,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by JSWolf View Post
Mind posting your steps please? Thanks.
Nothing has really changed in the American “” (Outer) ‘’ (Inner) <-> British ‘’ (Outer) “” (Inner)...

See the 2016 topic, "How to convert straight quotes to smart 'curly' typographer's quotes" (especially my post #26, but read the entire topic). Same exact people have the same exact comments 4 years later.

But I'll go into a bit more detail here.

Flipping Inner/Outer Quotes

The vast majority could be flipped with no issue (using Jellby's "intermediate symbol" method):
  • “ -> ¬
  • ” -> |
  • ‘ -> ¦
  • ’ -> @

(Personally, I wouldn't use the @, too common. But you can pick any obscure Unicode characters, like ¤ CURRENCY SIGN (U+00A4))

Then you just have to search/replace the INNER/OUTER symbols to their opposite.

Outer -> Inner:
  • “ -> ‘
    • “ -> ¦
  • ” -> ’
    • ” -> @

Inner -> Outer:
  • ‘ -> “
    • ‘ -> ¬
  • ’ -> ”
    • ’ -> |

* * *

"Actual Apostrophe" Note: You could do this pass before or after substition. It's up to you.

Look for very common apostrophe word-endings:
  • ’s
  • ’ll
  • ’d

Mark those with a different symbol for "actual apostrophe" (let's pick the ¤ CURRENCY SIGN):
  • It¤s
  • I¤ll
  • You¤d

You could even mark those words that actually use a RIGHT SINGLE QUOTE:
  • ¤tis
  • ¤til
  • ¤em

You'll also have to check possessives that end with s + apostrophe:
  • Zeus’
  • Chris’

(These have to be decided on a case-by-case basis, because you don't know if it's the end of a quotation or not.)

* * *

Now you replace all those intermediate symbols with the new INNER/OUTER quotations.

Outer -> Inner:
  • ¦ -> ‘
  • @ -> ’

Inner -> Outer:
  • ¬ -> “
  • | -> ”

"Actual Apostrophe":
  • ¤ -> ’

Look For Mismatches

Afterwards, like the above 2016 topic discusses, you have to do a more thorough check (like Toxaris's Dialogue Check) which looks for mismatching sets of outer/inner quotes.

You could roughly get it with some Regex that looks for these in the same paragraph:
  • opening quote + opening quote
  • closing quote + closing quote

(If you're doing this, you'll probably want to do this while you still have "Actual Apostrophes" marked as ¤... so they don't interfere.)

Note: Pure Regex will definitely miss a few though. You need something slightly more intelligent that checks both forwards/backwards for mismatches (Toxaris's Dialogue Check is the only thing I know of that does this).

Note 2: Like Jellby says, there are typically a lot of wrong LEFT/RIGHT errors in lots of ebooks (especially around em dashes), so a program may want to squash a lot of those BEFORE doing the flipping steps.

Note 3: Depending on the language, you may have even more "actual apostrophes" in the middle of words... like French uses a lot of:
  • l’influence
  • d’économie

so another "actual apostrophe" check may just be assume anything in the middle of a word is one:

Search: (\w)’(\w)
Replace: \1¤\2

Last edited by Tex2002ans; 02-12-2020 at 05:39 PM.
Tex2002ans is offline   Reply With Quote