GithubHelp home page GithubHelp logo

ageitgey / node-pullquoter Goto Github PK

View Code? Open in Web Editor NEW
114.0 9.0 10.0 57 KB

Automatically pull interesting quotes out of an article.

License: BSD 3-Clause "New" or "Revised" License

JavaScript 0.98% CoffeeScript 77.52% Makefile 21.50%

node-pullquoter's Introduction

Pullquoter

Automatically pull interesting quotes out of an article.

Build Status

You've probably seen pull quotes like this in online articles:

Well, until now a human being had to spend several moments choosing which quotes to feature. This node module uses basic text summarization techniques to find interesting sentences to use as pull quotes automatically.

Why would I want this?

  • Spice up your website with cool pull quotes without any real work
  • Make a clone of Rotten Tomatoes that is totally automated but still has cool review snippets.
  • Maybe you are so busy that you only have time to read one sentence of any article?

Credits / Thanks

This node module uses an improved version of the algorithm presented in the article Build your own summary tool! by Shlomi Babluki. However, this module is improved in both capability and efficency.

Install

To install the command-line pullquoter utility:

npm install -g pullquoter

To install the pullquoter module for use in your Node.js project:

npm install --save pullquoter

Usage

You can use pullquoter from node or right on the command line!

Command line interface

You can pass text to pullquoter and it will pull out interesting sentences.

You can either pass in a file name:

pullquoter my_file.txt

Or you can pipe it in:

cat my_file.txt | pullquoter

By default, it returns one interesting sentence. If you want more, use the -n parameter:

pullquoter -n 10 my_file.txt

You can easily chain this together with other unix commands to do cool stuff. For example, you can download a web page, and then use unfluff to grab the page text and jq to pull out the body test. Then just pass it to pullquoter and get sentences!

curl -s "http://www.polygon.com/2014/6/26/5842180/shovel-knight-review-pc-3ds-wii-u" | unfluff | jq -r .text | pullquoter
It's not just the mechanics of old-school games that Shovel Knight nails, though; it also has that undefinable, metaphysical look and feel of an NES classic.

Module Interface

pullquoter(text, numberOfQuotesToPull)

text: The text you want to parse. This should be plain text in English.

numberOfQuotesToPull (default: 1): The number of sentences to pull out of the article

pullquoter = require('pullquoter');

quotes = pullquoter(myText);

Or pass in how mant quotes you want:

pullquoter = require('pullquoter');

quotes = pullquoter(myText, 10);

Limitations / Problems / TODO

  • This only works for English. The stopwords, stemmer and tokenized currently only support English. It could be expanded for other western languages pretty easily, though.
  • This module has a runtime of something like O(n^2/2) where n is the number of sentences in the text. So maybe don't run it on a huge piece of text.
  • If you are doing something serious, maybe look into a better text summarization algorithm.

node-pullquoter's People

Contributors

ageitgey avatar bradvogel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-pullquoter's Issues

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.