Update mecab_patch.py
Browse files- mecab_patch.py +11 -6
mecab_patch.py
CHANGED
|
@@ -1,12 +1,17 @@
|
|
| 1 |
import sys
|
| 2 |
-
|
| 3 |
-
# Monkey patch melo.text.cleaner to skip Japanese
|
| 4 |
-
import melo.text
|
| 5 |
import types
|
| 6 |
|
| 7 |
-
# Create a dummy module
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# Then import cleaner safely
|
| 12 |
from melo.text import cleaner # this will now skip Japanese logic
|
|
|
|
| 1 |
import sys
|
|
|
|
|
|
|
|
|
|
| 2 |
import types
|
| 3 |
|
| 4 |
+
# Create a dummy japanese module
|
| 5 |
+
japanese_patch = types.ModuleType("japanese")
|
| 6 |
+
|
| 7 |
+
# Add a no-op placeholder for distribute_phone
|
| 8 |
+
def distribute_phone(*args, **kwargs):
|
| 9 |
+
return args[0] if args else ""
|
| 10 |
+
|
| 11 |
+
japanese_patch.distribute_phone = distribute_phone
|
| 12 |
+
|
| 13 |
+
# Register dummy module in sys.modules
|
| 14 |
+
sys.modules["melo.text.japanese"] = japanese_patch
|
| 15 |
|
| 16 |
# Then import cleaner safely
|
| 17 |
from melo.text import cleaner # this will now skip Japanese logic
|