【问题标题】:Simple Wikipedia Text into Plain Text Parser?将简单的维基百科文本转换为纯文本解析器?
【发布时间】:2017-03-16 13:18:14
【问题描述】:

我正在寻找一个简单的解析器,它可以将带有 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(上面的示例也来自此),但该框架纯文本输出无法以正确的方式解析 wiki 讨论页面(讨论)。它只是删除以许多“:”字符开头的行,这些字符对于讨论页至关重要。

【问题讨论】:

    标签: parsing text wiki markup


    【解决方案1】:

    好的,我发现 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());
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-22
      • 2011-05-26
      • 2010-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多