SohomToom commited on
Commit
401c5c7
·
verified ·
1 Parent(s): 2c6a99a

Create mecab_patch.py

Browse files
Files changed (1) hide show
  1. mecab_patch.py +13 -0
mecab_patch.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ # Patch before importing Melo
4
+ os.environ["MECABRC"] = "/dev/null"
5
+
6
+ import MeCab
7
+
8
+ # Patch MeCab.Tagger to return dummy if needed
9
+ try:
10
+ MeCab.Tagger()
11
+ except RuntimeError:
12
+ import melo.text.japanese
13
+ melo.text.japanese._TAGGER = None # Disable Tagger to prevent failure