We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement rules.NaturalLanguageRule
rules.NaturalLanguageRule
TableRuleset
# draft parser for natural language rule import re rule_text = re.split('If(.*)Then(.*)', 'If something and something else Then context.target = context.fare * 2, context.target2 = context.fare2 * 5') conditions = rule_text[1] actions = re.split('(.*=.*)[,]+', rule_text[2]) print "split rule", rule_text print "conditions" , conditions print "actions", actions for action in actions[1:]: split_action = re.split('context\.(.*)=(.*)', action) print "target", split_action
outputs this:
split rule ['', ' something and something else ', ' context.target = context.fare * 2, context.target2 = context.fare2 * 5', ''] conditions something and something else actions ['', ' context.target = context.fare * 2', ' context.target2 = context.fare2 * 5'] target [' ', 'target ', ' context.fare * 2', ''] target [' ', 'target2 ', ' context.fare2 * 5', '']
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Implement
rules.NaturalLanguageRule
Expected behaviour:
TableRuleset
, but without the structure given in a dictionary)Sample code to parse text
outputs this:
The text was updated successfully, but these errors were encountered: