Update KiwiJava binding to 0.21.0

This commit is contained in:
bab2min 2025-03-24 02:46:47 +09:00
commit 51dfac482e
5 changed files with 49 additions and 14 deletions

View file

@ -95,6 +95,23 @@ namespace jni
}
};
template<>
struct ValueBuilder<kiwi::ModelType> : public ValueBuilder<uint32_t>
{
using CppType = kiwi::ModelType;
using JniType = jint;
CppType fromJava(JNIEnv* env, JniType v)
{
return (CppType)v;
}
JniType toJava(JNIEnv* env, CppType v)
{
return (JniType)v;
}
};
template<>
struct ValueBuilder<kiwi::Match> : public ValueBuilder<uint32_t>
{
@ -564,7 +581,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
.template method<&JTypoTransformer::scaleCost>("_scaleCost"),
jni::define<JKiwiBuilder>()
.template ctor<std::string, size_t, kiwi::BuildOption, bool>()
.template ctor<std::string, size_t, kiwi::BuildOption, kiwi::ModelType>()
.template method<&JKiwiBuilder::addWord>("addWord")
.template method<&JKiwiBuilder::addWord2>("addWord")
.template method<&JKiwiBuilder::addPreAnalyzedWord>("addPreAnalyzedWord")