0

I'm trying to work out the best way possible to search a List based on say merchant name and amount. For example consider following Transaction class or goals :

public class Transaction
{
    public string MerchantName;
    public double Amount
    public int Rank
}

The input for a search of List might be "Acme" for merchant and "13.37" for amount. Or "Amce" -- Acme spelled incorrectly. Weather merchant is spelled 100% correct or slightly off I would like to return all "Acme" transactions. Additionally based on the "closeness" of input amount & closeness of spelling to actual Transaction amount/name provide a rank or weighting to the transactions so the UI layer can present accordingly.

Comceptually i understand SoundEx and Edit Distance type algorithms but have zero practical experience implementing this in code. Looking to draw from the community here you experience guidance. I understand this code may (maybe not) be better suited to implement in SQL (in my case SQL) but right now i'd like to see if this is achievable in the application code -- c#. Open to SQL suggestions though.

Thanks

Mike
  • 780
  • 1
  • 5
  • 26
  • possible duplicate of [How to calculate distance similarity measure of given 2 strings?](http://stackoverflow.com/questions/9453731/how-to-calculate-distance-similarity-measure-of-given-2-strings) – Daniel A. Thompson Sep 02 '15 at 20:49
  • Yeah, or possibly not the same if you bother to read either one. – Mike Sep 02 '15 at 21:20
  • He's asking how to implement levenshtein distance in c#. the other question has the answer. – Daniel A. Thompson Sep 02 '15 at 21:23
  • No, i'm not asking how to implement Edit Distance otherwise I would have just looked it up. I'm looking for a practical solution to seaching List which *could* include things like Edit Distance or SoundEx. The goal as stated in the original question is to be able to apply a "Weight/Rank" to such matches based on not just text but amount. I'm looking for a point in the direction to the solution. If I need the implementation of Edit Distance then i clearly state that. – Mike Sep 02 '15 at 21:41
  • In that case, you may want to clarify in your question that _this_ refers to your overall problem and not the levenshtein distance part: "Comceptually i understand SoundEx and Edit Distance type algorithms but have zero practical experience implementing _this_ in code." – Daniel A. Thompson Sep 02 '15 at 21:50
  • Apparently you need a lot of clarification. – Mike Sep 02 '15 at 21:51
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/88636/discussion-between-daniel-a-thompson-and-mike-morse). – Daniel A. Thompson Sep 02 '15 at 21:53

0 Answers0