sigilyph 0.0.1__py3-none-any.whl → 0.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of sigilyph might be problematic. Click here for more details.

sigilyph/__init__.py CHANGED
@@ -5,7 +5,10 @@ Author: Yixiang Chen
5
5
  version:
6
6
  Date: 2025-05-13 11:01:07
7
7
  LastEditors: Yixiang Chen
8
- LastEditTime: 2025-08-12 16:39:15
8
+ LastEditTime: 2025-08-12 17:49:48
9
9
  '''
10
10
 
11
- from sigilyph.core.sigilyph_class import Sigilyph
11
+ from sigilyph.core.sigilyph_class import Sigilyph
12
+
13
+ from sigilyph.core.symbols import all_phone_dict
14
+
Binary file
Binary file
@@ -5,7 +5,7 @@ Author: Yixiang Chen
5
5
  version:
6
6
  Date: 2025-03-31 17:50:26
7
7
  LastEditors: Yixiang Chen
8
- LastEditTime: 2025-08-12 15:42:55
8
+ LastEditTime: 2025-08-12 17:26:56
9
9
  '''
10
10
 
11
11
 
@@ -16,17 +16,25 @@ from sigilyph.core.symbols import punctuation, punc_map_ch
16
16
  from tn.chinese.normalizer import Normalizer as ZhNormalizer
17
17
  from tn.english.normalizer import Normalizer as EnNormalizer
18
18
 
19
+
20
+ import os
21
+ from importlib_resources import files
22
+ basedir = files('sigilyph')
23
+
19
24
  #zh_tn_model = ZhNormalizer(remove_erhua=False, full_to_half=False)
20
25
  #en_tn_model = EnNormalizer()
21
- zh_tn_model = ZhNormalizer(cache_dir='./sigilyph/core/cache_dir', remove_erhua=False, full_to_half=False)
22
- en_tn_model = EnNormalizer(cache_dir='./sigilyph/core/cache_dir')
26
+ #zh_tn_model = ZhNormalizer(cache_dir='./sigilyph/core/cache_dir', remove_erhua=False, full_to_half=False)
27
+ #en_tn_model = EnNormalizer(cache_dir='./sigilyph/core/cache_dir')
28
+ zh_tn_model = ZhNormalizer(cache_dir=os.path.join(basedir, 'core', 'cache_dir'), remove_erhua=False, full_to_half=False)
29
+ en_tn_model = EnNormalizer(cache_dir=os.path.join(basedir, 'core', 'cache_dir'))
23
30
 
24
31
  import json
25
32
  #import sys
26
33
  #sys.path.append('text_front')
27
34
  #with open('./special_dict.json', 'r', encoding="utf-8") as infi:
28
35
  #with open('./text_front/special_dict.json', 'r', encoding="utf-8") as infi:
29
- with open('./sigilyph/core/special_dict.json', 'r', encoding="utf-8") as infi:
36
+ #with open('./sigilyph/core/special_dict.json', 'r', encoding="utf-8") as infi:
37
+ with open(os.path.join(basedir, 'core', 'special_dict.json'), 'r', encoding="utf-8") as infi:
30
38
  special_dict = json.load(infi)
31
39
 
32
40
  def pro_norm(text, use_lang='zh'):
@@ -51,14 +59,14 @@ pre_replace_dict = {"AlphaFold-Plus": "AlphaFold Plus"}
51
59
  def preprocess_first_old(text, use_lang='zh'):
52
60
  text = replace_with_dict(text, pre_replace_dict)
53
61
  norm_text = pro_norm(text, use_lang)
54
- print(norm_text)
62
+ #print(norm_text)
55
63
  rep_text = replace_with_dict(norm_text, special_dict)
56
64
  return rep_text
57
65
 
58
66
  def preprocess_first(text, before_replace_dict, special_word_dict, norm_use_lang='zh'):
59
67
  text = replace_with_dict(text, before_replace_dict)
60
68
  norm_text = pro_norm(text, norm_use_lang)
61
- print(norm_text)
69
+ #print(norm_text)
62
70
  rep_text = replace_with_dict(norm_text, special_word_dict)
63
71
  return rep_text
64
72