Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Compare feed enclosure length with content-length of file url.""" | |
import urllib.request | |
import xml.etree.ElementTree as etree | |
URL = 'https://feeds.feedburner.com/thebuglefeed?format=xml' | |
with urllib.request.urlopen(URL) as f: | |
tree = etree.parse(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""SQL-injection safe dynamic query with pl/pgsql.""" | |
import sqlalchemy as sa | |
UNIQUE_NULL = [('contributioncontributor', ['contribution_pk', 'contributor_pk'], []), | |
('contributionreference', ['contribution_pk', 'source_pk', 'description'], []), | |
('editor', ['dataset_pk', 'contributor_pk'], []), | |
('languageidentifier', ['language_pk', 'identifier_pk'], []), | |
('languagesource', ['language_pk', 'source_pk'], []), | |
('sentencereference', ['sentence_pk', 'source_pk', 'description'], []), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Longest common prefix.""" | |
import itertools | |
def common_prefix(left: str, right: str) -> str: | |
"""Return the case-insensitive longest common prefix of two strings. | |
>>> common_prefix('spam', 'spameggs') | |
'spam' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Combine https://glottolog.org/langdoc.csv parts.""" | |
import urllib.parse | |
import pandas as pd | |
ENDPOINT = urllib.parse.urlparse('https://glottolog.org/langdoc.csv') | |
QUERY = {'sEcho': 1, | |
'iSortingCols': 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Dump basic https://glottolog.org languoid info to CSV file.""" | |
import pandas as pd | |
ENGINE = 'postgresql://postgres@/glottolog3' | |
QUERY = ''' | |
SELECT | |
l.id AS glottocode, | |
l.name, |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Build RDF with rdflib and serialize in turtle format.""" | |
import rdflib | |
from rdflib.namespace import DCTERMS, RDF, RDFS, SKOS | |
GOLD = rdflib.Namespace('http://purl.org/linguistics/gold/') | |
LANGUOID = rdflib.Namespace('http://glottolog.org/resource/languoid/id/') | |
VOID = rdflib.Namespace('http://rdfs.org/ns/void#') |
OlderNewer