New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

text-summarisation

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

text-summarisation

Summarize text according to specific sentence and translate tp any language

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Summarize Texts

This package can be used to summarize longs texts to custom summarized sentence.

How to use?

install the package

using npm

npm install text-summarize

using yarn

yarn add text-summarize

Usage

You can just simply call the function and get the summary of the text without passing your target sentence.


const summarize = require("text-summarize");

const text = "Alice and Bob are friends. Alice is fun and cuddly. Bob is cute and quirky. Together they go on wonderful adventures in the land of tomorrow. Alice's cuddliness and Bob's cuteness allow them to reach their goals. But before they get to them, they have to go past their mortal enemy — Mr. Boredom. He is ugly and mean. They will surely defeat him. He is no match for their abilities.";

// summarize function returns a Promise
summarize(text).then(data => console.log(data));
// output: Alice and Bob are friends. Alice is fun and cuddly. Bob is cute and quirky. Together they go on wonderful adventures in the land of tomorrow. Alice's cuddliness and Bob's cuteness allow them to reach their goals. But before they get to them, they have to go past their mortal enemy — Mr. Boredom. He is ugly and mean. They will surely defeat him. He is no match for their abilities.

You can pass custom target sentence that you want after summarize the text.


const summarize = require("text-summarize");

const text = "Alice and Bob are friends. Alice is fun and cuddly. Bob is cute and quirky. Together they go on wonderful adventures in the land of tomorrow. Alice's cuddliness and Bob's cuteness allow them to reach their goals. But before they get to them, they have to go past their mortal enemy — Mr. Boredom. He is ugly and mean. They will surely defeat him. He is no match for their abilities.";

// summarize function returns a Promise
summarize(text, { sentences: 2 }).then(data => console.log(data));
// output: Alice and Bob are friends. Alice's cuddliness and Bob's cuteness allow them to reach their goals.

You can pass language to translate the summarized text.


const summarize = require("text-summarize");

const text = "Alice and Bob are friends. Alice is fun and cuddly. Bob is cute and quirky. Together they go on wonderful adventures in the land of tomorrow. Alice's cuddliness and Bob's cuteness allow them to reach their goals. But before they get to them, they have to go past their mortal enemy — Mr. Boredom. He is ugly and mean. They will surely defeat him. He is no match for their abilities.";

// summarize function returns a Promise
summarize(text, { sentences: 2, translate: 'bn' }).then(data => console.log(data));
// output: এলিস এবং বব বন্ধু। অ্যালিসের কুশ্রীতা এবং বব এর কর্তৃত্ব তাদেরকে তাদের লক্ষ্যে পৌছাতে দেয়।

The options can be


const options = {
  sentences: 2, // return specific lines of summary
  translate: 'bn' // translate the summary into the target language
}
summarize(text, options).then(data => console.log(data));

Defaults

  • sentence is set to 10.

Keywords

FAQs

Package last updated on 16 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc