Git Product home page Git Product logo

Comments (6)

jermp avatar jermp commented on August 23, 2024 1

It is not difficult, but currently the library does not support it yet.
If you don't care about the efficiency of the operation, one option is to proceed by scan: retrieve all children of a given prefix and just select the top-k.
For most queries, it will probably be efficiency too because of the few children to be examined.
A more complicated solution could use additional RMQ data structures.

from tongrams.

jermp avatar jermp commented on August 23, 2024

Hi.
The data structures storing the weights as counts support the lookup operation that, given a ngram, returns its associated weight.
The data structures storing the weights as prob/backoff support, instead, the score operation.
See details in the README (Benchmark section) and in the relevant paper.
Currently, top-k queries are not supported and there is no python binding.

from tongrams.

ndvbd avatar ndvbd commented on August 23, 2024

Thanks @jermp, how difficult would it be to modify things to support some top-k?
The k doesn't have to be unlimited. For example if I have an ngram-prefix, finding the best 5 or 10 words right after the prefix would be highly useful.

from tongrams.

ndvbd avatar ndvbd commented on August 23, 2024

Thanks @jermp, I see the lookup() operation in trie_count_lm.h, but what's the right way to scan all children of a given prefix?

from tongrams.

jermp avatar jermp commented on August 23, 2024

Currently, there is no method that allows you to do this but I can implement that.

from tongrams.

ndvbd avatar ndvbd commented on August 23, 2024

That would be fantastic.

from tongrams.

Related Issues (15)

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.