Skip to content

Commit

Permalink
freeze intersection grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
breandan committed Apr 4, 2024
1 parent 7c7de3a commit 899ecf3
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fun main() {
// MAX_UNIQUE = 1_000
TIMEOUT_MS = 30_000
MIN_TOKENS = 3
MAX_TOKENS = 40
MAX_TOKENS = 80
// MAX_RADIUS = 3
CFG_THRESH = 10_000
evaluateBarHillelRepairOnStackOverflow()
Expand Down Expand Up @@ -99,6 +99,7 @@ fun evaluateBarHillelRepairOnStackOverflow() {
parikhMap = parikhMap
).also { intGram -> intGram.ifEmpty { println("Intersection grammar was empty!"); null } }
} catch (e: Exception) { println("$humanRepairANSI\nIntersection error: ${e.stackTraceToString()}"); null }
?.freeze()

println("Constructed LEV($levDist, ${toRepair.size}, $levBallSize) " +
"∩ CFG grammar with ${intGram?.size ?: 0} productions in ${allTime.elapsedNow()}")
Expand Down Expand Up @@ -498,7 +499,7 @@ fun measureLevenshteinBlanketSize() {
levBall,
parikhMap = parikhMap
).also { intGram -> intGram.ifEmpty { println("Intersection grammar was empty!"); null } }
} catch (e: Exception) { null }
} catch (e: Exception) { null }?.freeze()

try {
if (intGram == null) throw Exception("Exception while building grammar!")
Expand Down

0 comments on commit 899ecf3

Please sign in to comment.