poetree.Source
Class corresponding to a particular source. *One of id_ / id_poem parameters needs to be set.
Parameters
Parameter | Mandatory | Data type | Description |
lang | 1 | str | ISO code of the corpus. Values: 'cs', 'de', 'en', 'es', 'fr', 'hu', 'it', 'pt', 'ru' |
id_ | 0 | int | Id(DB) if the source |
id_poem | 0 | int | Id(DB) of the poem its source is to be found |
base_url | 0 | str | API base_url. Default: 'https://versologie.cz/poetree/api/' |
method :: get_poems
Get metadata of poems in the source. Create a new Poem instance for each poem, store it in a list and return it.
Returns
Data type | Description |
list | List holding instances of Poem |
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: 'poems', '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 |