@Test public void testTitleWithDoubleQuotes() { String meta = "<doc id=\"http: String content = "Fernandao yeni yıldan şampiyonluk bekliyor\n" + "30.12.2016 Cuma 17:04 (Güncellendi: 30.12.2016 Cuma 17:09)\n" + "Fernandao yeni yıldan şampiyonluk bekliyor\n" + "</doc>"; WebDocument d = WebDocument.fromText(meta, Splitter.on("\n").splitToList(content)); Assert.assertEquals("Fernandao \"yeni yıldan şampiyonluk\" bekliyor", d.getTitle()); }
public static WebDocument fromText(String meta, List<String> pageData) { String url = Regexps.firstMatch(urlPattern, meta, 2); String id = url.replaceAll("http: String source = Regexps.firstMatch(sourcePattern, meta, 2); String crawlDate = Regexps.firstMatch(crawlDatePattern, meta, 2); String labels = getAttribute(labelPattern, meta); String category = getAttribute(categoryPattern, meta); String title = getAttribute(titlePattern, meta); int i = source.lastIndexOf("/"); if (i >= 0 && i < source.length()) { source = source.substring(i + 1); } return new WebDocument(source, id, title, pageData, url, crawlDate, labels, category); }
WebDocument { public static WebDocument fromText(String meta, List<String> pageData) { String url = Regexps.firstMatch(urlPattern, meta, 2); String id = url.replaceAll("http: String source = Regexps.firstMatch(sourcePattern, meta, 2); String crawlDate = Regexps.firstMatch(crawlDatePattern, meta, 2); String labels = getAttribute(labelPattern, meta); String category = getAttribute(categoryPattern, meta); String title = getAttribute(titlePattern, meta); int i = source.lastIndexOf("/"); if (i >= 0 && i < source.length()) { source = source.substring(i + 1); } return new WebDocument(source, id, title, pageData, url, crawlDate, labels, category); } }
WebDocument { public static WebDocument fromText(String meta, List<String> pageData) { String url = Regexps.firstMatch(urlPattern, meta, 2); String id = url.replaceAll("http: String source = Regexps.firstMatch(sourcePattern, meta, 2); String crawlDate = Regexps.firstMatch(crawlDatePattern, meta, 2); String labels = getAttribute(labelPattern, meta); String category = getAttribute(categoryPattern, meta); String title = getAttribute(titlePattern, meta); int i = source.lastIndexOf("/"); if (i >= 0 && i < source.length()) { source = source.substring(i + 1); } return new WebDocument(source, id, title, pageData, url, crawlDate, labels, category); } WebDocument(String source,
      String id,
      String title,
      List<String> lines,
      String url,
      String crawlDate,
      String labels,
      String category); }
WebDocument { public static WebDocument fromText(String meta, List<String> pageData) { String url = Regexps.firstMatch(urlPattern, meta, 2); String id = url.replaceAll("http: String source = Regexps.firstMatch(sourcePattern, meta, 2); String crawlDate = Regexps.firstMatch(crawlDatePattern, meta, 2); String labels = getAttribute(labelPattern, meta); String category = getAttribute(categoryPattern, meta); String title = getAttribute(titlePattern, meta); int i = source.lastIndexOf("/"); if (i >= 0 && i < source.length()) { source = source.substring(i + 1); } return new WebDocument(source, id, title, pageData, url, crawlDate, labels, category); } WebDocument(String source,
      String id,
      String title,
      List<String> lines,
      String url,
      String crawlDate,
      String labels,
      String category); static WebDocument fromText(String meta, List<String> pageData); int contentLength(); void removeDuplicateLines(); String getDocumentHeader(); WebDocument emptyContent(); String getLabelString(); String getCategory(); List<String> getLabels(); String getTitle(); long getHash(); String getContentAsString(); List<String> getLines(); void setContent(List<String> lines); @Override boolean equals(Object o); String getSource(); String getId(); String getUrl(); @Override int hashCode(); }
WebDocument { public static WebDocument fromText(String meta, List<String> pageData) { String url = Regexps.firstMatch(urlPattern, meta, 2); String id = url.replaceAll("http: String source = Regexps.firstMatch(sourcePattern, meta, 2); String crawlDate = Regexps.firstMatch(crawlDatePattern, meta, 2); String labels = getAttribute(labelPattern, meta); String category = getAttribute(categoryPattern, meta); String title = getAttribute(titlePattern, meta); int i = source.lastIndexOf("/"); if (i >= 0 && i < source.length()) { source = source.substring(i + 1); } return new WebDocument(source, id, title, pageData, url, crawlDate, labels, category); } WebDocument(String source,
      String id,
      String title,
      List<String> lines,
      String url,
      String crawlDate,
      String labels,
      String category); static WebDocument fromText(String meta, List<String> pageData); int contentLength(); void removeDuplicateLines(); String getDocumentHeader(); WebDocument emptyContent(); String getLabelString(); String getCategory(); List<String> getLabels(); String getTitle(); long getHash(); String getContentAsString(); List<String> getLines(); void setContent(List<String> lines); @Override boolean equals(Object o); String getSource(); String getId(); String getUrl(); @Override int hashCode();  }