Files
init_dataParser/app/monir/mapping_char.py
T
2025-12-06 12:03:01 +03:30

459 lines
5.3 KiB
Python
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from idataparser import InitTextNormalizer, DataHelper, save_orjson, load_orjson
normalizer = InitTextNormalizer(
options={
"alphabetsNormal": True,
"emptylinesNormal": True,
"hamzehNormal": True,
"removeInvalidChar": True,
}
)
mapping_sanad = {
"„",
"",
" ",
"¢",
"£",
"¤",
"¨",
"¬",
"­",
"°",
"´",
"·",
"¼",
"½",
"¾",
"Ã",
"É",
"Í",
"Ï",
"×",
"Û",
"à",
"á",
"ã",
"ä",
"ç",
"è",
"é",
"ê",
"í",
"ï",
"ñ",
"ó",
"õ",
"ö",
"÷",
"ø",
"ú",
"ü",
"þ",
"ÿ",
"ā",
"Ă",
"Ĉ",
"Ĥ",
"Ŋ",
"ˆ",
"ˇ",
"˜",
"΄",
"μ",
"π",
"Щ",
"؀",
"،",
"؛",
"؟",
"ء",
"آ",
"أ",
"ؤ",
"إ",
"ئ",
"ا",
"ب",
"ة",
"ت",
"ث",
"ج",
"ح",
"خ",
"د",
"ذ",
"ر",
"ز",
"س",
"ش",
"ص",
"ض",
"ط",
"ظ",
"ع",
"غ",
"ـ",
"ف",
"ق",
"ك",
"ل",
"م",
"ن",
"ه",
"و",
"ى",
"ي",
"ً",
"ٌ",
"ٍ",
"َ",
"ُ",
"ِ",
"ّ",
"ْ",
"ٓ",
"ٔ",
"ٖ",
"ٞ",
"٠",
"١",
"٢",
"٣",
"٤",
"٥",
"٨",
"٩",
"٪",
"٬",
"٭",
"ٰ",
"ٱ",
"ٲ",
"ٶ",
"پ",
"چ",
"ژ",
"ک",
"گ",
"ۀ",
"ۃ",
"ی",
"ۖ",
"ۗ",
"ۚ",
"ۡ",
"ۥ",
"ۭ",
"۰",
"۱",
"۲",
"۳",
"۴",
"۵",
"۶",
"۷",
"۸",
"۹",
"ࠤ",
"࠮",
"ࡸ",
"ࢆ",
"ࢲ",
"ࢴ",
"ࣨ",
"ࣴ",
"ࣾ",
"ऀ",
"ऌ",
"ऎ",
"ऐ",
"द",
"ऴ",
"ू",
"ॄ",
"ॆ",
"ग़",
"ड़",
"চ",
"জ",
"৤",
"০",
"৪",
"৮",
"ਢ",
"ਤ",
"ੋ",
"੒",
"ੜ",
"ઈ",
"଀",
"଎",
"஘",
"௚",
"ా",
"౔",
"ೂ",
"ඊ",
"ฃ",
"ด",
"ฮ",
"โ",
"ไ",
"๒",
"ༀ",
"ᆖ",
"ᆘ",
"ᆦ",
"ᐨ",
"ᑪ",
"ᒂ",
"ᒶ",
"ᔟ",
"ᔢ",
"ᔧ",
"ᔪ",
"ᘀ",
"ᘂ",
"ᨾ",
"ᰀ",
"᱊",
"Ḩ",
"ḭ",
"Ḿ",
"Ṏ",
"Ἂ",
"Ῥ",
" ",
"‌",
"‍",
"‎",
"‏",
"‑",
"–",
"—",
"‘",
"’",
"‚",
"“",
"”",
"•",
"…",
"‪",
"‬",
"″",
"‹",
"›",
"⁋",
"",
"™",
"↓",
"−",
"≥",
"⍤",
"␂",
"␃",
"⒢",
"◮",
"⚚",
"⚜",
"⛾",
"⡯",
"⤦",
"⤨",
"ⱆ",
"ⱶ",
"ま",
"㈬",
"㈮",
"㈺",
"㈼",
"㛸",
"㝶",
"㩴",
"㪐",
"㵹",
"㸐",
"㸒",
"䂨",
"䌀",
"䐀",
"䑶",
"䑸",
"䗜",
"䠨",
"䡟",
"䢪",
"䩞",
"䩡",
"䭨",
"䭪",
"䳸",
"䴮",
"䴰",
"伀",
"偦",
"偨",
"儀",
"凄",
"刐",
"刚",
"唃",
"唎",
"唢",
"唤",
"喈",
"喡",
"娀",
"宜",
"屨",
"恨",
"惄",
"愀",
"愔",
"掋",
"摧",
"撆",
"桨",
"汊",
"汌",
"淄",
"皆",
"稀",
"笺",
"筠",
"筨",
"箜",
"篃",
"絘",
"脈",
"茊",
"茌",
"菈",
"蕞",
"蚞",
"譨",
"軺",
"輒",
"輔",
"辜",
"酠",
"鉦",
"鉼",
"鉾",
"銨",
"镖",
"闎",
"餸",
"馼",
"髄",
"魰",
"鶊",
"ꅨ",
"ꉣ",
"ꍀ",
"ꡨ",
"꡻",
"ꢆ",
"ꢘ",
"꣜",
"넣",
"뫜",
"뺨",
"뻪",
"쌀",
"쫮",
"쵕",
"케",
"퓪",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"﴾",
"﴿",
"ﺓ",
"ﺔ",
"ﻫ",
"ﻻ",
"�",
}
# --- تست ---
text = "".join(sorted(mapping_sanad)) # مرتب‌سازی برای قابلیت خواندن
new_text = normalizer.normalize_text_monir(text)
remaining_chars = set(new_text)
removed_chars = mapping_sanad - remaining_chars
print(f"Input Char {len(mapping_sanad)}")
print(f"Now Char{len(remaining_chars)}")
print(f"Remove Char {len(removed_chars)}")
save_orjson(
path=r"D:\init_mahdi\project\dataParsers\idataparser\task\monir\informations\temp_char_test_normalization.json",
data=sorted(list(remaining_chars)),
)
unvalid_string = {
" ",
"&shy",
"",
"",
}
# python -m idataparser.task.monir.mapping_char
unvalid_id = {
"pm146812",
"pm146821",
"",
}