import com.aliasi.sentences.HeuristicSentenceModel; import java.util.HashSet; import java.util.Set; /** * This DemoSentenceModel extends the LingPipe * HeuristicSentenceModel and is intended to be used as * testbed for developing application or domain-specific sentence * models. * * It provides minimally populated sets for * POSSIBLE_STOPS, IMPOSSIBLE_PENULTIMATES, * and IMPOSSIBLE_SENTENCE_STARTS. * * The LingPipe API Tutorial on using Sentence Models provides * examples of how to build out this class. */ public class DemoSentenceModel extends HeuristicSentenceModel { /** * Construct a demo sentence model. */ public DemoSentenceModel() { super(POSSIBLE_STOPS, IMPOSSIBLE_PENULTIMATES, IMPOSSIBLE_SENTENCE_STARTS, false, // force final stop false); // balance parens } private static final Set POSSIBLE_STOPS = new HashSet(); static { POSSIBLE_STOPS.add("."); } private static final Set IMPOSSIBLE_PENULTIMATES = new HashSet(); static { // Common Abbreviations // IMPOSSIBLE_PENULTIMATES.add("Bros"); // Personal Honorifics IMPOSSIBLE_PENULTIMATES.add("Mme"); // IMPOSSIBLE_PENULTIMATES.add("Mr"); // Professional Honorifics IMPOSSIBLE_PENULTIMATES.add("Dr"); // Name Suffixes // IMPOSSIBLE_PENULTIMATES.add("Jr"); // Corporate Designators // IMPOSSIBLE_PENULTIMATES.add("Co"); } private static final Set IMPOSSIBLE_SENTENCE_STARTS = new HashSet(); static { IMPOSSIBLE_SENTENCE_STARTS.add(")"); IMPOSSIBLE_SENTENCE_STARTS.add("]"); IMPOSSIBLE_SENTENCE_STARTS.add("}"); IMPOSSIBLE_SENTENCE_STARTS.add(">"); // IMPOSSIBLE_SENTENCE_STARTS.add("<"); IMPOSSIBLE_SENTENCE_STARTS.add("."); IMPOSSIBLE_SENTENCE_STARTS.add("!"); IMPOSSIBLE_SENTENCE_STARTS.add("?"); IMPOSSIBLE_SENTENCE_STARTS.add(":"); IMPOSSIBLE_SENTENCE_STARTS.add(";"); IMPOSSIBLE_SENTENCE_STARTS.add("-"); IMPOSSIBLE_SENTENCE_STARTS.add("--"); IMPOSSIBLE_SENTENCE_STARTS.add("---"); IMPOSSIBLE_SENTENCE_STARTS.add("%"); } }