Skip to content

Instantly share code, notes, and snippets.

@cd060
cd060 / text_to_en.py
Last active March 6, 2024 21:10
translates strings to english
import googletrans
from googletrans import *
def text_to_en(text):
translator = googletrans.Translator()
translation = translator.translate(text, dest='en')
return translation.text
@cd060
cd060 / getGNDidFromVIAF.py
Created March 6, 2024 09:54
takes a VIAF ID as argument and returns the link to GND dataset
import requests
import json
def get_gnd_from_viaf(viafid):
url = f'https://www.viaf.org/viaf/{viafid}/viaf.jsonld'
response = requests.get(url)
if response.status_code == 200:
data = response.json()