    def _lang_to_id(self, languages: str):
        """
        Build a map from languages to ids. These ids are used as segment labels
        for cross-lingual LM training.
        """
        lang2id = {}
        langs = [l.strip() for l in languages.split(",")]
        for id, lang in enumerate(langs):
            lang2id[lang] = id
        return lang2id
Build a map from languages to ids. These ids are used as segment labels
for cross-lingual LM training.
fairseq/tasks/cross_lingual_lm.py