Newer
Older
#include "parse-pinyin.h"
GList *
parse_pinyin(const char *preedit_str, const guint max_pinyin)
PyZy::PinyinArray pyar = {0};
const guint FLAGS = PINYIN_INCOMPLETE_PINYIN | PINYIN_CORRECT_ALL | PINYIN_FUZZY_ALL;
PyZy::PinyinParser::parse(preedit_str, strlen(preedit_str), FLAGS, pyar, max_pinyin);
for (guint i = 0; i < pyar.size(); ++i) {
thispy->shengmu_i = (int) pyar[i].pinyin->pinyin_id[0].sheng;
thispy->yunmu_i = (int) pyar[i].pinyin->pinyin_id[0].yun;
thispy->length = pyar[i].len;
}
return result;
}