forked from summanlp/textrank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
127 lines (88 loc) · 4.1 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
================
summa – textrank
================
TextRank implementation for text summarization and keyword extraction in Python 3,
with `optimizations on the similarity function <https://arxiv.org/pdf/1602.03606.pdf>`_.
Features
--------
* Text summarization
* Keyword extraction
Examples
--------
Text summarization::
>>> text = """Automatic summarization is the process of reducing a text document with a
computer program in order to create a summary that retains the most important points
of the original document. As the problem of information overload has grown, and as
the quantity of data has increased, so has interest in automatic summarization.
Technologies that can make a coherent summary take into account variables such as
length, writing style and syntax. An example of the use of summarization technology
is search engines such as Google. Document summarization is another."""
>>> from summa import summarizer
>>> print(summarizer.summarize(text))
'Automatic summarization is the process of reducing a text document with a computer
program in order to create a summary that retains the most important points of the
original document.'
Keyword extraction::
>>> from summa import keywords
>>> print(keywords.keywords(text))
document
summarization
writing
account
Installation
------------
This software depends on `NumPy <http://www.numpy.org/>`_ and `Scipy <https://www.scipy.org/>`_,
two Python libraries for scientific computing.
Pip will automatically install them along with `summa`::
pip install summa
For a better performance of keyword extraction, install `Pattern <http://www.clips.ua.ac.be/pattern>`_.
More examples
-------------
- Command-line usage::
textrank -t FILE
- Define length of the summary as a proportion of the text (also available in :code:`keywords`)::
>>> from summa.summarizer import summarize
>>> summarize(text, ratio=0.2)
- Define length of the summary by aproximate number of words (also available in :code:`keywords`)::
>>> summarize(text, words=50)
- Define input text language (also available in :code:`keywords`):
The available languages are danish, dutch, english, finnish, french, german,
hungarian, italian, norwegian, porter, portuguese, romanian, russian, spanish,
swedish.
>>> summarize(text, language='spanish')
- Get results as a list (also available in :code:`keywords`)::
>>> summarize(text, split=True)
['Automatic summarization is the process of reducing a text document with a
computer program in order to create a summary that retains the most important
points of the original document.']
References
-------------
- Mihalcea, R., Tarau, P.:
`"Textrank: Bringing order into texts" <http://www.aclweb.org/anthology/W04-3252>`__.
In: Lin, D., Wu, D. (eds.)
Proceedings of EMNLP 2004. pp. 404–411. Association for Computational Linguistics,
Barcelona, Spain. July 2004.
- Barrios, F., López, F., Argerich, L., Wachenchauzer, R.:
`"Variations of the Similarity Function of TextRank for Automated Summarization" <https://arxiv.org/pdf/1602.03606.pdf>`__.
Anales de las 44JAIIO.
Jornadas Argentinas de Informática, Argentine Symposium on Artificial Intelligence, 2015.
To cite this work::
@article{DBLP:journals/corr/BarriosLAW16,
author = {Federico Barrios and
Federico L{\'{o}}pez and
Luis Argerich and
Rosa Wachenchauzer},
title = {Variations of the Similarity Function of TextRank for Automated Summarization},
journal = {CoRR},
volume = {abs/1602.03606},
year = {2016},
url = {http://arxiv.org/abs/1602.03606},
archivePrefix = {arXiv},
eprint = {1602.03606},
timestamp = {Wed, 07 Jun 2017 14:40:43 +0200},
biburl = {https://dblp.org/rec/bib/journals/corr/BarriosLAW16},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
-------------
Summa is open source software released under the `The MIT License (MIT) <http://opensource.org/licenses/MIT>`_.
Copyright (c) 2014 – now Summa NLP.