Giter Club home page Giter Club logo

awena-wikidata-crawler's Introduction

Awena is a Python3 Wikidata search library that parses the returned Data type results to a human-readable format

The library uses the Wikidata JSON Rest Api to fetch data instead of querying its Query Service. No knowledge of SPARQL is necessary to use this tool. You can just keep iterating through relevant item ids instead.

Awena lets you search for names, labels, etc. and use their ids to load their information from the knowledge graph:

import awena

query		= 'Einstein'
crawler		= awena.Crawler('en') # set language of labels and descriptions
qid		= crawler.search(query)	# will return "Q937"
info		= crawler.load(qid)
print(info)
	
>>> {
>>>	'label': 'Albert Einstein', 
>>>	'description': 'German-born physicist and founder of the theory of relativity', 
>>>	'sex': 'male', 
>>>	'citizen': 'Q43287', 
>>>	'father': 'Q88665', 
>>>	'mother': 'Q4357787', 
>>>	'number_of_siblings': 1, 
>>>	'number_of_children': 3, 
>>>	'occupation': 'Q19350898', 
>>>	'date_of_birth': '+1879-03-14T00:00:00Z', 
>>>	'place_of_birth': 'Q3012', 
>>>	'date_of_death': '+1955-04-18T00:00:00Z', 
>>>	'place_of_death': 'Q138518', 
>>>	'cause_of_death': 'Q616003'
>>> }

Some values are also valid ids (letter Q followed by numbers), which you can use the same way to receive information about them:

citizen_of	= crawler.load(info["citizen"])
print(citizen_of)

>>> {
>>>	'label': 'German Empire', 
>>>	'description': 'empire in Central Europe between 1871โ€“1918'
>>> }

Returned list of keys in dict depends on the information available on the topic.

awena-wikidata-crawler's People

Contributors

sedthh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

awena-wikidata-crawler's Issues

OSError: [Errno 101] Network is unreachable

I like your page that helps us to crawl on Wikidata but I got the issue as title.
Whether I should put some timeout parameter in request.get or the issue is caused by other reason.
Do you have any idea ? Thanks

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.