2 Demonstrates title normalization and parsing.
7 sys.path.insert(0, os.path.abspath(os.getcwd()))
9 from mw.api import Session
10 from mw.lib import title
13 title.normalize("foo bar")
16 # Construct a title parser from the API
17 api_session = Session("https://en.wikipedia.org/w/api.php")
18 parser = title.Parser.from_api(api_session)
20 # Handles normalization
21 parser.parse("user:epochFail")
24 # Handles namespace aliases
25 parser.parse("WT:foobar")