GithubHelp home page GithubHelp logo

tchigher / shift-ctrl-f Goto Github PK

View Code? Open in Web Editor NEW

This project forked from model-zoo/shift-ctrl-f

0.0 0.0 0.0 89.94 MB

๐Ÿ”Ž Search the information available on a webpage using natural language instead of an exact string match.

Home Page: https://modelzoo.dev

License: Apache License 2.0

Makefile 1.27% HTML 1.19% CSS 1.60% JavaScript 95.93%

shift-ctrl-f's Introduction

Shift-Ctrl-F: Semantic Search for the Browser

Shift-Ctrl-F

License

Search the information available on a webpage using natural language instead of an exact string match. Uses MobileBERT fine-tuned on SQuAD via TensorFlowJS to search for answers and mark relevant elements on the web page.

Shift-Ctrl-F Demo

This extension is an experiment. Deep learning models like BERT are powerful but may return unpredictable and/or biased results that are tough to interpret. Please apply best judgement when analyzing search results.

Why?

Ctrl-F uses exact string-matching to find information within a webpage. String match is inherently a proxy heuristic for the true content -- in most cases it works very well, but in some cases it can be a bad proxy.

In our example above we search https://stripe.com/docs/testing, aiming to understand the difference between test mode and live mode. With string matching, you might search through some relevant phrases "live mode", "test mode", and/or "difference" and scan through results. With semantic search, you can directly phrase your question "What is the difference between live mode and test mode?". We see that the model returns a relevant result, even though the page does not contain the term "difference".

How It Works

Every time a user executes a search:

  1. The content script collects all <p>, <ul>, and <ol> elements on the page and extracts text from each.
  2. The background script executes the question-answering model on every element, using the query as the question and the element's text as the context.
  3. If a match is returned by the model, it is highlighted within the page along with the confidence score returned by the model.

Architecture

There are three main components that interact via Message Passing to orchestrate the extension:

  1. Popup (popup.js): React application that renders the search bar, controls searching and iterating through the results.
  2. Content Script (content.js): Runs in the context of the current tab, responsible for reading from and manipulating the DOM.
  3. Background (background.js): Background script that loads and executes the TensorFlowJS model on question-context pairs.

src/js/message_types.js contains the messages used to interact between these three components.

Development

Make sure you have these dependencies installed.

  1. Node
  2. Yarn
  3. Prettier

Then run:

make develop

The unpacked extension will be placed inside of build/. See Google Chrome Extension developer documentation to load the unpacked extension into your Chrome browser in development mode.

Publishing

make build

A zipped extension file ready for upload will be placed inside of dist/.

shift-ctrl-f's People

Contributors

alanrice avatar efferifick avatar magicseth avatar siddhartpai avatar yoavz avatar

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.