File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5050 "」" : "U+FF63" , # HALFWIDTH RIGHT CORNER BRACKET
5151}
5252
53- _TRANSLATION_TABLE = {}
53+ _TRANSLATION_TABLE = str .maketrans (
54+ {chr (int (v .replace ("U+" , "" ), 16 )): '"' for v in _DOUBLE_QUOTES .values ()}
55+ | {chr (int (v .replace ("U+" , "" ), 16 )): "'" for v in _SINGLE_QUOTES .values ()}
56+ )
5457
5558
5659def calculate_accuracy (
@@ -223,23 +226,3 @@ def standardize_quotes(text: str) -> str:
223226 return text .translate (_TRANSLATION_TABLE )
224227
225228
226- def unicode_to_char (unicode_val : str ) -> str :
227- """
228- Converts a Unicode value to a character.
229-
230- Args:
231- unicode_val (str): The Unicode value to convert.
232-
233- Returns:
234- str: The character corresponding to the Unicode value.
235- """
236- return chr (int (unicode_val .replace ("U+" , "" ), 16 ))
237-
238-
239- for unicode_val in _DOUBLE_QUOTES .values ():
240- char_code = int (unicode_val .replace ("U+" , "" ), 16 )
241- _TRANSLATION_TABLE [char_code ] = ord ('"' )
242-
243- for unicode_val in _SINGLE_QUOTES .values ():
244- char_code = int (unicode_val .replace ("U+" , "" ), 16 )
245- _TRANSLATION_TABLE [char_code ] = ord ("'" )
You can’t perform that action at this time.
0 commit comments