Giter Site home page Giter Site logo

ub-mannheim / nfdi Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 2.0 1.7 MB

Basic info about NFDI consortia. Named entity linking for them. Support for Wikidata WikiProject NFDI.

Home Page: https://ub-mannheim.github.io/NFDI

License: MIT License

Python 100.00%
nfdi nfdi4culture nfdi4plants berd-nfdi

nfdi's Introduction

NFDI

PyPI version Jupyter Book Badge

The Python library NFDI provides:

  • basic information about NFDI (also known as Nationale ForschungsDatenInfrastruktur and National Research Data Infrastructure) and all funded NFDI consortia,
  • support for Wikidata WikiProject NFDI aimed to create and edit the Wikidata entities and entity schemas relevant for NFDI,
  • simple named entity linker on texts for the accepted NFDI consortia.

The NFDI Jupyter Book describes:

Table of contents

Installation

pip install NFDI

How to use

Module info

[docs module info]

The module info has classes consortium and consortia:

from nfdi import info
nfdi = info.consortia()
berd = info.consortium('BERD@NFDI')

The instance nfdi has the following attributes: 'label', 'homepage', 'wikidata', 'github', 'google', 'linkedin', 'twitter', 'youtube', 'zenodo', 'labels', 'consortia'. For example:

nfdi.twitter

prints

"https://twitter.com/NFDI_de"

The instances nfdi and berd have the methods print, dict and _wikidata:

json = berd._wikidata()
nfdi.print()

The json variable contains JSON representation of the corresponding entity at Wikidata including labels, aliases and descriptions:

print('LABELS', json.get('labels'))
print('DESCRIPTIONS', json.get('descriptions'))
print('ALIASES', json.get('aliases'))

It prints:

LABELS {'en': {'language': 'en', 'value': 'BERD@NFDI'}, 'de': {'language': 'de', 'value': 'BERD@NFDI'}, 'fr': {'language': 'fr', 'value': 'BERD@NFDI'}, 'bar': {'language': 'bar', 'value': 'BERD@NFDI'}, 'de-at': {'language': 'de-at', 'value': 'BERD@NFDI'}, 'de-ch': {'language': 'de-ch', 'value': 'BERD@NFDI'}, 'de-formal': {'language': 'de-formal', 'value': 'BERD@NFDI'}, 'en-ca': {'language': 'en-ca', 'value': 'BERD@NFDI'}, 'en-gb': {'language': 'en-gb', 'value': 'BERD@NFDI'}, 'es': {'language': 'es', 'value': 'BERD@NFDI'}, 'nl': {'language': 'nl', 'value': 'BERD@NFDI'}, 'pt': {'language': 'pt', 'value': 'BERD@NFDI'}, 'simple': {'language': 'simple', 'value': 'BERD@NFDI'}}
DESCRIPTIONS {'en': {'language': 'en', 'value': 'NFDI consortium for Business, Economic and Related Data (Social and Behavioural Sciences)'}, 'de': {'language': 'de', 'value': 'NFDI für Wirtschaftsdaten und Verwandtes (Sozial- und Verhaltenswissenschaften)'}}
ALIASES {'en': [{'language': 'en', 'value': 'BERD-NFDI'}], 'de': [{'language': 'de', 'value': 'BERD-NFDI'}], 'fr': [{'language': 'fr', 'value': 'BERD-NFDI'}], 'bar': [{'language': 'bar', 'value': 'BERD-NFDI'}], 'de-at': [{'language': 'de-at', 'value': 'BERD-NFDI'}], 'de-ch': [{'language': 'de-ch', 'value': 'BERD-NFDI'}], 'de-formal': [{'language': 'de-formal', 'value': 'BERD-NFDI'}], 'en-ca': [{'language': 'en-ca', 'value': 'BERD-NFDI'}], 'en-gb': [{'language': 'en-gb', 'value': 'BERD-NFDI'}], 'es': [{'language': 'es', 'value': 'BERD-NFDI'}], 'nl': [{'language': 'nl', 'value': 'BERD-NFDI'}], 'pt': [{'language': 'pt', 'value': 'BERD-NFDI'}], 'simple': [{'language': 'simple', 'value': 'BERD-NFDI'}]}

Module data

[docs module data]

The module data has raw data as a dictionary:

from nfdi import data
data.raw()

Module nel

[docs module nel]

The module nel provides simple rule-based named entity linker for the NFDI consortia. In Jupyter Notebook use

from nfdi.nel import linker, test
t = linker(test)
t.render()

where test stores the following sentences:

What are BERD@NFDI, NFDI4Earth, NFDI4DataScience, NFDI-MatWerk, PUNCH4NFDI, FAIRmat and Text+?
How are they related to NFDI4Ing, NFDI4Culture, NFDI4Chem and NFDIGHGA?

In Python console use:

from nfdi.nel import linker, test
t = linker(test)
t.serve()

The Wikidata QIDs are stored in .ent_id_:

from nfdi.nel import linker, test
t = linker(test)
for span in t.doc.ents:
    print((span.text, span.ent_id_, span.label_))

It prints:

('BERD@NFDI', 'Q108542181', 'ORG')
('NFDI4Earth', 'Q108542504', 'ORG')
('NFDI4DataScience', 'Q108542422', 'ORG')
('NFDI-MatWerk', 'Q108542607', 'ORG')
('PUNCH4NFDI', 'Q108542637', 'ORG')
('FAIRmat', 'Q108542373', 'ORG')
('Text+', 'Q98271443', 'ORG')
('NFDI4Ing', 'Q98380344', 'ORG')
('NFDI4Culture', 'Q98276929', 'ORG')
('NFDI4Chem', 'Q96678459', 'ORG')
('NFDIGHGA', 'Q98380337', 'ORG')

NFDI Jupyter Book

Check out NFDI Jupyter Book.

Deploying the Book locally

First, create and activate conda environment using the provided docs/environment.yml:

conda env create -f docs/environment.yml
conda activate nfdi

Then, build the Book:

jb build docs

Open the file docs/_build/html/index.html in a browser.

To remove the build folder, run:

jb clean --all docs

Deploying the Book at GitHub

Install ghp-import:

pip install ghp-import

Once the book is built, run:

ghp-import -n -p -f docs/_build/html

nfdi's People

Contributors

shigapov avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

jkamlah ludee

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.