/src/im/gpinyin/command/test.cpp

http://ftk.googlecode.com/ · C++ · 27 lines · 23 code · 4 blank · 0 comment · 1 complexity · a82c001e906235511f2774adf6513851 MD5 · raw file

  1. #include <cstdio>
  2. #include <cassert>
  3. #include "pinyinime.h"
  4. using namespace ime_pinyin;
  5. int main(int argc, char* argv[])
  6. {
  7. unsigned i = 0;
  8. unsigned nr = 0;
  9. unsigned size = 0;
  10. char16 str[64] = {0};
  11. bool ret = im_open_decoder("./dict_pinyin.dat", "./user.dat");
  12. assert(ret);
  13. im_set_max_lens(32, 16);
  14. im_reset_search();
  15. nr = im_search("xian'jin", 8);
  16. printf("%s", im_get_sps_str(&size));
  17. for(i = 0; i < nr; i++)
  18. {
  19. im_get_candidate(i, str, 32);
  20. }
  21. im_close_decoder();
  22. return 0;
  23. }