Seeking a solution to splitting a paragraph into individual sentences, I initially attempted the following code:
var sentences = paragraph.split('.');
While this method was effective in most cases, it encountered issues with sentences like:
Alaska is the largest state in the U.S.
Due to the presence of periods in U.S.
, it mistakenly identified S
as a separate sentence.
Is there a more reliable approach for determining sentences within a paragraph? One thought was to look for the last period before a capital letter, but this could also fail if the paragraph is not properly formatted (ending with a lowercase letter after the period).