I am trying to read in a Fuzzy plain text rule and pass the parameters to a SciKit-Fuzzy function call to create fuzzy rules. For example, if I read in this text rule:
IF service IS poor OR food IS rancid THEN tip IS cheap
Then the function call will be:
ctrl.Rule(service ['poor'] | food ['rancid '], tip ['cheap'])
If text rule is:
IF service IS good THEN tip IS average;
Then the function call will be:
ctrl.Rule(service ['good '] , tip ['average'])
Since each rule can have unlimited number of input variables, e.g. the user can also say:
IF service IS good AND food IS good AND mood IS happy THEN tip IS high
which contains 3 inputs variables service['good']
,food['good']
,and mood['happy']
, and 1 output variable tip['high']
.
I can't think of a way to automatically read in the text rule and convert it to a function call, do you have any idea or suggestion to achieve this goal? Any help will be appreciated. Thanks.