Comments (2)
You can pick from the summary anything you want by providing custom function. The function gets collection if SentenceInfo
objects.
# -*- coding: utf-8 -*-
from sumy.parsers.html import HtmlParser
from sumy.nlp.tokenizers import Tokenizer
from sumy.summarizers.lsa import LsaSummarizer as Summarizer
from sumy.nlp.stemmers import Stemmer
from sumy.utils import get_stop_words
LANGUAGE = "english"
def pick_sentences(infos: list[SentenceInfo]):
# your algorithm here
return [] # any SentenceInfo objects you want to pick
if __name__ == "__main__":
url = "https://en.wikipedia.org/wiki/Automatic_summarization"
parser = HtmlParser.from_url(url, Tokenizer(LANGUAGE))
stemmer = Stemmer(LANGUAGE)
summarizer = Summarizer(stemmer)
summarizer.stop_words = get_stop_words(LANGUAGE)
for sentence in summarizer(parser.document, pick_sentences):
print(sentence)
from sumy.
@Archkik does this work for your use-case? Is your issue different somehow? Can you describe what you are trying to achieve then?
from sumy.
Related Issues (20)
- Summarising books by verbs HOT 4
- A HuggingFace space for sumy HOT 2
- Luhn's summarizer 'significant percentage' comment HOT 2
- how to remove sentences from ODM HOT 4
- power_method produces NaN, inf values HOT 1
- Is it possible to get how many texts summarized by the summarizer? HOT 7
- replace docpot with docopt-ng HOT 3
- What is the point of Docker image ? HOT 1
- wrong question HOT 1
- Console being spammed when using library. HOT 5
- PlaintextParser incompatibility with Python 3.10, easy fix HOT 2
- Prepare for NumPy v2
- Tip: how to make it summarize mid-tail languages, e.g. Polish HOT 2
- Division by zero by rouge.py, only in some algos HOT 1
- Lowercase of all languages needed in utils.py HOT 1
- Would you like to start adding type annotations to this project? HOT 1
- 包含 阿拉伯数字+字母大写 的文本内容 某些情况 摘录为空 HOT 2
- punkt doesn't work as of nltk 3.8.2 HOT 1
- Unable to run sumy in Jupyter Notebook
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sumy.