Code Monkey home page Code Monkey logo

wanish's Introduction

Code Climate

About

This package allows you to summarize text by reducing an article in size to several sentences retaining the idea of the text.

Besides of that the package extracts the following from the document:

  1. Canonical URL of the article
  2. Title of the article
  3. URL of the image characterizing this article
  4. Strips the document of excessive information (headers, footers, navigation, advertisement, etc.) and forms a clean HTML based on structured data of schema.org

DEMO

Installation

easy_install wanish
or
pip install wanish

Usage

from wanish import Wanish
wanish = Wanish()
wanish.perform_url(document_url)

# getting doc's source canonical url
url = wanish.url
# getting document's title
title = wanish.title
# getting url of related image if document has it
image_url = wanish.image_url
# getting two-letter code of the document's language (en, de, es...)
language_code = wanish.language
# getting a clean html page of a document with article
clean_html = wanish.clean_html
# getting a short summarized description of the article reduced to several sentences (5 by default)
description = wanish.description

Available kwarg options for Wanish() class (all are optional):

wanish = Wanish(url=document_url,
                positive_keywords=["main", "story"],
                negative_keywords=["banner", "adv", "similar", "top-ad"],
                summary_sentences_qty=5,
                headers={'user-agent': 'test-purposes/0.0.1'})
  • url: Allows to pass an url of a document in constructor. If set, then it will automatically launch self.perform_url(url) after initialization. Default is None.
  • positive_keywords: A list of positive search patterns in classes and ids, for example: [“main”, “story”] . Default is None.
  • negative_keywords: A list of negative search patterns in classes and ids, for example: [“banner”, “adv”, “similar”, “top-ad”] . Default is None.
  • summary_sentences_qty: Maximum quantity of sentences in summarized text of the document. Set to 5 by default.
  • headers: Dict of additional custom headers for GET request to obtain web page of the article. Default is None.

Special Thanks

wanish's People

Contributors

neegor avatar szarekh avatar

Watchers

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