//zwraca podobieństwo stringów wedle miary LV public float[] Laventshtein_On_User(string userinput) { float[] Point_Key_Simi = new float[3] { 0, 0, 0 }; int KEY = 0; float newval = 0; int counter = 0; StringSift2 SS2 = new StringSift2(); foreach (SynthPair sp in DataBase) { KEY = 0; foreach (string s in sp.In_Message) { newval = SS2.Similarity(userinput, s); /* Console.WriteLine("KEY: " + s + " USER: "******" SIMILARITY-> " + SS2.Similarity(s, userinput)); Console.ReadLine();*/ if (newval > Point_Key_Simi[2]) { Point_Key_Simi[0] = counter; Point_Key_Simi[1] = KEY; Point_Key_Simi[2] = newval; } ++KEY; } ++counter; } Console.WriteLine("Metoda pomiaru odl. Laventshteina osiagnela podobienstwo=" + Point_Key_Simi[2] + " wybrane zagadnienie-> " + DataBase[(int)Point_Key_Simi[0]].Key_Sentence + " Zgodność z-> " + DataBase[(int)Point_Key_Simi[0]].In_Message[(int)Point_Key_Simi[1]] + "\n"); return Point_Key_Simi; }
static void Main(string[] args) { Bot Bot = new Bot("Genowefa Grzebinoga"); StringSift2 SS2 = new StringSift2(); Console.WriteLine( SS2.Similarity("Zjem Cie Noobie","Zjem cie st")); Console.ReadLine(); }
static void Main(string[] args) { Bot Bot = new Bot("Genowefa Grzebinoga"); StringSift2 SS2 = new StringSift2(); Console.WriteLine(SS2.Similarity("Zjem Cie Noobie", "Zjem cie st")); Console.ReadLine(); }