jsoup - 从维基百科文章中提取文本
我正在编写一些 Java 代码,以便使用维基百科的文本实现 NLP 任务。如何使用 JSoup 提取维基百科文章的所有文本(例如 http:// 中的所有文本en.wikipedia.org/wiki/Boston)?
I'm writing some Java code in order to realize NLP tasks upon texts using Wikipedia. How can I use JSoup to extract all the text of a Wikipedia article (for example all the text in http://en.wikipedia.org/wiki/Boston)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当然,您可以通过这种方式检索格式化内容。如果您想要“原始”内容,可以使用
Jsoup.clean
过滤结果或使用调用contentDiv.text()
。You retrieve formatted content this way, of course. If you want "raw" content you can filter the result with
Jsoup.clean
or use the callcontentDiv.text()
.或者
OR