def add_languages(self, id_factory=lambda d: d['ID']):
        """
        Add languages as specified in a dataset's etc/languages.csv

        :param id_factory: A callable taking a dict describing a language as argument and returning\
        a value to be used as ID for the language.
        :return: The set of language IDs which have been added.
        """
        ids = set()
        for kw in self.dataset.languages:
            if (not kw.get('Glottocode')) and kw.get('ISO639P3code'):
                kw['Glottocode'] = self.dataset.glottolog.glottocode_by_iso.get(kw['ISO639P3code'])
            kw['ID'] = id_factory(kw)
            ids.add(kw['ID'])
            self.add_language(**kw)
        return ids
def add_languages ( self , id_factory = lambda d : d [ 'ID' ] ) : ids = set ( ) for kw in self . dataset . languages : if ( not kw . get ( 'Glottocode' ) ) and kw . get ( 'ISO639P3code' ) : kw [ 'Glottocode' ] = self . dataset . glottolog . glottocode_by_iso . get ( kw [ 'ISO639P3code' ] ) kw [ 'ID' ] = id_factory ( kw ) ids . add ( kw [ 'ID' ] ) self . add_language ( ** kw ) return ids
Add languages as specified in a dataset's etc/languages.csv

        :param id_factory: A callable taking a dict describing a language as argument and returning\
        a value to be used as ID for the language.
        :return: The set of language IDs which have been added.