Code Monkey home page Code Monkey logo

Comments (5)

stuaxo avatar stuaxo commented on September 14, 2024

Not sure if I want the same thing, but it sounds like it -

given

Trie([u'some.long.name', u'some.short.name'])
I'd like a way to get back

[u'some.long', u'some.short'])

from marisa-trie.

superbobry avatar superbobry commented on September 14, 2024

I'm not sure if this is possible using the public API of marisa-trie the C++ library. Need to check and then maybe forward the issue upstream.

from marisa-trie.

KCzar avatar KCzar commented on September 14, 2024

When I originally posted that, I for some reason didn't realize 'prefixes' returned them in order (duh), so what I needed was basically already implemented satisfactorily.

What you stuaxo want is something else. I'm not completely sure what you want though...

from marisa-trie.

stuaxo avatar stuaxo commented on September 14, 2024

In the end, I implemented this using a different library, + what I needed turned out to be slightly different - I needed something like this:

t = Trie([u'some.long.name', u'some.short.name'])
t.longest_unique_prefixes()
u['some.']
t = Trie([u'some.long.name', u'some.short.name', 'blah.1', 'blah.2'])
t.longest_unique_prefixes()
u['some.', 'blah.']

from marisa-trie.

stuaxo avatar stuaxo commented on September 14, 2024

^ I guess what I wanted needed here is the 'roots' of the Trie.

from marisa-trie.

Related Issues (20)

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.