Fuzzy Logic for string comparison
Hi All
Thanks for taking the time to read the thread.
I was wondering if any of you has come accross an algorithim to compare two different strings (or find patterns or degree of similarity) between these strings - Fuzzy type logic
The reason I ask is because some of our duplicate invoices are created because the poster miss-enters the reference number - e.g. 1234A and 1234B. We would like to report invoices based on the similarity of the reference number.
I have heard of the Fisher Wagner algorithm that calculates the cost of the differences (based on whether a character is added / omitted or changed) and the Perl algorithm - which finds patterns based on the degree of similarity; but not sure how they are implemented in ABAP or where I can find the open source code
Your help is very appreciated.
Thanks,
Mamdouh
There are a few function modules provided by SAP which seem to be for fuzzy searches. ( Look at SE37 ). For classes, again, there are a few: look in table SEOCOMPO with CMPNAME = *FUZZY* to find the classes and methods.
These may give you what you need.
Similar Messages
-
Use Operator == for String Comparison
Hi,
I would like to know more about the impact of using operator == in String Comparison.
From the reference I get, it state this :
"Operator (==) compares two object addresses to see whether it refers to the same object."
I've tested it with 2 codes as below :
Code 1:
String Pass1 = "cosmo";
String Pass2 = "cosmo";
if (Pass1==Pass2)
System.out.println("1&2:same");
else
System.out.println("1&2:not same");
Output : 1&2:same
Code 2:
String Pass3 = new String("cosmo");
String Pass4 = new String("cosmo");
if (Pass3==Pass4)
System.out.println("3&4:same");
else
System.out.println("3&4:not same");
Output : 3&4:not same
Can anyone kindly explain why is the result so? If operator == compares the addresses, isn't it that the 1st code should also have the output :"1&2:not same".Can anyone kindly explain why is the result so?It's an implementation artifact. Strings are pooled internally and because of that any String literal will be represented by exactly one object reference.
Knowledge of this shouldn't be utilized though. It's safer to follow the basic rule: Use == to compare object references and equals to compare object values, such as String literals. -
In KQL my query is like this,
refinablestring05<>9c460541-5979-44ec-b0ab-63d1823f922f
but looks like operator <> not working. It is not throwing error at all and always shows result.
Any one can help me out for this?use NOT operator so it would be "NOT refinablestring:something"
kashif -
HEllo,
Does anyone have any example on Fuzzy logic conrol under labview ? Im working on an irrigation project and I need to use fuzzy logic for the humidity sensor but im mew to fuzzy logic and labview !Hmmm.
Try the example finder (Menu Help >>Find Examples) Look at "FuzzyEx Dynamic Fuzzy Controler for a greenhouse.vi"
Spoiler (Highlight to read)
Bet the student gets an A
Bet the student gets an A
Jeff -
PID and Fuzzy Logic Toolkit for students
As the thread title states. I am a student running on the student version of labview. I have a project I am working on that would greatly be benifitted by the PID and Fuzzy Logic Toolkit. Is there a way for students to get this without the $1000 price tag?
Solved!
Go to Solution.I would talk to your school and see if they have any sort of academic discount program in place. If not, you could contact your local Academic Field Sales Engineer, whom you can find here.
-
Logic for correcting strings with different barckets
can any one tell me the simple logic for correcting strings with different barckets
suppose say for eg.
(<{abc}>defgh) should evaluate to TRUE
(<{abc>} should evaluate to FALSE
Things to check is
1. number of opening brace and closing brace
2. Their position are correct or not
If the above two conditions are met than it is TRUE else FALSE
i guess string function with decode and lenght function or case should do but bit difficult to develop this logic in with sql
Thanks,
AAKHi,
Here is non REGEXP_REPLACE version ( Unfotunately dont have 10G to feel the power of REGEXP_REPLACE.
SQL> ed
Wrote file afiedt.buf
1 SELECT DECODE(SUM(CASE
2 WHEN Left = '(' AND Right =')' THEN 0+Count_Bracket
3 WHEN Left = '<' AND Right ='>' THEN 0+Count_Bracket
4 WHEN Left = '{' AND Right ='}' THEN 0+Count_Bracket
5 WHEN Left = '[' AND Right =']' THEN 0+Count_Bracket
6 ELSE
7 1
8 END
9 )
10 ,0,'Valid','Invalid')
11 FROM
12 (
13 SELECT SUBSTR(str,(len+1 - level),1) Left, SUBSTR(str,(len + level),1) Right, MOD(LENGTH(str),2)
14 FROM
15 (
16 SELECT
17 REPLACE(translate('&exp','abcdefgh',' '),' ') str,
18 LENGTH(REPLACE(translate('&exp','abcdefgh',' '),' '))/2 len
19 FROM DUAL
20 )
21 CONNECT BY LEVEL <= LEN
22* )
SQL> /
Enter value for exp: (<{abc>} )
old 17: REPLACE(translate('&exp','abcdefgh',' '),' ') str,
new 17: REPLACE(translate('(<{abc>} )','abcdefgh',' '),' ') str,
Enter value for exp: (<{abc>} )
old 18: LENGTH(REPLACE(translate('&exp','abcdefgh',' '),' '))/2 len
new 18: LENGTH(REPLACE(translate('(<{abc>} )','abcdefgh',' '),' '))/2 len
DECODE(
Invalid
SQL>
SQL> /
Enter value for exp: <{[()]}>
old 17: REPLACE(translate('&exp','abcdefgh',' '),' ') str,
new 17: REPLACE(translate('<{[()]}>','abcdefgh',' '),' ') str,
Enter value for exp: <{[()]}>
old 18: LENGTH(REPLACE(translate('&exp','abcdefgh',' '),' '))/2 len
new 18: LENGTH(REPLACE(translate('<{[()]}>','abcdefgh',' '),' '))/2 len
DECODE(
Valid
SQL>
SQL> /
Enter value for exp: ([{<>}])
old 17: REPLACE(translate('&exp','abcdefgh',' '),' ') str,
new 17: REPLACE(translate('([{<>}])','abcdefgh',' '),' ') str,
Enter value for exp: ([{<>}])
old 18: LENGTH(REPLACE(translate('&exp','abcdefgh',' '),' '))/2 len
new 18: LENGTH(REPLACE(translate('([{<>}])','abcdefgh',' '),' '))/2 len
DECODE(
Valid
SQL>
SQL> /
Enter value for exp: (<{abc}>defgh)
old 17: REPLACE(translate('&exp','abcdefgh',' '),' ') str,
new 17: REPLACE(translate('(<{abc}>defgh)','abcdefgh',' '),' ') str,
Enter value for exp: (<{abc}>defgh)
old 18: LENGTH(REPLACE(translate('&exp','abcdefgh',' '),' '))/2 len
new 18: LENGTH(REPLACE(translate('(<{abc}>defgh)','abcdefgh',' '),' '))/2 len
DECODE(
Valid
SQL> Note: Only thing needs to care is " translate('<{[()]}>','abcdefgh',' ') " if string has some additional characters please include here.
Regards -
Is fuzzy logic vi good for discrete system
If modeling a system using PID is too hard or too difficult, I want to use fuzzy logic, but according to the NI control manual, fuzzy logic is good for a continuous system.
Can it be used on a discrete system? for example, turn on a heater for 2 second and shut off, wait for 10 minutes, and then meausre again and go through fuzzy logic?
Can my idea be fulfilled?
ThanksTo work with fuzzy logic does not require any transfer function as it is a fully descriptive, the disadvantage is that you have to know very well the operation of the plant and has something to do with trial and error, but when setting the rules correctly, your system is completely stable.
Jonathan Cruz
CHALLENGER
K U D O S __ B I E N V E N I D O S -
Fuzzy logic controller for DC motor
Hello guys!
Can anyone help me out in giving inputs to fuzzy controller which has two input member function Error and Change in error. Is there any tool which can store the previous error and compare it with present error which gives the chane in error?Hello,
Please look at the shipping example of Fuzzy Logic Toolkit in:
C:\Program Files\National Instruments\LabVIEW 2010\examples\control\fuzzy\Tanks with PI control\FuzzyEx Tanks with PI control.vi
This code will allow you to see how you can implement the error and rate error by using pure LabVIEW code. Now, if you have the Control Design and Simulation Module, this tool have functions that easily calculate the error and derivative for you.
Hope this helps
PS: Notice that this example is in LabVIEW 2010. The same example can be found also in 2009 by changing the number of the LabVIEW version on the path to 2009. Previous versions have this code, but they are a bit more difficult to understand. If you have previous version of LV 2009, I strongly recommend you to update to at least 2009 since on this version the toolkit was completely refactored. If you can't here is the location of the example previous to 2009:
C:\Program Files\National Instruments\LabVIEW 8.6\examples\control\fuzzy\tanks.llb\Tanks - fuzzy control PI.vi
Barp - Control and Simulation Group - LabVIEW R&D - National Instruments -
My project title is fuzzy logic controller for rotary crane. need to reduce sway of pendulum
helo. i want to ask whether my block diagram is correct or not. there is no error occured but no waveform will generate. i give the picture of my block diagram and my front panel. really need help. big thanks!
Attachments:
macam jadik je.JPG 42 KB
front panell.JPG 28 KBPlease look at this post for instructions in how to use Fuzzy Logic with RT. However, notice that this only works with RT, not FPGA:
http://forums.ni.com/t5/LabVIEW/Problem-of-using-fuzzy-in-my-project/m-p/1772362#M615631
Hope this helps
Barp - Control and Simulation Group - LabVIEW R&D - National Instruments -
Hi guys..
Any possiblity to implement fuzzy logic in java?
i) Yes? / No?
ii)If yes, how? (a bit guidance for this please)
Thanks a millioni) maybe
ii) N/A
sorry, I couldn't resist :-)
Seriously though, there's nothing special about fuzzy logic. The core math of it is simply a continuous superset over the Boolean [0,1] (or false/true) set. The following simply class defines a 'Fuzzy' value along with the basic operators --
public class Fuzzy {
// value in the range [0,1]
private double v;
// some ctors.
public Fuzzy() { this(0.0); }
public Fuzzy(double v) { setV(v); }
// getters and setters
public double getV() { return v; }
public void setV(double v) {
if (v >= 0.0 && v <= 1.0)
this.v= v;
// negation
double not() { return 1.0-v; }
// conjunction
double and(Fuzzy that) {
if (this.v <= that.v)
return this.v;
else
return that.v;
// disjunction
double or(Fuzzy that) {
if (this.v <= that.v)
return that.v;
else
return this.v;
}Does this get you started?
kind regards,
Jos -
Program for string comparision in ABAP
Hi,
I require a program in abap for string comparisionComparing Strings
Similarly to the special statements for processing strings, there are special comparisons that you can apply to strings with types C, D, N, and T. You can use the following operators:
<operator>
Meaning
CO
Contains Only
CN
Contains Not only
CA
Contains Any
NA
contains Not Any
CS
Contains String
NS
contains No String
CP
Contains Pattern
NP
contains No Pattern
There are no conversions with these comparisons. Instead, the system compares the characters of the string. The operators have the following functions:
CO (Contains Only)
The logical expression
<f1> CO <f2>
is true if <f1> contains only characters from <f2>. The comparison is case-sensitive. Trailing blanks are included. If the comparison is true, the system field SY-FDPOS contains the length of <f1>. If it is false, SY-FDPOS contains the offset of the first character of <f1> that does not occur in <f2> .
CN (Contains Not only)
The logical expression
<f1> CN <f2>
is true if <f1> does also contains characters other than those in <f2>. The comparison is case-sensitive. Trailing blanks are included. If the comparison is true, the system field SY-FDPOS contains the offset of the first character of <f1> that does not also occur in <f2>. If it is false, SY-FDPOS contains the length of <f1>.
CA (Contains Any)
The logical expression
<f1> CA <f2>
is true if <f1> contains at least one character from <f2>. The comparison is case-sensitive. If the comparison is true, the system field SY-FDPOS contains the offset of the first character of <f1> that also occurs in <f2> . If it is false, SY-FDPOS contains the length of <f1>.
NA (contains Not Any)
The logical expression
<f1> NA <f2>
is true if <f1> does not contain any character from <f2>. The comparison is case-sensitive. If the comparison is true, the system field SY-FDPOS contains the length of <f1>. If it is false, SY-FDPOS contains the offset of the first character of <f1> that occurs in <f2> .
CS (Contains String)
The logical expression
<f1> CS <f2>
is true if <f1> contains the string <f2>. Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true, the system field SY-FDPOS contains the offset of <f2> in <f1> . If it is false, SY-FDPOS contains the length of <f1>.
NS (contains No String)
The logical expression
<f1> NS <f2>
is true if <f1> does not contain the string <f2>. Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true, the system field SY-FDPOS contains the length of <f1>. If it is false, SY-FDPOS contains the offset of <f2> in <f1> .
CP (Contains Pattern)
The logical expression
<f1> CP <f2>
is true if <f1> contains the pattern <f2>. If <f2> is of type C, you can use the following wildcards in <f2>:
for any character string *
for any single character +
Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true, the system field SY-FDPOS contains the offset of <f2> in <f1> . If it is false, SY-FDPOS contains the length of <f1>.
If you want to perform a comparison on a particular character in <f2>, place the escape character # in front of it. You can use the escape character # to specify
characters in upper and lower case
the wildcard character "" (enter # )
the wildcard character "" (enter # )
the escape symbol itself (enter ## )
blanks at the end of a string (enter #___ )
NP (contains No Pattern)
The logical expression
<f1> NP <f2>
is true if <f1> does not contain the pattern <f2>. In <f2>, you can use the same wildcards and escape character as for the operator CP.
Trailing spaces are ignored and the comparison is not case-sensitive. If the comparison is true, the system field SY-FDPOS contains the length of <f1>. If it is false, SY-FDPOS contains the offset of <f2> in <f1> .
DATA: F1(5) TYPE C VALUE <f1>,
F2(5) TYPE C VALUE <f2>.
IF F1 <operator> F2.
WRITE: / 'Comparison true, SY-FDPOS=', SY-FDPOS.
ELSE.
WRITE: / 'Comparison false, SY-FDPOS=', SY-FDPOS.
ENDIF.
The following table shows the results of executing this program, depending on which operators and values of F1 and F2.
<f1>
<operator>
<f2>
Result
SY-FDPOS
'BD '
CO
'ABCD '
true
5
'BD '
CO
'ABCDE'
false
2
'ABC12'
CN
'ABCD '
true
3
'ABABC'
CN
'ABCD '
false
5
'ABcde'
CA
'Bd '
true
1
'ABcde'
CA
'bD '
false
5
'ABAB '
NA
'AB '
false
0
'ababa'
NA
'AB '
true
5
'ABcde'
CS
'bC '
true
1
'ABcde'
CS
'ce '
false
5
'ABcde'
NS
'bC '
false
1
'ABcde'
NS
'ce '
true
5
'ABcde'
CP
'b'
true
1
'ABcde'
CP
'#b'
false
5
'ABcde'
NP
'b'
false
1
'ABcde'
NP
'#b'
true
5
goto sap library if intsalled in ur system and check the above one.... -
In MVC, do i need a View or Page with flow logic for POPUP window
Hi All,
I have the below scenario using the MVC pattern.
I have a main view with 3 trays, each tray has two buttons, for example first tray has Create Order button. When I click on this button, I need a popup window to come with a tableview and a button(Create), where I select some rows and click on the button Create to create order.
But as per the MVC pattern I canu2019t call the view (popup) from another view(main view). So should I create a VIEW or PAGE WITH FLOW LOGIC for the popup? .
I need 6 popup to be called from the main view and once the function is done close the popup.
Please suggest me the flow for this scenario.
Cheers,
Srini.Srini,
1. You can call the view in pop-up because you will be calling the controller using open.window.
Here is the sample code:
method DO_REQUEST .
data:
li_vw type ref to if_bsp_page,
lv_form_field type string,
li_md type ref to zcl_model01.
dispatch_input( ).
li_md ?= get_model( 'm01' ).
lv_form_field = request->get_form_field( 'invoice_create' ).
if lv_form_field is initial.
*------ Request to display main page
li_vw = create_view( view_name = 'main.htm' ).
li_vw->set_attribute( name = 'model' value = li_md ).
call_view( li_vw ).
elseif lv_form_field eq 'true'.
*------ Request to display Invoice page in pop-up
li_vw = create_view( view_name = 'invoice.htm' ).
li_vw->set_attribute( name = 'model' value = li_md ).
call_view( li_vw ).
endif.
endmethod.
Layout:
function do_Invoice()
{ var s=0; r=1; w=300; h=300; x=screen.width/2;
x=x-w/2;
var y=screen.height/4;
y=y-h/2;
popUp=window.open('main.do?invoice_create=true','win','width='+ w
+',height='+ h +', left=' + x +',top='+ y +');
Option2:
Ofcourse you can't bind the model in page becos those are 2 different things. But all you need to do is access the model to get some value. To know how to access the model from Page w/flow logic look at [this link|Passing model reference to a page in a Popup].
Raja
Edited by: Raja Thangamani on Apr 14, 2009 11:22 AM -
I followed the truck maneuvering example in the 'PID Control Toolset User Manual' and tried to use the 'I/O-Characteristic' test facility. But, when I tried to run the test facility, I realized that there is no run & stop buttons in the window. By the way I did not do the exact the same things the book showed. For instance, the example uses 5 terms for one input and 7 for another one. I used 3 for both. But, I think basically I followed the most steps he mentions in the example. Do you have any idea what went wrong, or can you tell me how I can run the test facility?
AiroDear AdamB,
I am just wondering if you could help me a bit. I have two problems. The first one is, I'm working with the fuzzy logic toolbox from matlab. I created a .fis file with some rules from the fuzzy editor in the fuzzy logic toolbox from matlab, wich I want to run in labview, with the matlab script. How can load the fis file? I tried with the examples attached, but it didn't work.
The second problem is I have been doing some work with fuzzy logic toolbox in Matlab. The fuzzy inference system (FIS) built in Matlab environment is quite simple and straightforward. An example of the FIS in Matlab can be found in the attachment. Now I want to use the fuzzy logic toolkit from Labview to perform the same task. An example of the FIS in Labview can also be found attached. Although the FIS properties in Labview has been made the same as in Matlab, the result of the defuzzification is different. The FIS properties in Matlab are:
And method: prod
Or method: max
Implication: Prod
Aggregation: Sum
Defuzzification: Centroid
The FIS properties in Labview has been made:
Defuzzification Method: Center of Gravitiy (which is another name for Centroid)
If no rule is active: Take last value
Inference Method: Max-Min
Select form of rulebase: Normal rulebase
For instance, if the input to FIS is Matlab is -3.51, the output is 0.202. However, with the same input, the output from FIS in Labview is 0.30.
Perhaps you could help me?
Dedy
Attachments:
fuzzy_test.zip 7 KB
deltaR5.zip 2 KB -
LabVIEW 2010 PID and Fuzzy Logic Toolkit
Where can I download the evaluation software for the following:
LabVIEW 2010 PID and Fuzzy Logic Toolkit
Solved!
Go to Solution.We only have the latest version available for download and evaluation from here
I would suggest contacting your local sales representative and they can ship you a CD of the 2010 evaluation version via www.ni.com/ask
Kind Regards,
Rob
Applications Engineer -
Hi Guys,
I am trying to write a logic for comparison....Can you plz help me on this....
I have data like below.. I need to compare value which is comming from file with the data in SAP, If it fall under data maintained in sap 'Accept record' otherwise I need to reject. How can i check (write logic) for this checking....
data maintained in SAP , Data from file , Result
<10 , <8 , Accept
>5 and <10 , =8 , Accept
>5 and <10 , >15 , Reject
=15 , >10 and <30 , Accept
Thanks & Regards,
Rays
Message was edited by: rayudu p
Message was edited by: rayudu pHi Guys,
I am trying to write a logic for comparison....Can you plz help me on this....
I have data like below.. I need to compare value which is comming from file with the data in SAP, If it fall under data maintained in sap 'Accept record' otherwise I need to reject. How can i check (write logic) for this checking....
data maintained in SAP , Data from file , Result
<10 , <8 , Accept
>5 and <10 , =8 , Accept
>5 and <10 , >15 , Reject
=15 , >10 and <30 , Accept
Thanks & Regards,
Rays
Message was edited by: rayudu p
Message was edited by: rayudu p
Maybe you are looking for
-
My power just went out for a few seconds. Is there any way to restore my document? I had already had 2 hrs worth of work for an interview tomorrow and do not have time to start from scratch?
-
Switchover_status in standby database showing NOT ALLOWED
Hi All, My oracle database version is Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit on windows platform. I need to perform switchover activity with dg_broker=TRUE. When I checked the status of DR database I found that switchover_s
-
Calling a Procedure and Variables with a : vs. a ?
Sorry, this is a long one, but I'm trying to provide as much background as possible. The below code (from a procedure called view_ibba_for_maint) is a snippet of code from a much larger SQL package. The package is called from a web browser. htp.table
-
TS1368 Itunes Store trouble :/
I can't get onto the itunes Store. It says it's loading for awhile... then says can not connect in the united states or something like that. IDK what to do.
-
Does anyone know how to save all the links in a document or how to get that info from the crawler processes? I'd like to be able to show a search result (these are all web pages) and then all the documents that link to it. Thanks, Greg