Reference data
Glottolog’s reference data consists of bibliographical information in a set of BibTeX files, described with metadata in BIBFILES.ini.
This information can be accessed via an instance of
pyglottolog.Glottolog
, too:
>>> Glottolog()
>>> print(g.bibfiles['hh'].description)
The bibliography of HH, typed in between 2005-2020.
It has been annotated by hand (type and language).
It contains descriptive material from all over the world, mostly lesser-known languages.
>>> print(g.bibfiles['hh:s:Karang:Tati-Harzani'])
@book{s:Karang:Tati-Harzani,
author = {'Abd-al-'Ali Kārang},
title = {Tāti va Harzani, do lahja az zabān-i bāstān-e Āẕarbāyjān},
publisher = {Tabriz: Tabriz University Press},
address = {Tabriz},
pages = {6+160},
year = {1334 [1953]},
glottolog_ref_id = {41999},
hhtype = {grammar_sketch},
inlg = {Farsi [pes]},
lgcode = {Tati, Harzani [hrz]},
macro_area = {Eurasia}
}
The objects representing reference data are described below.
- class pyglottolog.references.BibFiles(bibfiles)[source]
Ordered collection of BibFile objects accessible by filname or index.
- classmethod from_path(path, api=None)[source]
BibTeX files from <path>/bibtex/*.bib if listed in <path>/BIBFILES.ini.
- Parameters:
path (
typing.Union
[str
,pathlib.Path
]) –- Return type:
- __getitem__(index_or_filename)[source]
Retrieve a bibfile by index or filename or an entry by qualified key.
- Parameters:
index_or_filename (
typing.Union
[int
,str
]) – Either an int index, or a bibfile name, or a provider-qualified BibTeX key in the form <prov>:<key>.- Return type:
typing.Union
[pyglottolog.references.bibfiles.BibFile
,pyglottolog.references.bibfiles.Entry
]- Returns:
A BibFile instance, or an Entry instance.
- class pyglottolog.references.BibFile(fname, name=None, title=None, description=None, abbr=None, encoding='utf-8', normalize='NFC', sortkey=None, priority=0, url=None, curation=None, api=None)[source]
Represents a BibTeX file, storing a provider’s bibliography, providing easy access to its records.
- Parameters:
fname (
pathlib.Path
) –
Method generated by attrs for class BibFile.
- Parameters:
fname (
pathlib.Path
) –
- name
Short name of the bibliography
- title
Title of the bibliography
- description
The provenance of the bibliography
- url
URL pointing to the source of the bibliography
- curation
Curation policy for the bibliography at Glottolog
- class pyglottolog.references.Entry(key, type, fields, bib, api=None)[source]
Represents an entry in a BibFile, i.e. a bibliographical record.
Note
Entry instances are orderable. The ordering is the one used to compute MEDs, i.e.
grammars are “better” than other document types,
more pages is “better” than less,
more recent is “better” than old.
>>> g = pyglottolog.Glottolog() >>> g.bibfiles['hh:g:MacDonell:Sanskrit'] > g.bibfiles['hh:hv:Weijnen:Nederlandse'] True >>> refs = g.refs_by_languoid(gl.bibfiles['hh']) >>> sorted(refs[0]['stan1295'])[-1].med_type.name 'long grammar'
- Parameters:
fields (
dict
) –
Method generated by attrs for class Entry.
- Parameters:
fields (
dict
) –
- key
- type
BibTeX entry type
-
fields:
dict
The metadata of the record
- property med_type: MEDType
The entry’s type on the MED scale.
- property id: str
The qualified entry ID, including the provider prefix.