Skip to content
Snippets Groups Projects
Commit 32fcb4b0 authored by Sebastian Schwarz's avatar Sebastian Schwarz
Browse files

RestoreCards method

parent 9b9b9197
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ namespace Levenshtein ...@@ -9,6 +9,7 @@ namespace Levenshtein
public class CardMechanic public class CardMechanic
{ {
private List<Cards> _cards = new List<Cards>(); private List<Cards> _cards = new List<Cards>();
private List<string> _references = new List<string>();
public void ReadFromScrambled() public void ReadFromScrambled()
{ {
...@@ -26,7 +27,7 @@ namespace Levenshtein ...@@ -26,7 +27,7 @@ namespace Levenshtein
Count = double.Parse(part[4]), Count = double.Parse(part[4]),
}; };
_cards.Add(card); _cards.Add(card);
System.Console.WriteLine(_cards.Count());
} }
...@@ -42,5 +43,33 @@ namespace Levenshtein ...@@ -42,5 +43,33 @@ namespace Levenshtein
} }
} }
} }
public void ReadFromReference()
{
var read = System.IO.File.ReadLines(@"E:\Downloads\reference.txt");
foreach (string line in read)
{
_references.Add(line);
System.Console.WriteLine(line.Length);
}
}
public void RestoreCards()
{
foreach (Cards card in _cards)
{
foreach (string reference in _references)
{
Levenshtein l = new Levenshtein(card.Name, reference);
if ((l.LevenshteinDistance() / (reference.Length)) < 0.275)
{
System.Console.WriteLine(card.Name);
System.Console.WriteLine(reference);
}
}
}
}
} }
} }
...@@ -15,7 +15,8 @@ namespace Levenshtein ...@@ -15,7 +15,8 @@ namespace Levenshtein
CardMechanic test1 = new CardMechanic(); CardMechanic test1 = new CardMechanic();
test1.ReadFromScrambled(); test1.ReadFromScrambled();
test1.CardsToFile(); test1.ReadFromReference();
//test1.RestoreCards();
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment