src/parsetree.js
function capitalize (text) {
  return text
    .replace (/^([^A-Za-z]*)([a-z])/, function (m, g1, g2) { return g1 + g2.toUpperCase() })
    .replace (/([\.\!\?]\s*)([a-z])/g, function (m, g1, g2) { return g1 + g2.toUpperCase() })
}
function capitalize (text) {
  return text
    .replace (/^([^A-Za-z]*)([a-z])/, function (m, g1, g2) { return g1 + g2.toUpperCase() })
    .replace (/([\.\!\?]\s*)([a-z])/g, function (m, g1, g2) { return g1 + g2.toUpperCase() })
}
function capitalize ( text ) { return text . replace ( / ^([^A-Za-z]*)([a-z]) / , function ( m , g1 , g2 ) { return g1 + g2 . toUpperCase ( ) } ) . replace ( / ([\.\!\?]\s*)([a-z]) / g , function ( m , g1 , g2 ) { return g1 + g2 . toUpperCase ( ) } ) }
Capitalization of first letters in sentences
Capitalization of first letters in sentences