# # 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., 675 Mass Ave, Cambridge, MA 02139, USA. from utils import expand_file from genpinyintable import gen_content_table, \ gen_pinyin_index, gen_bopomofo_index, \ gen_chewing_key_table from genspecialtable import gen_divided_table, gen_resplit_table def get_table_content(tablename): if tablename == 'CONTENT_TABLE': return gen_content_table() if tablename == 'PINYIN_INDEX': return gen_pinyin_index() if tablename == 'BOPOMOFO_INDEX': return gen_bopomofo_index() if tablename == 'DIVIDED_TABLE': return gen_divided_table() if tablename == 'RESPLIT_TABLE': return gen_resplit_table() if tablename == 'TABLE_INDEX': return gen_chewing_key_table() ### main function ### if __name__ == "__main__": expand_file("pinyin_parser_table.h.in", get_table_content)
# the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. from utils import expand_file from chewingkey import gen_initials, gen_middles, gen_finals, gen_tones def get_table_content(tablename): if tablename == 'CHEWING_INITIAL': return gen_initials() if tablename == 'CHEWING_MIDDLE': return gen_middles() if tablename == 'CHEWING_FINAL': return gen_finals() if tablename == 'CHEWING_TONE': return gen_tones() ### main function ### if __name__ == "__main__": expand_file("chewing_enum.h.in", get_table_content)
# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # 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. from utils import expand_file from chewingkey import gen_initials, gen_middles, gen_finals, gen_tones def get_table_content(tablename): if tablename == 'CHEWING_INITIAL': return gen_initials() if tablename == 'CHEWING_MIDDLE': return gen_middles() if tablename == 'CHEWING_FINAL': return gen_finals() if tablename == 'CHEWING_TONE': return gen_tones() ### main function ### if __name__ == "__main__": expand_file("chewing_enum.h.in", get_table_content)
entries = [] #select yunmu mapping yun = pinyin.SHUANGPIN_SCHEMAS[scheme][1] for c in "abcdefghijklmnopqrstuvwxyz;": y = yun.get(c, ("NULL", "NULL")) if len(y) == 1: y1 = y[0] y2 = "NULL" else: y1, y2 = y if y1 != "NULL": y1 = '"{0}"'.format(y1) if y2 != "NULL": y2 = '"{0}"'.format(y2) entry = '{{{{{0: <7}, {1: <7}}}}} /* {2} */'.format(y1, y2, c.upper()) entries.append(entry) return ',\n'.join(entries) def get_table_content(tablename): (scheme, part) = tablename.split('_', 1) if part == "SHENG": return gen_shengmu_table(scheme) if part == "YUN": return gen_yunmu_table(scheme) ### main function ### if __name__ == "__main__": expand_file("double_pinyin_table.h.in", get_table_content)
# # 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. from utils import expand_file from genpinyintable import gen_content_table, \ gen_pinyin_index, gen_bopomofo_index, \ gen_chewing_key_table from genspecialtable import gen_divided_table, gen_resplit_table def get_table_content(tablename): if tablename == 'CONTENT_TABLE': return gen_content_table() if tablename == 'PINYIN_INDEX': return gen_pinyin_index() if tablename == 'BOPOMOFO_INDEX': return gen_bopomofo_index() if tablename == 'DIVIDED_TABLE': return gen_divided_table() if tablename == 'RESPLIT_TABLE': return gen_resplit_table() if tablename == 'TABLE_INDEX': return gen_chewing_key_table() ### main function ### if __name__ == "__main__": expand_file("pinyin_parser_table.h.in", get_table_content)