Automators 49: Reusable Shortcuts with Scotty Jackson

Automators should prefer two spaces. It helps with regular expressions for differentiation between ends of sentences and just an abbreviation.

But by default, autocorrect on iOS and macOS changes two spaces to . - less than ideal!

3 Likes

Trying to work out sentences is hard. Edge cases and pitfalls abound - abbreviations, ellipsis, emoji/ascii pics, unicode characters. Not every sentence ends with a period-based (.:?!) character followed by spaces, new lines (CRLF/CR/LF), or end of file :wink:

Spot the example?

That complexity is why it’s been a bubbling topic for using machine learning for the last decade or so.

Generally speaking, trying to tackle sentence structures with a regular expression alone is prone to error, unless you are working with a highly constrained data set.

2 Likes

two spaces is an artifact of typewriters, and is not needed in modern use. If you want to use multiple spaces in code, that is certainly fine (unless you are using an abomination language in which spaces are significant), but when writing, putting two spaces after a period is simply an error in style unique to people who confuse computers with typewriters. Robin Williams (not that one) covered this maybe 30 years ago in “The Mac is Not a Typewriter”.

Didn’t two spaces originate from the typography used in printing, predating the typewriter? I thought it had to do with the quality of the print and being able to distinguish the end of the word by more than just a period which on occasion could occur as an artefact in the print process. The only thing for the typewriter that comes to mind is keyboard layouts to reduce the risk of the hammers clashing.

I learnt word processing (you could buy standalone word processor devices back then that were not personal computers)in the early 1980’s, and the course I learnt from still used double spacing. I was a young child reading from a course text, so I never questioned the practice at the time. It is honestly a habit that as a result I have never personally been able to break. It’s just too ingrained, and I wish it wasn’t.

I think that the shift from double to single must have been staggered over the course of several decades in the 20th century judging by the differences I see amongst my peers over double and single spaces.

Just no one mention tabs vs. spaces okay? :wink:

I agree with Gruber.

1 Like

Nah, you can look for multiple forms of punctuation with a regex, but the two spaces is the key.

I’ve never heard this, and as someone who did typesetting back in the 80s, no , we did not put extra space after a period. This was a typewriter thing only because of the fixed width of the period (same width as the M) made it more difficult to see the end of a sentence. Look at any printed book (remember those).

And, of course, HTML collapses multiple spaces, so people have to go to extraordinary lengths to artificially inflate the space between sentences. (period space, nbsp, space, nbsp, space, <new sentence). And when people do this, it looks terrible.