@Test public void testSentenceBoundaries() { String text = "Human rights in Tanzania.\nThe issue of human rights in Tanzania, a nation with a 2012 population of 44,928,923, is hard. In its 2013 Freedom in the World report, Freedom House declared the country \"Partly Free\".\nHuman rights concerns.\nThe United Nations Human Rights Council in October 2011 at its meeting in Geneva completed a Universal Periodic Review (UPR) of the human rights situation in Tanzania. At this UPR, the United Nations Country Team (UNCT) and several countries addressed various problems in Tanzania.\nGender equality.\nNational reviews and assessments of equality between men and women... have identified a range of challenges..., which continue to prevail. These include the persistent and increasing burden of poverty on women; inequalities in arrangements for productive activities and in access to resources; inequalities in the sharing of power and decision-making; lack of respect for and inadequate promotion and protection of the human rights of women; and inequalities in managing natural resources and safeguarding the environment.... Particular attention should be drawn to the widespread marginalization of the girl child in different spheres of life, including education, and the total exclusion caused for many by early and forced marriage.... Gender-based violence is prevalent."; Document doc = DocumentFactory.fromText(text,DocumentFactory.Newlines.DISCARD); Assert.assertEquals(9, doc.countSentences()); Assert.assertEquals(text.replace("\n", " "), doc.getText()); }
public static Document fromText(String text) { return instance.createFromText(text); }
DocumentFactory { public static Document fromText(String text) { return instance.createFromText(text); } }
DocumentFactory { public static Document fromText(String text) { return instance.createFromText(text); } DocumentFactory(); }
DocumentFactory { public static Document fromText(String text) { return instance.createFromText(text); } DocumentFactory(); static DocumentFactory getInstance(); static Document fromText(String text); static Document fromText(String text, Newlines newlines); static Document fromText(String text, Newlines newlines, WordHelpers.Language lang); static Document fromTokenizedText(String text); static Document fromTokens(List<Token> tokens); static List<Token> createTokensFromText(String text); static List<Token> createTokensFromTokenizedText(String text); static Sentence createSentenceFromTokens(List<Token> tokens); static Sentence createSentenceFromString(String text, String language); static Sentence createSentenceFromTokenizedString(String text); static String getLanguage(String text); Document createFromText(String text); Document createFromText(String text, Newlines newlines); Document createFromText(String text, Newlines newlines, WordHelpers.Language lang); void addToDocumentFromText(String text, Document doc, Newlines newlines); void addToDocumentFromText(String text, Document doc, Newlines newlines, String language); synchronized String detectLanguage(String text); Document createFromTokens(List<Token> tokens); List<Sentence> createSentencesFromTokens(List<Token> tokens); List<Sentence> createSentencesFromTokens(List<Token> tokens, String language); List<Token> createTokensFromText(String text, int offset); List<Token> createTokensFromText(String text, int offset, String language); List<Token> createTokensFromTokenizedText(String text, int offset); void retokenize(Document doc); }
DocumentFactory { public static Document fromText(String text) { return instance.createFromText(text); } DocumentFactory(); static DocumentFactory getInstance(); static Document fromText(String text); static Document fromText(String text, Newlines newlines); static Document fromText(String text, Newlines newlines, WordHelpers.Language lang); static Document fromTokenizedText(String text); static Document fromTokens(List<Token> tokens); static List<Token> createTokensFromText(String text); static List<Token> createTokensFromTokenizedText(String text); static Sentence createSentenceFromTokens(List<Token> tokens); static Sentence createSentenceFromString(String text, String language); static Sentence createSentenceFromTokenizedString(String text); static String getLanguage(String text); Document createFromText(String text); Document createFromText(String text, Newlines newlines); Document createFromText(String text, Newlines newlines, WordHelpers.Language lang); void addToDocumentFromText(String text, Document doc, Newlines newlines); void addToDocumentFromText(String text, Document doc, Newlines newlines, String language); synchronized String detectLanguage(String text); Document createFromTokens(List<Token> tokens); List<Sentence> createSentencesFromTokens(List<Token> tokens); List<Sentence> createSentencesFromTokens(List<Token> tokens, String language); List<Token> createTokensFromText(String text, int offset); List<Token> createTokensFromText(String text, int offset, String language); List<Token> createTokensFromTokenizedText(String text, int offset); void retokenize(Document doc);  }