Giter Site home page Giter Site logo

Comments (8)

DmitryMak avatar DmitryMak commented on August 17, 2024 2

Thank you so much for the quick turnaround! It looks like exactly what we need. As a minor side note, String word parameter is missing in the readme file

from csharp-trie.

DmitryMak avatar DmitryMak commented on August 17, 2024 1

Thank you so much! IMHO the method name is exactly what it should be because it is a well known algorithm. But the parameter name should not be 'prefix' because it is actually a full word and the trie itself is acting as a collection of prefixes (from which we choose the longest).

/// <summary>
/// Get longest matching prefix from the Trie.
/// </summary>
string GetLongestPrefixMatch(string word);

from csharp-trie.

DmitryMak avatar DmitryMak commented on August 17, 2024 1

Just a quick follow up, would you also be willing to add a corresponding TrieMap method? Same logic, but returning a value associated with the longest prefix, instead of the prefix itself. Something like this?

ITrieMap<TValue>.GetValueByLongestPrefixMatch(String word)

from csharp-trie.

rmandvikar avatar rmandvikar commented on August 17, 2024 1

Sure. I'll let the prerelease versions sit for a few days before cutting out release versions. Thanks.

from csharp-trie.

rmandvikar avatar rmandvikar commented on August 17, 2024

I've added it in 591b297 ("trie: Add GetLongestPrefixMatch()", 2023-11-02), but I'm not sure of the name yet, and will mostly change it. Any suggestions?

See 1.4.0-alpha0, and 1.4.0-alpha0.

from csharp-trie.

rmandvikar avatar rmandvikar commented on August 17, 2024

I've added. Please verify.

// ITrie
string GetLongestPrefixMatch(string word);

// ITrieMap<TValue>
KeyValuePair<string, TValue>? GetLongestPrefixMatch(string word);

See 1.4.0-alpha2, and 1.4.0-alpha2.

from csharp-trie.

rmandvikar avatar rmandvikar commented on August 17, 2024

In case you're interested, I also added

// ITrieMap<TValue>
IEnumerable<KeyValuePair<string, TValue>> GetLongestKeyValuePairs();
IEnumerable<KeyValuePair<string, TValue>> GetShortestKeyValuePairs();

See 1.5.0-alpha0, and 1.5.0-alpha0.

from csharp-trie.

rmandvikar avatar rmandvikar commented on August 17, 2024

Released 1.4.0, and 1.5.0.

from csharp-trie.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.