Created
November 9, 2014 19:13
-
-
Save arvidfm/52f57040a3b5159ae10a to your computer and use it in GitHub Desktop.
anthy test case
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################################################### | |
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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