2017-03-16 61 views
0

我正在尋找一個簡單的解析器,它將帶有wiki標記代碼的字符串翻譯爲可讀的純文本,例如,簡單的維基百科文本到純文本分析器?

A lot of these sources can also be used to add to other parts of the article, like the plot section. <font color="silver">[[User:Silver seren|Silver]]</font><font color="blue">[[User talk:Silver seren|seren]]</font><sup>[[Special:Contributions/Silver seren|C]]</sup> 05:34, 22 March 2012 (UTC) 

A lot of these sources can also be used to add to other parts of the article, like the plot section. SilverserenC 05:34, 22 March 2012 (UTC) 

我DKPro JWPL(其中還上面的例子來自),但這個框架純文本輸出試過不解析正確的方式維基對話頁(討論) 。它只是刪除以對於談話頁面至關重要的多個「:」字符開始的行。

回答

0

好吧,我發現從JWPL老維基百科解析器工作: 「de.tudarmstadt.ukp.wikipedia.parser」 link

你可以用它喜歡:

MediaWikiParserFactory pf = new MediaWikiParserFactory(Language.english); 
MediaWikiParser parser = pf.createParser(); 
ParsedPage pp = parser.parse("some wiki code with markups"); 
System.out.println(pp.getText());