Giter Club home page Giter Club logo

diegosiqueir4 / multilingual-wiki-event-pipeline Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cltl/multilingual-wiki-event-pipeline

0.0 1.0 0.0 84.09 MB

This project aims to extract information about incidents of a particular type. This information consists of structured data on the incidents from Wikidata, as well as unstructured description and supporting sources from Wikipedia. We obtain information from Wikipedia in multiple languages.

License: Apache License 2.0

Python 99.61% Shell 0.39%

multilingual-wiki-event-pipeline's Introduction

multilingual-wiki-event-pipeline

This project aims to extract information about incidents of a particular type. This information consists of structured data on the incidents from Wikidata, as well as unstructured description and supporting sources from Wikipedia. We obtain information from Wikipedia in multiple languages (currently tested with Dutch, Italian, and Japanese).

Authors

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details

Setup

Python modules (Python 3.7 is used)

A number of external modules need to be installed, which are listed in requirements.txt. Depending on how you installed Python, you can probably install the requirements using one of following commands:

pip install -r requirements.txt

Resources

A number of resources need to be downloaded. This can be done calling:

bash install.sh

Code documentation

Extraction steps

All extraction code can be found in the file main.py:

  1. Get Wikidata incident IDs for an event type, like 'election' or 'murder'
  2. Obtain time, location, and other predefined properties from Wikidata
  3. Obtain incident name in at least one of a predefined set of languages
  4. For each language, get Wikipedia text based on the incident name in that language, or by using the wikipedia link
  5. Make a selection for a pilot data based on quality criteria
  6. For each wikipedia article, get sources/reference texts from Wikipedia
  7. Process each document with SpaCy
  8. Enrich with entity links, based on Wikipedia hyperlinks
  9. Store to NAF
  10. Serialize to RDF

The final result is a processed incident collection for a set of languages and an incident type, stored in multiple ways:

  • a pickle file in the bin/ folder, containing the incident collection as a python class
  • a number of NAF files in the wiki_output folder, containing both raw text and NLP layers
  • an RDF Turtle (.ttl) representation of the extracted incidents and documents, in bin/rdf

The script analyze.py produces statistics of such incident collections.

The settings for the experiment are stored centrally in the file config.py. In theory, adding a new language and/or event type requires simply a change in the config.

The processing relies on the following utility files:

  • native_api_utils.py for querying information from the Wikipedia API
  • pilot_utils.py contains functions that select, process, enrich, and store the pilot data to NAF.
  • wikipedia_utils.py has functions for loading of information from a preprocessed local Wikipedia dump.
  • xml_utils.py has functions for working with XML files.

In addition, we make use of the Spacy-to-NAF functionalities.

Statistics

Elections

...

Murders

...

Modeling

The modeling in the .ttl file is based on the SEM model. Here is an excerpt of the resulting graph:

Alt text

Helpful links

multilingual-wiki-event-pipeline's People

Contributors

filievski avatar martenpostma avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.