Skip to content

Instantly share code, notes, and snippets.

@eiennohito
Created June 15, 2023 07:46
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 eiennohito/3d18cf251f196ca2a5b64fc26a13e5ef to your computer and use it in GitHub Desktop.
Save eiennohito/3d18cf251f196ca2a5b64fc26a13e5ef to your computer and use it in GitHub Desktop.
import com.worksap.nlp.sudachi.Config
import com.worksap.nlp.sudachi.DictionaryFactory
import com.worksap.nlp.sudachi.Tokenizer
import java.nio.file.Path
fun main() {
val config = Config.defaultConfig()
config.systemDictionary(Path.of("/path/to/system/dictionary"))
val dic = DictionaryFactory().create(config)
val tokenizer = dic.create()
val morphemes = tokenizer.tokenize(Tokenizer.SplitMode.C, "それは秘密です")
for (m in morphemes) {
println(m.surface())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment