def _get_name(key_tuple, annotated_tuples): CELL_PREFIX = '<td%s>' % ('' if annotated_tuples is None or key_tuple not in annotated_tuples else ' class="aname"') seq_name = unicode_data.get_emoji_sequence_name(key_tuple) if seq_name == None: if key_tuple == (0x20e3, ): seq_name = '(combining enlosing keycap)' elif key_tuple == (0xfe82b, ): seq_name = '(unknown flag PUA codepoint)' else: print 'no name for %s' % unicode_data.seq_to_string(key_tuple) seq_name = '(oops)' return CELL_PREFIX + seq_name
def _get_name(key_tuple, annotations): annotation = None if annotations is None else annotations.get(key_tuple) CELL_PREFIX = '<td%s>' % ( '' if annotation is None else ' class="%s"' % annotation) seq_name = unicode_data.get_emoji_sequence_name(key_tuple) if seq_name == None: if key_tuple == (0x20e3,): seq_name = '(combining enlosing keycap)' elif key_tuple == (0xfe82b,): seq_name = '(unknown flag PUA codepoint)' else: print('no name for %s' % unicode_data.seq_to_string(key_tuple)) seq_name = '(oops)' return CELL_PREFIX + seq_name
def _standard_name(seq): """Use the standard emoji name, with some algorithmic modifications. We want to ignore skin-tone modifiers (but of course if the sequence _is_ the skin-tone modifier itself we keep that). So we strip these so we can start with the generic name ignoring skin tone. Non-emoji that are turned into emoji using the emoji VS have '(emoji) ' prepended to them, so strip that. Regional indicator symbol names are a bit long, so shorten them. Regional sequences are assumed to be ok as-is in terms of capitalization and punctuation, so no modifications are applied to them. After title-casing we make some English articles/prepositions lower-case again. We also replace '&' with 'and'; Unicode seems rather fond of ampersand.""" if not unicode_data.is_skintone_modifier(seq[0]): seq = tuple( [cp for cp in seq if not unicode_data.is_skintone_modifier(cp)]) name = unicode_data.get_emoji_sequence_name(seq) if name.startswith('(emoji) '): name = name[8:] if len(seq) == 1 and unicode_data.is_regional_indicator(seq[0]): return 'Regional Symbol ' + unicode_data.regional_indicator_to_ascii( seq[0]) if (unicode_data.is_regional_indicator_seq(seq) or unicode_data.is_regional_tag_seq(seq)): return name name = name.title() # Require space delimiting just in case... name = re.sub(r'\s&\s', ' and ', name) name = re.sub( # not \b at start because we retain capital at start of phrase r'(\s(:?A|And|From|In|Of|With|For))\b', lambda s: s.group(1).lower(), name) return name
def _standard_name(seq): """Use the standard emoji name, with some algorithmic modifications. We want to ignore skin-tone modifiers (but of course if the sequence _is_ the skin-tone modifier itself we keep that). So we strip these so we can start with the generic name ignoring skin tone. Non-emoji that are turned into emoji using the emoji VS have '(emoji) ' prepended to them, so strip that. Regional indicator symbol names are a bit long, so shorten them. Regional sequences are assumed to be ok as-is in terms of capitalization and punctuation, so no modifications are applied to them. After title-casing we make some English articles/prepositions lower-case again. We also replace '&' with 'and'; Unicode seems rather fond of ampersand.""" if not unicode_data.is_skintone_modifier(seq[0]): seq = tuple([cp for cp in seq if not unicode_data.is_skintone_modifier(cp)]) name = unicode_data.get_emoji_sequence_name(seq) if name.startswith('(emoji) '): name = name[8:] if len(seq) == 1 and unicode_data.is_regional_indicator(seq[0]): return 'Regional Symbol ' + unicode_data.regional_indicator_to_ascii(seq[0]) if (unicode_data.is_regional_indicator_seq(seq) or unicode_data.is_regional_tag_seq(seq)): return name name = name.title() # Require space delimiting just in case... name = re.sub(r'\s&\s', ' and ', name) name = re.sub( # not \b at start because we retain capital at start of phrase r'(\s(:?A|And|From|In|Of|With|For))\b', lambda s: s.group(1).lower(), name) return name