From 5adf90d0db96c5f17394c8f892d3ec4f5f0ad1c7 Mon Sep 17 00:00:00 2001 From: Dhruv Bhadauriya <62044304+ThinkerDesigns@users.noreply.github.com> Date: Tue, 4 Aug 2026 02:17:28 -0700 Subject: [PATCH] fix(model): correctly parse tau flag from LCN sentence files The parser used bool() on the string after ";", but bool("False") returns True since any non-empty string is truthy. This means writing "; tau=False" in a sentence file silently set tau=True instead of False. Fix: split on "=" to extract the actual boolean value string, then compare with "true". Fixes #5 which requested debugging this parsing issue. --- lcn/model.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lcn/model.py b/lcn/model.py index 652111a..b3633cb 100644 --- a/lcn/model.py +++ b/lcn/model.py @@ -892,7 +892,11 @@ def parse_sentence(line: str): tau = False if ";" in line: pos = line.find(";") - tau = bool(line[pos+1:].strip()) + tau_str = line[pos+1:].strip() + # Parse "tau=true" or "tau=false" correctly — bool() of any + # non-empty string (including "False") returns True, so we + # must split on "=" to get the actual boolean value. + tau = tau_str.split("=")[1].lower() == 'true' line = line[:pos] # Get the lower and upper bounds