def _find_context_dependent_names(self):
        """Finds texts whose translation depends on context.

        Example.
          Here the word "Palacio" is translated from Spanish to English in
          multiple ways. Feed language is es (Spanish).

          trans_id,lang,translation
          stop-name-1,es,Palacio
          stop-name-1,en,Palace
          headsign-1,es,Palacio
          headsign-1,en,To Palace
        """
        n_occurences_of_original = {}
        for trans_id, translations in self.translations_map.items():
            try:
                original_name = translations[self.feed_language]
            except KeyError:
                raise Exception(
                    'No translation in feed language for %s, available: %s' %
                    (trans_id, translations))
            n_occurences_of_original[original_name] = (
                n_occurences_of_original.get(original_name, 0) +
                1)

        self.context_dependent_names = set(
            name
            for name, occur in n_occurences_of_original.items()
            if occur > 1)
        print('Total context-dependent translations: %d' %
              len(self.context_dependent_names))
def _find_context_dependent_names ( self ) : n_occurences_of_original = { } for trans_id , translations in self . translations_map . items ( ) : try : original_name = translations [ self . feed_language ] except KeyError : raise Exception ( 'No translation in feed language for %s, available: %s' % ( trans_id , translations ) ) n_occurences_of_original [ original_name ] = ( n_occurences_of_original . get ( original_name , 0 ) + 1 ) self . context_dependent_names = set ( name for name , occur in n_occurences_of_original . items ( ) if occur > 1 ) print ( 'Total context-dependent translations: %d' % len ( self . context_dependent_names ) )
Finds texts whose translation depends on context.

        Example.
          Here the word "Palacio" is translated from Spanish to English in
          multiple ways. Feed language is es (Spanish).

          trans_id,lang,translation
          stop-name-1,es,Palacio
          stop-name-1,en,Palace
          headsign-1,es,Palacio
          headsign-1,en,To Palace