This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Can your sentences end with other characters as well like '?', or '!' ?
You have to read your question carefully to deduce what makes up a sentence and what doesn't. Maybe your question simplifies matters by stating that each sentence is in its own line?
Joined: Oct 18, 2013
It is sentence in a HTML file.It does not end with any character.They end with tags
More Details:I have 3 strings with start and end indexes.So i read a particular HTML page where these 3 strings located.And check whether they are located in a same sentence or not.
I think the problem is something else. The problem is that "Barack Obama was born on November 4 1960. Michael Smith is not related to him." should yield a "yes" for containing all 3 phrases in a single sentence, whereas that "Michael Smith was born on November 4 1960. Barack Obama is not related to him." should yield "no".
Sarah, is that the problem you're trying to solve?
I was missing something! It seems to me now that the OP first needs to break the String into sentences and then test each sentence in the manner I proposed. Of course a sentence does not need to end in a full stop !
Joined: Oct 18, 2013
Let me give clarification.
I want to check whether 3 strings located in a valid sentence.
To make sure that the 3 strings located in a same sentence i am just checking for period or fullstop.If there is no full stop in between i am believing that it is same sentence
But the Problem is the sentence Mr.smith and mrs.smith both born on April 2 1970 is also a valid sentence.But my assumption fails.There is a fullstop in between.But the 3 strings are located in same sentence.
The solution is i have to use BreakIterator.getSentenceInstance(Locale.GERMANY) to get a sentence validated.