def gen_pinyins(): #generate all pinyins for pinyin in pinyin_list: flags = [] if pinyin in PINYIN_ZHUYIN_MAP.keys(): flags.append("IS_ZHUYIN") if pinyin in PINYIN_LIST or \ pinyin in SHENGMU_LIST: flags.append("IS_PINYIN") if pinyin in shengmu_list: flags.append("PINYIN_INCOMPLETE") zhuyin = PINYIN_ZHUYIN_MAP[pinyin] if zhuyin in chewing.CHEWING_ASCII_INITIAL_MAP and \ pinyin not in ZHUYIN_SPECIAL_INITIAL_SET_IN_PINYIN_FORM: flags.append("ZHUYIN_INCOMPLETE") yield pinyin, pinyin, zhuyin, flags, get_chewing(pinyin)
# You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import os import operator import itertools import chewing from pyzymap import ZHUYIN_PINYIN_MAP, ZHUYIN_LUOMA_PINYIN_MAP, ZHUYIN_SECONDARY_ZHUYIN_MAP from pyzymap import PINYIN_ZHUYIN_MAP, ZHUYIN_SPECIAL_INITIAL_SET_IN_PINYIN_FORM from fullpinyin import PINYIN_LIST, SHENGMU_LIST from options import * from utils import shuffle_all #pinyins pinyin_list = sorted(PINYIN_ZHUYIN_MAP.keys()) shengmu_list = sorted(SHENGMU_LIST) def check_pinyin_zhuyin_map(): for pinyin_key in PINYIN_LIST: if pinyin_key in pinyin_list: pass else: print("pinyin %s has no chewing mapping", pinyin_key) def get_chewing(pinyin): initial, middle, final = \ 'CHEWING_ZERO_INITIAL', 'CHEWING_ZERO_MIDDLE', 'CHEWING_ZERO_FINAL' assert pinyin != None
# along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import os import operator import itertools import chewing from pyzymap import ZHUYIN_PINYIN_MAP, ZHUYIN_LUOMA_PINYIN_MAP, ZHUYIN_SECONDARY_ZHUYIN_MAP from pyzymap import PINYIN_ZHUYIN_MAP, ZHUYIN_SPECIAL_INITIAL_SET_IN_PINYIN_FORM from fullpinyin import PINYIN_LIST, SHENGMU_LIST from options import * from utils import shuffle_all #pinyins pinyin_list = sorted(PINYIN_ZHUYIN_MAP.keys()) shengmu_list = sorted(SHENGMU_LIST) def check_pinyin_zhuyin_map(): for pinyin_key in PINYIN_LIST: if pinyin_key in pinyin_list: pass else: print("pinyin %s has no chewing mapping", pinyin_key) def get_chewing(pinyin): initial, middle, final = \ 'CHEWING_ZERO_INITIAL', 'CHEWING_ZERO_MIDDLE', 'CHEWING_ZERO_FINAL' assert pinyin != None