MCPcopy Create free account
hub / github.com/ChinaGodMan/UserScripts / extract_chinese_texts

Function extract_chinese_texts

utils/google_translate.py:97–107  ·  view source on GitHub ↗
(lines)

Source from the content-addressed store, hash-verified

95
96#
97def extract_chinese_texts(lines):
98 chinese_pattern = re.compile(r'[\u4e00-\u9fff]+') # Matches Chinese characters
99 chinese_texts = []
100
101 for line_number, line in enumerate(lines):
102 if "<!--" in line:
103 continue
104 for match in chinese_pattern.finditer(line):
105 chinese_text = match.group()
106 chinese_texts.append((line_number, chinese_text))
107 return chinese_texts
108
109
110cache_manager = TranslationCaching()

Callers 2

translate_readmeFunction · 0.90
process_fileFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected