fix paragraph/sentence counting

add separate implementation that works on strings; making multiple
passes is slightly (1.13x) faster than iterating over lines.