support two letter yunmu from full pinyin
[platform/upstream/libpinyin.git] / scripts / correct.py
1 # -*- coding: utf-8 -*-
2 # vim:set et sts=4 sw=4:
3 #
4 # libpinyin - Library to deal with pinyin.
5 #
6 # Copyright (c) 2007-2008 Peng Huang <shawn.p.huang@gmail.com>
7 # Copyright (C) 2011 Peng Wu <alexepico@gmail.com>
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2, or (at your option)
12 # any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22
23 auto_correct = [
24     # "correct", "wrong"
25     ("ng", "gn"),
26     ("ng", "mg"),
27     ("iu", "iou"),
28     ("ui", "uei"),
29     ("un", "uen"),
30 #    ("ue", "ve"),
31     ("ve", "ue"),
32     ("ong", "on"),
33 ]
34
35 auto_correct_ext = [
36     # "correct", "wrong", flag
37     ("ju", "jv", "PINYIN_CORRECT_V_U"),
38     ("qu", "qv", "PINYIN_CORRECT_V_U"),
39     ("xu", "xv", "PINYIN_CORRECT_V_U"),
40     ("yu", "yv", "PINYIN_CORRECT_V_U"),
41
42     ("jue", "jve", "PINYIN_CORRECT_V_U"),
43     ("que", "qve", "PINYIN_CORRECT_V_U"),
44     ("xue", "xve", "PINYIN_CORRECT_V_U"),
45     ("yue", "yve", "PINYIN_CORRECT_V_U"),
46
47     ("juan", "jvan", "PINYIN_CORRECT_V_U"),
48     ("quan", "qvan", "PINYIN_CORRECT_V_U"),
49     ("xuan", "xvan", "PINYIN_CORRECT_V_U"),
50     ("yuan", "yvan", "PINYIN_CORRECT_V_U"),
51
52     ("jun", "jvn", "PINYIN_CORRECT_V_U"),
53     ("qun", "qvn", "PINYIN_CORRECT_V_U"),
54     ("xun", "xvn", "PINYIN_CORRECT_V_U"),
55     ("yun", "yvn", "PINYIN_CORRECT_V_U"),
56
57 #    ("juang", "jvang", "PINYIN_CORRECT_V_U"),
58 #    ("quang", "qvang", "PINYIN_CORRECT_V_U"),
59 #    ("xuang", "xvang", "PINYIN_CORRECT_V_U"),
60 #    ("yuang", "yvang", "PINYIN_CORRECT_V_U"),
61
62 #    ("jun", "jven", "PINYIN_CORRECT_UEN_UN | PINYIN_CORRECT_V_U"),
63 #    ("qun", "qven", "PINYIN_CORRECT_UEN_UN | PINYIN_CORRECT_V_U"),
64 #    ("xun", "xven", "PINYIN_CORRECT_UEN_UN | PINYIN_CORRECT_V_U"),
65 #    ("yun", "yven", "PINYIN_CORRECT_UEN_UN | PINYIN_CORRECT_V_U"),
66 ]
67
68
69 '''
70 fuzzy_shengmu = [
71     ("c", "ch"),
72     ("ch", "c"),
73     ("z", "zh"),
74     ("zh", "z"),
75     ("s", "sh"),
76     ("sh", "s"),
77     ("l", "n"),
78     ("n", "l"),
79     ("f", "h"),
80     ("h", "f"),
81     ("l", "r"),
82     ("r", "l"),
83     ("k", "g"),
84     ("g", "k"),
85 ]
86
87 fuzzy_yunmu = [
88     ("an", "ang"),
89     ("ang", "an"),
90     ("en", "eng"),
91     ("eng", "en"),
92     ("in", "ing"),
93     ("ing", "in"),
94 ]
95 '''