Kotlin Multiplatform implementation of the CYK algorithm.
repositories {
maven(url = "https://dl.bintray.com/deryeger/maven")
}
dependencies {
implementation("eu.yeger:cyk-algorithm:0.2.0")
}
This library contains two variants of the algorithm.
Both versions can be used by providing a grammar to the included parser or by programmatically generating the required model.
While the first version only computes the end result, runningCYK
computes a list containing every step of the algorithm.
cyk("hello world") {
grammar("S") {
"""
S -> A B
A -> hello
B -> world
""".trimIndent()
}
}.getOrElse { error(it) }
runningCYK("hello world") {
grammar("S") {
"""
S -> A B
A -> hello
B -> world
""".trimIndent()
}
}.getOrElse { error(it) }
An example project using this library can be found here.
Logo by Magdalena Jirku.