This code is the Zero-Winkler Algorithm taken from the website. I need to run 150,000 times to get distance between differences It takes a long time, because I run on Android mobile device.
Can it be more customized?
Public square jero {/ ** * meets the similarity using two strings; * The absolute string 1 first input string * @parl string 2 second input string * @ similarity Retrieve the value between 0-1 / the time of the public float (the last string string 1, the last string string 2) {// Get half the length of the string of the string - (this distance used for acceptable changes Final integer drawing = ((mathematics.man (string 1.length (), string 2.lampaign ()) / 2) + ((Math Math (string 1 .length (), string 2.length ()) )% 2); // Get normal letters StringBuffer common1 = getCommonCharacters (string 1, string 2, adlain); Last string buffer generic 2 = receptor (string 2, string 1, adlen); // check for zero in general if (Common1.length () == 0 = normal 2. length () == 0) {return 0.0f;} // return for the same length 0.0f return normal If the wire is not equal (common1.length ()! = Common2.length ()) {return 0.0f;} // Get the number of changes int transpositions = 0; Int n = common1.length (); For (int i = 0; i & lt; n; i ++) {if (normal 1. chat (i)! = Common 2. chat (i)) Transpision ++; } Changes / = 2.0 F; // Just Metric Returns (Normal 1.Length ()) / ((Float) String 1.Long ()) + Common 2 Lamp () / (Float) String 2. Langghi ()) + (Normal 1. Langh () - Reciprocity) / ((Float) Common 1. Lamp ()) / 3.0 F; } / ** * String 1 gives string buffer of characters in string 1 if they are separated from the distance given in position 1 in string 1. Return a string buffer of characters in string 1 in the * absolute string 1 * @ ultimate string 2 * @ ultimate distance sep * string 1 if they have the string 1 * / private static stringbuff mill in the comoncars (the last string string 1, the last string String 2, Final Int distance sep) {// vs. Return of the last stringbuff return Return buffer = new stringbuffer (); // Final string buffer copy = make a copy of string 2 for new string buffer (string 2) processing; // iterate on straight 1 int n = string1.length (); Int m = string2.length (); For (int i = 0; i & lt; n; i ++) {last 4 cl = string 1. charts (i); // Set boolean to exit quick loop if bullion is found = false; // Compare the letters with the letters around the alphabet (int j = math max (0, i-distance sep);; found it & amp; amp; j & lt; math · ihenry (i + distance) SEP, M-1); J ++) {// check if found (copy.charAt (j) == ch) {foundIt = true; // Attachment character returned. Commons.append (ch); // Copied string 2 for copying copy.setCharAt (j, (char) 0); }}} Return Retrieval; }}
I mentioned that in the whole process, I just make an example of the script, so only once
jaro = new jaro () ;
If you need testing and examples then the script is not going to break, you will find it in another thread for python optimization.
Yes, but you will not enjoy it. Replace all those newer
adi stringbuffers with the four arrays which are allocated in the constructor and then use the integer index to track them to use the integer index anytime.
Taste.
Comments
Post a Comment