<< Click to Display Table of Contents >> Navigation: 3. Script Language > Mathematical and algorithmic operations > Mathematical and algorithmic operations |
MiniRobotLanguage (MRL)
FZC. Command
Fuzzy Compare
Intention
Compare two strings with one of two alternative fuzzy logic algorithms.
FZC. in Mode 1 uses a percentage from 0 to 100.
FZC. in Mode 2 (use P3, "m"-Flag) calculates a error number starting from 0 if two strings are equal.
In both modes, you will find the internally calculated "Match-value" on TOS.
The firs example will evaluate to 95% and therefore leave a 95 on the TOS.
$$TXB=ABCDEFGHIJK
$$TXA=ABCEFGHIJK
FZC.$$TXA|$$TXB
DBP.$$000
ENR.
In Mode 2 we deal with "typing errors". Take this example:
$$TXB=ABCDEFGHIJK
$$TXA=ABCEFGHIJK
FZC.$$TXA|$$TXB|m
DBP.$$000
ENR.
Will drop a "1" on TOS. It indicates that if you type one character at the right place, these strings could be equal. Note that a missing or deleted char is always one typing error.
If you want to base a decision on the result of the comparison, prefer
Syntax
FZC.P1|P2[|P3]
Parameter Explanation
P1 - Variable A to compare
P2 - Variable B to compare
P4 - (optional) can be omitted or can be "m". In that case
another algorithm is used to compare P1 and P2.
In detail the difference is:
- Algorithm 1 (no "m"-Flag):
Result on TOS is a percentage number from 0% to 100%.
P1 matches P2 for the given percentage.
- Algorithm 2 ("m"-Flag, P4 is used):
Result is a error number, similar to wrong letter,
or missing letter. If Algorithm 2 is chosen, then
P1 matches P2 taking into account the resulting
number of "typing errors".
Example
'***********************************
' FZC.-Test, Algo 1
'***********************************
$$TXB=ABCDEFGHIJK
$$TXA=ABCEFGHIJK
FZC.$$TXA|$$TXB
DBP.$$000
ENR.
'***********************************
' FZC.-Test, Algo 2
'***********************************
$$TXB=ABCDEFGHIJK
$$TXA=ABCEFGHIJK
FZC.$$TXA|$$TXB|m
DBP.$$000
ENR.
Remarks
-
Limitations:
-
See also:
• IVP./ NVP. - If-Variable-Pattern
• IVC. / NVC. - If-Variable-Contains
• CAL. - mathematical CALculation
• IVV. / NVV. - If Variable Value