Giter Site home page Giter Site logo

nhatbui / compakt Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 1.0 867 KB

Twitch Chat streamlining. Condenses repeated messages/words/emotes.

Home Page: http://www.nhatqbui.com/compakt

License: GNU General Public License v3.0

JavaScript 72.72% CSS 9.32% Swift 11.55% Makefile 6.41%

compakt's People

Contributors

nhatbui avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

romedtino

compakt's Issues

Refactor dictionary check to be asynchronous

On this line in compakt.js, every sentence from Twitch chat is hashed and checked in the dictionary if it has been uttered before or not. If true, the cached message is updated and DOM updates are performed. If false, the ordered dictionary is updated and DOM updates are performed. This is currently done all in one scope.

The refactor will achieve 2 things:

  1. the dictionary key check can be replaced by a more complex function (such as dictionary similarity).
  2. Potentially time-consuming processes such as message compression (when new unique message is discovered) and DOM updates are done asynchronously.

Possible solution:

function onMessageIsARepeat(..., DOMUpdate) {
     // update ordered dictionary
    DOMUpdate();
}

function onMessageIsUnique(..., DOMUpdate) {
    // compress chat message
    // update ordered dictionary
    DOMUpdate();
}

function checkIfMessageRepeated(msg,  onMessageIsARepeat, onMessageIsUnique) {
    // This will eventually be a function that can identify "similar" messages.
    if(key in dict) {
        onMessageIsARepeat(..., function() {
            // DOM Updates defined here.
        });
    } else {
        onMessageIsUnique(..., function() {
            // DOM Updates defined here.
        });
    }
}

Line 28 becomes: checkIfMessageRepeated(message, onMessageIsARepeat, onMessageIsUnique);

Rabin-Karp implemented incorrectly

Here and here. Rabin Karp implemented incorrectly because a rolling hash is not used. Current implementation doesn't save us time because hashes iterate through entire substring each time.

Note: we may lose the convenience of being able to skip chunks of characters when a match is found.

Note2: a better algo is also welcomed (1, 2)

Not working anymore

Hello, i found your Chrome Extension and it is realy cool, but it is to old, can you please update it?
It would be wonderful.

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.