The WikiParser package specifies a parser, which transforms an MediaWiki page source into an Abstract Syntax Tree (AST). All relevant classes are located in the namespace org.dbpedia.extraction.wikiparser.


Available Parsers

Currently, only one WikiParser implementation is available. It is returned by default by the WikiParser companion object.

Using the Parser

As WikiParser is a first-class function, it is very easy to use. New instances of it can be generated using the WikiParser companion object.

val parser = WikiParser()
val pageNode = parser(inputPage)

Implementing new Parsers

A new parser can be implemented by inheriting from WikiParser and implementing the def apply(page : WikiPage) : PageNode method. The apply method takes a wiki page and transforms it to an AST, from which it returns the root node. If an error occurs during parsing the page, throw a WikiParserException.
Note that all implementations must be thread-safe.