Skip to content

Instantly share code, notes, and snippets.

@arvidfm
Created November 9, 2014 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arvidfm/52f57040a3b5159ae10a to your computer and use it in GitHub Desktop.
Save arvidfm/52f57040a3b5159ae10a to your computer and use it in GitHub Desktop.
anthy test case
######################################################################
# Automatically generated by qmake (3.0) Sun Nov 9 18:05:54 2014
######################################################################
TEMPLATE = app
TARGET = anthy-testcase
INCLUDEPATH += .
QT -= gui
LIBS += -lanthy
CONFIG += debug
# Input
SOURCES += testcase.cpp
#include <stdio.h>
#include <anthy/anthy.h>
#include <QTextCodec>
anthy_context_t context;
anthy_segment_stat ss;
anthy_conv_stat cs;
anthy_prediction_stat ps;
char buf[1000];
QTextCodec *codec = QTextCodec::codecForName("EUC-JP");
int main() {
printf("anthy_init\n");
anthy_init();
printf("anthy_create_context\n");
context = anthy_create_context();
QString s = "ぼく";
printf("anthy_set_string\n");
anthy_set_string(context, codec->fromUnicode(s).data());
//printf("anthy_set_prediction_string\n");
//anthy_set_prediction_string(context, codec->fromUnicode(s).data());
//printf("anthy_get_prediction_stat\n");
//anthy_get_prediction_stat(context, &ps);
printf("anthy_commit_segment\n");
anthy_commit_segment(context, 0, 2);
printf("anthy_release_context\n");
anthy_release_context(context);
printf("anthy_quit\n");
anthy_quit();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment