Giter Club home page Giter Club logo

womol / answer.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ryhan/answer.js

0.0 2.0 0.0 625 KB

Better in-page search using natural queries, implemented client-side with a Porter-stemmer, part of speech tagger and naive tokenizer. Reads current/specified page content and identifies passages that contain answers to user queries.

Home Page: http://ryhan.github.io/answer.js/search.html

CoffeeScript 0.38% HTML 4.80% JavaScript 93.98% CSS 0.84%

answer.js's Introduction

answer.js

Better in-page search, created by Ryhan Hassan.

Usage

Include the following libraries

<script src="lib/jquery.js"></script>
<script src="lib/underscore.js"></script>
<script src="lib/natural.js"></script>
<script src="lib/jspos/lexer.js"></script>
<script src="lib/jspos/lexicon.js_"></script>
<script src="lib/jspos/POSTagger.js"></script>
<script src="answer.js"></script>

Preprocess the article

Create a new answer object, and run read() on any text.

reader = new answer();
reader.read($('article').text());

Query with questions

Running match( text ) will return an array of sentences in descending rank with their rank.

var answers = reader.match("What is the longevity of a soap bubble limited by?");

// Log the top answer, formatted as [score, text]
console.log(answers[0]);

Demos

  • demo.html logs the top answer to the console
  • search.html is a demo with a styled search field.

answer.js's People

Contributors

ryhan avatar

Watchers

James Cloos avatar  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.