4 ms·
Hopefully 2015 will be the year of capitalizing the first letter of the first word in a new sentence.
by rubiquity 12y ago
Hopefully 2015 will be the year of capitalizing the first letter of the first word in a new sentence.
- bootload 12y ago"... capitalizing the first letter of the first word in a new sentence. ..." Faster to type, easy to run a bit of code to achieve.
- qznc 12y agoIt is not "easy [...] to achieve", e.g. try the code on this sentence, Dr. bootload.
- Retr0spectrum 12y agoShouldn't it be "Dr. Bootload" anyway?
- samatman 12y agoIt is certainly Dr. bell hooks.
- bootload 12y agoThe only real constraints are sentences with first non-alpha. I'd try something like: converted is store for modified text new paragraph is store for modified sentences abbreviations is list of common abbreviations (eg,nb,dr...) paragraph is split by newline '\n' for each newline in paragraph /* abbreviation check using '.' seps */ if fullstops in newline greater than one check newline for abbreviations and replace /* break down para into newlines by '.' */ split newline into sentences by '.' for sentence in sentences if sentence starts with word replace first letter with upper else move to first word, replace with upper /* build up paragraphs */ append sentence to new paragraph /* modified text */ append new paragraph to converted write converted to display tricky bit is 'abbreviations & dots' [0] & preserving the format. Will fail on names (eg: J.A. Smith) [0] https://en.wikipedia.org/wiki/Lists_of_abbreviations https://en.wikipedia.org/wiki/Lists_of_abbreviations
- fredwilson 12y agoha! that's great. i don't think i'm going to do that though.
- rubiquity 12y agoYou did it![0] 0 - http://avc.com/2015/01/what-is-going-to-happen/ http://avc.com/2015/01/what-is-going-to-happen/