File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
src/commonMain/kotlin/ai/hypergraph/kaliningraph/parsing Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,23 @@ fun Σᐩ.unpackCoordinates() =
5858 substringAfter(' _' ).split(' /' )
5959 .let { (i, j) -> i.toInt() to j.toInt() }
6060
61+ fun makeAllHolesFSA (len : Int ): FSA {
62+ require(len >= 0 ) { " len must be non-negative" }
63+
64+ // States: q_0/0, q_1/0, ..., q_len/0
65+ // Arcs: q_{i-1}/0 --[!=]_-> q_i/0 for i = 1..len
66+ val arcs: TSA = (1 .. len).map { i -> " q_${i - 1 } /0" to " [!=]_" to " q_${i} /0" }.toSet()
67+
68+ val initial = setOf (" q_0/0" )
69+ val finals = setOf (" q_${len} /0" )
70+
71+ return AFSA (arcs, initial, finals).also {
72+ it.height = 0 // single row
73+ it.width = len // number of columns
74+ it.levString = List (len) { " _" } // template metadata (all holes)
75+ }
76+ }
77+
6178fun makeExactLevCFL (
6279 str : List <Σᐩ>,
6380 radius : Int , // Levenshtein distance
You can’t perform that action at this time.
0 commit comments