Fact Extraction from Wikipedia Text
The DBpedia Extraction Framework is pretty much mature when dealing with Wikipedia semi-structured content like infoboxes, links and categories.
However, unstructured content (typically text) plays the most crucial role, due to the amount of knowledge it can deliver, and few efforts have been carried out to extract structured data out of it.
For instance, given the Germany Football Team article, we want to extract a set of meaningful facts and structure them in machine-readable statements.
The following sentence:
In Euro 1992, Germany reached the final, but lost 0–2 to Denmark
would produce statements (triples) like:
<Germany, defeat, Denmark>
<defeat, score, 0–2>
<defeat, winner, Denmark>
<defeat, competition, Euro 1992>
INPUT = Wikipedia corpus
- Corpus Raw Text Extraction
- Verb Extraction
- Verb Ranking
- Entity Linking
- Frame Classification
- Dataset Production
- Training Set Creation
- Classifier Training
- Frame Classification
- Dataset Production
- Python, pip and Java should be there in your machine, aren't they?
- Install all the Python requirements:
$ pip install -r requirements.txt
- Install the third party dependencies:
- Request access to a supported entity linking API:
- Put your API credentials into a new file
lib/secrets.py
as follows:
# For The Wiki Machine
TWM_URL = 'your service URL'
TWM_APPID = 'your app ID'
TWM_APPKEY = 'your app key'
# For Dandelion API
NEX_URL = 'https://api.dandelion.eu/datatxt/nex/v1'
NEX_APPID = 'your app ID'
NEX_APPKEY = 'your app key'
Here is how to produce the unsupervised Italian soccer dataset:
$ wget http://dumps.wikimedia.org/itwiki/latest/itwiki-latest-pages-articles.xml.bz2
$ make extract-pages
$ make extract-soccer
$ make extract-sentences-baseline
$ make unsupervised-run
Done!
Wikipedia dumps are packaged as XML documents and contain text formatted according to the Mediawiki markup syntax, with templates to be transcluded. To obtain a raw text corpus, we use the WikiExtractor, integrated in a frozen version here.
Contributors should follow the standard team development practices:
- Branch out of master;
- Commit frequently with clear messages;
- Make a pull request.
Pull requests not complying to these guidelines will be ignored.
- Use 4 spaces (soft tab) for indentation;
- Naming conventions
- use an underscore as a word separator (files, variables, functions);
- constants are UPPERCASE;
- anything else is lowercase.
- Use 2 empty lines to separate functions;
- Write docstrings according to PEP 287, with a special attention to field lists. IDEs like PyCharm will do the job.
- FrameNet: A Knowledge Base for Natural Language Processing
- Outsourcing FrameNet to the Crowd
- Frame Semantics Annotation Made Easy with DBpedia
The source code is under the terms of the GNU General Public License, version 3.