Open hagenw opened 3 years ago
It's not only description:
>>> db = audb.load('iemocap', versdion='2.2.0', only_metadata=True)
>>> db.schemes["dialog.act"]
description: Dialogue act annotations.Released by https://github.com/sahatulika15/EMOTyDA.Please
cite the respective paper whenever using it.
dtype: str
labels: {g: greeting, q: question, ans: answer, o: statement-opinion, s: statement-non-opinion,
ap: apology, ag: agreement, dag: disagreement, a: acknowledgement, b: backchanneling,
c: command, oth: other}
bibtex: "\n @inproceedings{saha-etal-2020-towards,\n \
\ title = \"Towards Emotion-aided Multi-modal Dialogue Act Classification\"\
,\n author = \"Saha, Tulika and\n Patra,\
\ Aditya and\n Saha, Sriparna and\n Bhattacharyya,\
\ Pushpak\",\n booktitle = \"Proceedings of the 58th Annual Meeting\
\ of the Association for Computational Linguistics\",\n month\
\ = jul,\n year = \"2020\",\n address = \"\
Online\",\n publisher = \"Association for Computational Linguistics\"\
,\n url = \"https://www.aclweb.org/anthology/2020.acl-main.402\"\
,\n doi = \"10.18653/v1/2020.acl-main.402\",\n \
\ pages = \"4361--4372\",\n }\n "
yaml
offers the option to modify the way scalars are presented, e.g.:
import audformat
bibtex = '@inproceedings{saha-etal-2020-towards,\n\
title = "Towards Emotion-aided Multi-modal Dialogue Act Classification"\n\
author = "Saha, Tulika and\n\
Patra, Aditya and\n\
Saha, Sriparna and\n\
Bhattacharyya, Pushpak"\n\
booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",\n\
month = jul,\n\
year = "2020",\n\
address = "Online",\n\
publisher = "Association for Computational Linguistics"\n\
url = "https://www.aclweb.org/anthology/2020.acl-main.402"\n\
doi = "10.18653/v1/2020.acl-main.402",\n\
pages = "4361--4372"'
db = audformat.testing.create_db(minimal=True)
db.schemes['scheme'] = audformat.Scheme(meta={'bibtex': bibtex})
print(db.schemes['scheme'])
{dtype: str, bibtex: "@inproceedings{saha-etal-2020-towards,\n title = \"Towards\
\ Emotion-aided Multi-modal Dialogue Act Classification\"\n author = \"Saha,\
\ Tulika and\n Patra, Aditya and\n Saha, Sriparna and\n Bhattacharyya,\
\ Pushpak\"\n booktitle = \"Proceedings of the 58th Annual Meeting of the Association\
\ for Computational Linguistics\",\n month = jul,\n year = \"2020\",\n \
\ address = \"Online\",\n publisher = \"Association for Computational Linguistics\"\
\n url = \"https://www.aclweb.org/anthology/2020.acl-main.402\"\n doi =\
\ \"10.18653/v1/2020.acl-main.402\",\n pages = \"4361--4372\""}
dtype: str
can be prettified to:
def str_presenter(dumper, data):
if len(data.splitlines()) > 1: # check for multiline string
return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
return dumper.represent_scalar('tag:yaml.org,2002:str', data)
yaml.add_representer(str, str_presenter)
print(db.schemes['scheme'])
bibtex: |-
@inproceedings{saha-etal-2020-towards,
title = "Towards Emotion-aided Multi-modal Dialogue Act Classification"
author = "Saha, Tulika and
Patra, Aditya and
Saha, Sriparna and
Bhattacharyya, Pushpak"
booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
month = jul,
year = "2020",
address = "Online",
publisher = "Association for Computational Linguistics"
url = "https://www.aclweb.org/anthology/2020.acl-main.402"
doi = "10.18653/v1/2020.acl-main.402",
pages = "4361--4372"
For some reason it did not work with the above example, though. But the formatting of the string looks also a bit odd.
This might indeed be a solution.
For audioset
it will not help as the description string does not contain \n
at the moment, but we could update it.
At the moment we get the following:
which is not very nice to read.
It get's even worse if you have some real formatting in the description string. For example, for
audioset
the description contains:which would be nice if we could preserve it when printing to screen.