Mastering Java for Data Science by Grigorev Alexey

Mastering Java for Data Science by Grigorev Alexey

Author:Grigorev, Alexey [Grigorev, Alexey]
Language: eng
Format: azw3, epub
Publisher: Packt Publishing
Published: 2017-05-04T04:00:00+00:00


for (String line : lines) {

String[] split = line.split("t");

String url = split[3];

Optional<String> html = urls.get(url);

if (!html.isPresent()) {

continue;

}

org.jsoup.nodes.Document jsoupDoc = Jsoup.parse(html.get());

Element body = jsoupDoc.body();

if (body == null) {

continue;

}

Document doc = new Document();

doc.add(new Field("url", url, URL_FIELD));

doc.add(new Field("title", jsoupDoc.title(), URL_FIELD));

doc.add(new Field("content", body.text(), BODY_FIELD));

writer.addDocument(doc);

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.