poetree.Corpus
Class corresponding to a particular corpus.
Parameters
Parameter | Mandatory | Data type | Description |
lang | 1 | str | ISO code of the corpus. Values: 'cs', 'de', 'en', 'es', 'fr', 'hu', 'it', 'pt', 'ru' |
base_url | 0 | str | API base_url. Default: 'https://versologie.cz/poetree/api/' |
method :: get_authors
Get metadata of all available authors. Create a new Author instance for each author, store it in a list and return it.
Parameters
Parameter | Mandatory | Data type | Description |
country | 0 | str|list|set | Limit to authors from certain countries. Either a single value, e.g. 'pt' or list-like, e.g. ('pt,br'). |
born_after | 0 | int | Limit to authors born no sooner than a given year |
born_before | 0 | int | Limit to authors born no later than a given year |
died_after | 0 | int | Limit to authors that died no sooner than a given year |
died_before | 0 | int | Limit to authors that died no later than a given year |
Returns
Data type | Description |
list | List holding instances of Author |
method :: get_sources
Get metadata of all available sources. Create a new Source instance for each source, store it in a list and return it.
Parameters
Parameter | Mandatory | Data type | Description |
id_author | 0 | int | Limit to sources by author with this id(DB) |
wiki | 0 | str | Limit to sources by author with this wiki id |
viaf | 0 | str | Limit to sources by author with this VIAF id |
published_after | 0 | int | Limit to sources published no sooner than a given year |
published_before | 0 | int | Limit to sources published no later than a given year |
Returns
Data type | Description |
list | List holding instances of Source |
method :: metadata
Returns metadata of selected target as a list, pandas dataframe or prints out a stringified table. It may be sorted according to any metadata key.
Parameters
Parameter | Mandatory | Data type | Description |
target | 0 | str | Metadata of what to return. Values: 'authors', 'sources', 'self'. Default: 'self' |
output | 0 | str | Output format. Values: 'list', 'pandas', 'print'. Default: 'list' |
sortby | 0 | str | Subdict key according to which sort the list. Default: None |
reverse | 0 | bool | Sort in reversed (descending) order. Default False |
Returns
Data type | Description |
(list|pd.DataFrame|None) | metadata |