Fix/strict syntax default#256
Open
m-messer wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The platform sets strict_syntax to false by default, but the code defaulted to True in two places (evaluation.py and expression_utilities.py). This meant that when no strict_syntax key was present in params, the code would enforce strict syntax rules (e.g. rejecting ^ for exponentiation) even though the platform's intended behaviour is to be permissive by default.
Fix
Changed the fallback value for params.get("strict_syntax", ...) from True to False in both:
Other changes
None — this is a targeted two-line fix with no refactoring or behaviour changes beyond aligning the defaults.
Database Testing
Results can be found here: https://github.com/lambda-feedback/compareExpressions/actions/runs/25863534753/job/75999407423
10 errors out of 1000
(x cosx - sinx) / (x^{2})could not be parsed as a valid mathematical expression. Ensure that correct codes for input symbols are used, correct notation is used, that the expression is unambiguous and that all parentheses are closed.d/(dt)+ujd/(dxj)response:d/(dt)+uj(d/(dxj))2( tan x) sec^(2) xcould not be parsed as a valid mathematical expression. Ensure that correct codes for input symbols are used, correct notation is used, that the expression is unambiguous and that all parentheses are closed.(1/3)*beta*gamma*z**3 + (1/2)*(rho_0*gamma + beta*g_0)*z**2 + rho_0*g_0*zresponse:1/3 beta gammaz^3+1/2(rho_0 gamma)z^2+1/2(g_0 beta)z^2+(rho_0g_0)z(d/(dt)+ujd/(dxj)response:d/(dt)+uj*((d/(dxj)))(d/(dt)+ujd/(dxj)response:d/(dt)+uj*((d/(dxj)))x E^{x}(2+x)could not be parsed as a valid mathematical expression. Ensure that correct codes for input symbols are used, correct notation is used, that the expression is unambiguous and that all parentheses are closed.A/s( e^(-as)-e^(-bs))response:A(( E^(-a*s))-( E^(-b*s)))/s2( tan x) sec^(2) xcould not be parsed as a valid mathematical expression. Ensure that correct codes for input symbols are used, correct notation is used, that the expression is unambiguous and that all parentheses are closed.-2M0/3could not be parsed as a valid mathematical expression. Ensure that correct codes for input symbols are used, correct notation is used, that the expression is unambiguous and that all parentheses are closed.