from mteb.abstasks.retrieval import AbsTaskRetrieval
from mteb.abstasks.task_metadata import TaskMetadata


class LASSA2TRetrieval(AbsTaskRetrieval):
    metadata = TaskMetadata(
        name="LASSA2TRetrieval",
        description=(
            "Language-Queried Audio Source Separation (LASS) dataset for audio-to-text retrieval. "
            "Retrieve text descriptions/captions for audio clips using natural language queries."
            "The original dataset is based on the AudioCaps dataset."
            "The source audio has been synthesized by mixing two audio with their labelled snr ratio as indicated in the dataset."
        ),
        reference="https://dcase.community/challenge2024/task-language-queried-audio-source-separation",
        dataset={
            "path": "mteb/lass-synth-a2t",
            "revision": "5d9ebcefcd94542a8e29038eb859f9c0f8cadcb5",
        },
        type="Any2AnyRetrieval",
        category="a2t",
        modalities=["text", "audio"],
        eval_splits=["test"],
        eval_langs=["eng-Latn"],
        main_score="hit_rate_at_5",
        date=("2024-03-27", "2024-03-27"),
        domains=["AudioScene"],
        task_subtypes=["Environment Sound Retrieval"],
        license="mit",
        annotations_creators="derived",
        dialect=[],
        sample_creation="found",
        bibtex_citation=r"""
@inproceedings{liu2022separate,
  author = {Liu, Xubo and Liu, Haohe and Kong, Qiuqiang and Mei, Xinhao and Zhao, Jinzheng and Huang, Qiushi and Plumbley, Mark D and Wang, Wenwu},
  booktitle = {INTERSPEEH},
  title = {Separate What You Describe: Language-Queried Audio Source Separation},
  year = {2022},
}
""",
    )


class LASST2ARetrieval(AbsTaskRetrieval):
    """Text-to-audio retrieval on LASS dataset."""

    metadata = TaskMetadata(
        name="LASST2ARetrieval",
        description=(
            "Language-Queried Audio Source Separation (LASS) dataset for text-to-audio retrieval. "
            "Retrieve audio clips corresponding to natural language text descriptions/captions."
            "The original dataset is based on the AudioCaps dataset."
            "The source audio has been synthesized by mixing two audio with their labelled snr ratio as indicated in the dataset."
        ),
        reference="https://dcase.community/challenge2024/task-language-queried-audio-source-separation",
        dataset={
            "path": "mteb/lass-synth-t2a",
            "revision": "407d9bb97b6a1990b38c02175f5dc6c2886f2796",
        },
        type="Any2AnyRetrieval",
        category="t2a",
        modalities=["text", "audio"],
        eval_splits=["test"],
        eval_langs=["eng-Latn"],
        main_score="hit_rate_at_5",
        date=("2024-03-27", "2024-03-27"),
        domains=["AudioScene"],
        task_subtypes=["Environment Sound Retrieval"],
        license="mit",
        annotations_creators="derived",
        dialect=[],
        sample_creation="found",
        bibtex_citation=r"""
@inproceedings{liu2022separate,
  author = {Liu, Xubo and Liu, Haohe and Kong, Qiuqiang and Mei, Xinhao and Zhao, Jinzheng and Huang, Qiushi and Plumbley, Mark D and Wang, Wenwu},
  booktitle = {INTERSPEEH},
  title = {Separate What You Describe: Language-Queried Audio Source Separation},
  year = {2022},
}
""",
    )
