Recognition of license plate error less than 2 digits display entry information higher than 2 digits not displayed
The recognition rule is 1 digits according to the province error and the following digit letter error is 1 bits.
A matching license plate entry can be displayed as long as the combined error rate is <= 2.
That is, the province error is 1 bit + any subsequent 1-bit errors will display matching similar information
For example: Yu a BCDE9 yu a BCDE8 yue a BCDE9 yue B BCDE9 New Energy A truth
//Get related vehicle information Public StaticList<currentparking> Getcurrentparkingbycode (stringStrplatecode) {List<CurrentParking> inparksimilarlist =NewList<currentparking>(); using(Parkingcontext db=NewParkingcontext ()) { stringSqlstr ="SELECT * from inparking where type=0 and (Plateno!=null OR plateno!= ") Order BY inrecordid Desc"; Objectresult<CurrentParking> Objresult = db. Executestorequery<currentparking>(SQLSTR); if(Objresult! =NULL) { varParklist =Objresult. ToList (); // //traverse the data loop to take the license plate information to pass the license plate information cycle ratio for(inti =0; I < Parklist. Count; i++) { stringPlateno =Parklist[i]. Platecode; //The error rate is <= 2 is less than or equal to 2 bits to display the matching license plate entry record if(Similarplateno (Plateno, Strplatecode) <=2) { //values that meet the criteria are saved to the list collectionInparksimilarlist.add (Parklist[i]); } } } } returninparksimilarlist; }
/// <summary> ///The similarity ratio is based on the acquired license plate number and the online license plate number passed/// </summary> /// <param name= "" ></param> /// <param name= "" ></param> /// <returns></returns> Public Static intSimilarplateno (stringPlateno,stringStrplatecode) { intNret =0; Do { if(Plateno = =NULL|| Strplatecode = =NULL) { Break; } if(Plateno. Length! =Strplatecode. Length) { Break; } for(inti =0; i < plateno.length; i++) { //Str[i] Indicates whether the characters in the string are similar//The number of similar lengths is calculated by using the Loop-out license plate length and the string passing over the license plate. if(Plateno[i] = =Strplatecode[i]) {Nret++; } } } while(false); //circulation of license plate length-Similar length = Error recognition degree returnPlateno.length-Nret; }
Match similar vehicles according to algorithm rules