【发布时间】:2014-02-01 18:16:05
【问题描述】:
我正在尝试使用boilerpipe 从非英文文本中提取新闻文章。我已经看过this,但它对我不起作用。我做了以下更改 1)修改HTMLfetcher.java。在方法 fetch 结束前添加以下行
byte[] utf8 = new String(data, cs.displayName()).getBytes("UTF-8"); //new one (convertion)
cs = Charset.forName("UTF-8"); //set the charset to UFT-8
或者/然后 2) 使用带有 Inuts 的 UTF-8 字符集更改类中的代码
`URL url = new URL(urls);
InputSource is = new InputSource();
is.setEncoding("ISO-8859-1");
is.setByteStream(url.openStream());
text = ArticleExtractor.INSTANCE.getText(is);`
还是不行 测试网址:http://www.sandesh.com/article.aspx?newsid=2905443 文本:મુંબઈ, 30 જાન્યુઆરી
સલમાનસલમાનખાનેગુજરાતમાંઆવીનેનરેન્દ્રવખાણશુશુકર્યાતેનીમુસીબતોમાંવધારોથઈગયો � છે.
请帮帮我。
【问题讨论】:
标签: character-encoding boilerpipe