Return a dictionary describing character ``char``.
9194
def character_copy(self, char):
        """"""
        ret = self.character_stat_copy(char)
        chara = self._real.character[char]
        nv = self.character_nodes_stat_copy(char)
        if nv:
            ret['node_val'] = nv
        ev = self.character_portals_stat_copy(char)
        if ev:
            ret['edge_val'] = ev
        avs = self.character_avatars_copy(char)
        if avs:
            ret['avatars'] = avs
        rbs = self.character_rulebooks_copy(char)
        if rbs:
            ret['rulebooks'] = rbs
        nrbs = self.character_nodes_rulebooks_copy(char)
        if nrbs:
            for node, rb in nrbs.items():
                assert node in chara.node
                if 'node_val' not in ret:
                    ret['node_val'] = {}
                nv = ret['node_val']
                if node not in nv:
                    nv[node] = {}
                nv[node]['rulebook'] = rb
        porbs = self.character_portals_rulebooks_copy(char)
        if porbs:
            for orig, dests in porbs.items():
                ports = chara.portal[orig]
                for dest, rb in dests.items():
                    assert dest in ports
                    if 'edge_val' not in ret:
                        ret['edge_val'] = {}
                    ev = ret['edge_val']
                    if orig not in ev:
                        ev[orig] = {}
                    ov = ev[orig]
                    if dest not in ov:
                        ov[dest] = {}
                    ov[dest]['rulebook'] = rb
        return ret
1209776
def CharacterData(self, data):
        '''
        
        '''

        if data.strip():
            data = data.encode()
            if not self.data:
                self.data = data
            else:
                self.data += data
265874
def strtype(self):
        """"""
        if self.kind is not None:
            return "{}({})".format(self.dtype, self.kind)
        else:
            return self.dtype
546394
def characters(self):
        
        chars = 0
        for fragment in self.fragments:
            chars += fragment.characters
        return chars
881910
def select_regexp_char(char):
    
    regexp = '{}'.format(char)

    if not isinstance(char, str) and not isinstance(char, int):
        regexp = ''

    if isinstance(char, str) and not char.isalpha() and not char.isdigit():
        regexp = r"\{}".format(char)

    return regexp
426842
def nth_char(char_map, index):
    """"""
    for char in char_map:
        if index < char_map[char]:
            return char
        index = index - char_map[char]
    return None
1062138
def chars2str(chars) -> List[str]:
    
    strings = collections.deque()
    for subchars in chars:
        substrings = collections.deque()
        for char in subchars:
            if char:
                substrings.append(char.decode('utf-8'))
            else:
                substrings.append('')
        strings.append(''.join(substrings))
    return list(strings)
1300633
def charindex(self, line, column):
        """"""
        #Make sure that we have chars and lines to work from if this
        #gets called before linenum() does.
        if len(self._lines) == 0:
            self.linenum(1)

        if line < len(self._chars):
            return self._chars[line - 1] + column
        else:
            return len(self.refstring)
997646
def text_to_char_array(original, alphabet):
    
    """
    return np.asarray([alphabet.label_from_string(c) for c in original])
225057
def encode_character(char):
    
    if char == '!': return '%21'
    elif char == '"': return '%22'
    elif char == '#': return '%23'
    elif char == '$': return '%24'
    elif char == '%': return '%25'
    elif char == '&': return '%26'
    elif char == '\'': return '%27'
    elif char == '(': return '%28'
    elif char == ')': return '%29'
    elif char == '*': return '%2A'
    elif char == '+': return '%2B'
    elif char == ',': return '%2C'
    elif char == '-': return '%2D'
    elif char == '.': return '%2E'
    elif char == '/': return '%2F'
    elif char == ':': return '%3A'
    elif char == ';': return '%3B'
    elif char == '<': return '%3C'
    elif char == '=': return '%3D'
    elif char == '>': return '%3E'
    elif char == '?': return '%3F'
    elif char == '@': return '%40'
    elif char == '[': return '%5B'
    elif char == '\\': return '%5C'
    elif char == ']': return '%5D'
    elif char == '^': return '%5E'
    elif char == '_': return '%5F'
    elif char == '`': return '%60'
    elif char == '{': return '%7B'
    elif char == '|': return '%7C'
    elif char == '}': return '%7D'
    elif char == '~': return '%7E'
    elif char == ' ': return '%7F'
    else: return char
519126
def _get_dict_char_count(txt):
	
	dct = {}
	for letter in txt:
		if letter in dct:
			dct[letter] += 1
		else:
			dct[letter] = 1
	return dct
1058906
def _get_token_type(self, char):
        
        if char in '()':
            return self.SPLIT, 0
        elif char == ',':
            return self.SPLIT, 1
        elif char in '<>':
            return self.IGNORE, 2
        elif char == '.':
            return self.JOIN, 3
        elif char.isdigit():
            return self.JOIN, 4
        elif char.isalpha():
            return self.JOIN, 5
        elif char == '^':
            return self.JOIN, 6
        elif char.isspace():
            return self.IGNORE, 7
        else:
            raise ValueError('TokeniserException: "{}" can not be tokenised'.format(char))
1250121
def build_char_states(self, char_embed, is_training, reuse, char_ids, char_lengths):
        """"""
        max_char_length = self.cfg.max_char_length

        inputs = dropout(tf.nn.embedding_lookup(char_embed, char_ids),
                         self.cfg.dropout, is_training)
        inputs = tf.reshape(
            inputs, shape=[max_char_length, -1, self.cfg.char_embed_dim])
        char_lengths = tf.reshape(char_lengths, shape=[-1])
        with tf.variable_scope('char_encoding', reuse=reuse):
            cell_fw = XGRUCell(hidden_dim=self.cfg.char_embed_dim)
            cell_bw = XGRUCell(hidden_dim=self.cfg.char_embed_dim)
            _, (left_right, right_left) = tf.nn.bidirectional_dynamic_rnn(
                cell_fw=cell_fw,
                cell_bw=cell_bw,
                sequence_length=char_lengths,
                inputs=inputs,
                time_major=True,
                dtype=tf.float32
            )

        left_right = tf.reshape(left_right, shape=[-1, self.cfg.char_embed_dim])

        right_left = tf.reshape(right_left, shape=[-1, self.cfg.char_embed_dim])

        states = tf.concat([left_right, right_left], axis=1)
        out_shape = tf.shape(char_ids)[1:3]
        out_shape = tf.concat([out_shape, tf.constant(
            value=[self.cfg.char_embed_dim * 2], dtype=tf.int32)], axis=0)
        return tf.reshape(states, shape=out_shape)
414471
def lookup_character_keycode(self, character):
        
        keysym = self.string_to_keysym.get(character, 0)
        if keysym == 0:
            keysym = self.string_to_keysym.get(KEYSYMS[character], 0)
        return self.display.keysym_to_keycode(keysym)
952846
def char(i):
    

    i = ord(i)
    if i not in font:
        return [(0,)] * 8
    return [(ord(row),) for row in font[i].decode('hex')]
750603
def asDict(self):
        """"""
        return {
            'isError': self.isError,
            'message': self.message,
            'values': self.values,
            'value': self.value,
        }
233752
def _build_control_char_mapping():
    
    control_chars = {}

    for i in itertools.chain(
            range(0x00, 0x09),
            [0x0b],
            range(0x0e, 0x20),
            [0x7f],
            range(0x206a, 0x2070),
            [0xfeff],
            range(0xfff9, 0xfffd),
            range(0x1d173, 0x1d17b),
            range(0xe0000, 0xe0080)
    ):
        control_chars[i] = None

    return control_chars