Python package to reconcile GND, GeoNames IDs via WikiData
Project description
acdh-id-reconciler
python package to reconcile GND and GeoNames IDs via WikiData.
install
pip install acdh-id-reconciler
use
from GND to WikiData and GeoNames ID
from acdh_id_reconciler import gnd_to_geonames
test = "https://d-nb.info/gnd/4010858-2"
results = gnd_to_geonames(test)
print(results)
# {'wikidata': 'http://www.wikidata.org/entity/Q261664', 'gnd': '4010858-2', 'geonames': '2781124'}
from GND to WikiData
from acdh_id_reconciler import gnd_to_wikidata
test = "https://d-nb.info/gnd/4074255-6"
results = gnd_to_wikidata(test)
print(results)
# {'wikidata': 'http://www.wikidata.org/entity/Q41329', 'gnd': '4074255-6'}
from GND to WikiData plus Custom-ID
from acdh_id_reconciler import gnd_to_wikidata_custom
test = "https://d-nb.info/gnd/118566512"
custom = "P21" # https://www.wikidata.org/wiki/Property:P6194
results = gnd_to_wikidata_custom(test, custom)
print(results)
# {'wikidata': 'http://www.wikidata.org/entity/Q44517', 'gnd': '118566512', 'custom': 'http://www.wikidata.org/entity/Q6581097'}
from Geonames to WikiData
from acdh_id_reconciler import geonames_to_wikidata
test = "https://www.geonames.org/2761369"
results = geonames_to_wikidata(test)
print(results)
# {'wikidata': 'http://www.wikidata.org/entity/Q1741', 'geonames': '2761369'}
from Geonames to GND
from acdh_id_reconciler import geonames_to_gnd
test = "https://www.geonames.org/2761369"
results = geonames_to_gnd(test)
print(results)
# {'wikidata': 'http://www.wikidata.org/entity/Q1741', 'geonames': '2761369', 'gnd': '4066009-6'}
from Wikidata to Wikipedia
from acdh_id_reconciler import wikidata_to_wikipedia
test = "https://www.wikidata.org/wiki/Q1186567/"
result = wikidata_to_wikipedia(test)
print(result)
# 'https://de.wikipedia.org/wiki/Alexandrinski-Theater'
# default language is set to german, can be changed by settings param result e.g. `wiki_lang='enwiki'`
result = wikidata_to_wikipedia(test, wiki_lang='enwiki')
print(result)
# 'https://en.wikipedia.org/wiki/Alexandrinsky_Theatre'
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
acdh_id_reconciler-0.7.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for acdh_id_reconciler-0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11614427c4c39eff37851d4f5f1a7cefe4aa7f009620fe73f6cff76d7fff94e2 |
|
MD5 | 5df407a89f752b6dec3d96d2abd5cdc3 |
|
BLAKE2b-256 | 79f05c7fd6acd5bce79112a04a080c85b25ec25cb856f5ad6481d853e204d7b5 |