29 lines
656 B
Java
29 lines
656 B
Java
|
//import java.util.regex.Pattern;
|
||
|
|
||
|
public class Text {
|
||
|
private Sentence[] sentences;
|
||
|
|
||
|
public Text(String input) {
|
||
|
String[] rawSentences = input.split("\\[.?!]( |$)");
|
||
|
Sentence[] newSentences = new Sentence[rawSentences.length];
|
||
|
|
||
|
for (int i = 0; i < rawSentences.length; i++) {
|
||
|
newSentences[i] = new Sentence(rawSentences[i]);
|
||
|
}
|
||
|
|
||
|
this.sentences = newSentences;
|
||
|
}
|
||
|
|
||
|
public void cleanFirstSentence() {}
|
||
|
|
||
|
public String toString() {
|
||
|
String result = "";
|
||
|
|
||
|
for (Sentence s : this.sentences) {
|
||
|
result += s.toString() + " ";
|
||
|
}
|
||
|
|
||
|
return result;
|
||
|
}
|
||
|
}
|