metadata.py
591 Bytes
'Retrieve metadata'
def metadata(pars):
'Create a dictionary with metadata based on paragraph content'
data = {
'title': 'Tytuł',
'termNo': '5',
'session': '3',
'day': '5',
'date': '2020-12-12',
'type': 'session',
'file_id': 'xxxx',
'house': _house(pars)
}
return data
def _house(pars):
for utter in pars[0:10]:
if utter.who != 'komentarz':
continue
if 'Senat' in utter.u:
return 'Senat'
if 'Sejm' in utter.u:
return 'Sejm'
return 'Sejm'