Web ページの内容の要約を書こうとしています。そのためには、Web ページから無関係なテキストとデータをすべて抽出する必要があります。
私はボイラーパイプを使用しましたが、テキストの抽出はうまくいきません。結果はここにあります。ここには、無関係なテキストがたくさん表示されます。
また、ヘッダー、フッター、外部リンクなどを削除して、JSoup で無関係なデータを削除しようとしましたが、やはり結果は的を射ていません。
Document doc = Jsoup.connect("www.anyurl.com").get()
doc.head().remove();
doc.getElementsByTag("header").remove();
doc.getElementsByTag("footer").remove();
doc.getElementsByTag("form").remove();
doc.getElementsByTag("table").remove();
doc.getElementsByTag("meta").remove();
doc.getElementsByTag("img").remove();
doc.getElementsByTag("a").remove();
doc.getElementsByTag("br").remove();
doc.getElementsByClass("tags").remove();
doc.getElementsByClass("copyright").remove();
doc.getElementsByClass("widget").remove();
doc.select("div[class*=foot").remove();
doc.select("div[class*=tag").remove();
doc.select("div[class*=Loading").remove();
doc.select("div[class*=Widget").remove();
doc.select("div[class*=Head").remove();
doc.select("div[class*=menu").remove();
doc.select("p[class*=link").remove();
Elements paragraphs = doc.select("p");
Elements divs = doc.select("div");
formattedOutput = paragraphs.text() + divs.text();
誰かがこれを行う方法を教えてもらえますか? ボイラーパイプ以外の Java ライブラリはありますか?