MCPcopy Create free account
hub / github.com/917Dhj/DeepPaperNote / mixed_language_issues

Function mixed_language_issues

scripts/lint_note.py:508–535  ·  view source on GitHub ↗
(text: str)

Source from the content-addressed store, hash-verified

506
507
508def mixed_language_issues(text: str) -> list[dict[str, object]]:
509 issues: list[dict[str, object]] = []
510 lines = text.splitlines()
511 for idx, line in enumerate(lines, start=1):
512 if is_exempt_line(line):
513 continue
514 stripped = line.strip()
515 section_name = section_name_for_line(lines, idx - 1)
516 subsection_name = subsection_name_for_line(lines, idx - 1)
517 if section_name in {"核心信息", "引用"}:
518 continue
519 if not re.search(r"[\u4e00-\u9fff]", stripped):
520 continue
521 english_words = re.findall(r"\b[A-Za-z][A-Za-z0-9.-]*\b", stripped)
522 if len(english_words) < 4:
523 continue
524 function_hits = [word for word in english_words if word.lower() in ENGLISH_FUNCTION_WORDS]
525 if not function_hits and len(english_words) < 7:
526 continue
527 issues.append(
528 {
529 "line_number": idx,
530 "line": stripped,
531 "english_word_count": len(english_words),
532 "function_word_hits": function_hits[:6],
533 }
534 )
535 return issues
536
537
538def mechanical_translation_artifact_issues(text: str) -> list[dict[str, object]]:

Calls 3

is_exempt_lineFunction · 0.85
section_name_for_lineFunction · 0.85
subsection_name_for_lineFunction · 0.85