Levenshtein DFA in .NET

前端 未结 6 1496
广开言路
广开言路 2021-02-04 18:43

Good afternoon,

Does anyone know of an \"out-of-the-box\" implementation of Levenshtein DFA (deterministic finite automata) in .NET (or easily translatable to i

6条回答
  •  太阳男子
    2021-02-04 19:18

    I ported the relevant Lucene Java code as suggested by Robert Muir to C#. As far as the question goes and "out of the box": it is a work in progress but the code appears¹ to work and can probably be optimized² further, although it performs very well indeed.

    You can find it here: https://github.com/mjvh80/LevenshteinDFA/ .

    UPDATE: It appears that Lucene.NET is not in fact dead (yet?) and I noticed they now have a ported version of this code too. I would thus recommend looking there (https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.Core/Util/Automaton/LevenshteinAutomata.cs) for an implementation of this.


    ¹ the code needs more tests
    ² because it's java ported to C# perhaps and because I wrote naive replacements of some classes (e.g. bitset).

提交回复
热议问题