Skip to content

Commit

Permalink
Updating setup for version 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fbarrios committed Jan 18, 2018
1 parent b92ee74 commit 21595dc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 24 deletions.
11 changes: 3 additions & 8 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
summa - textrank
================

TextRank_ implementation for text summarization and keyword extraction in Python. An online version can be tested `here <http://104.131.76.203>`_.
TextRank_ implementation for text summarization and keyword extraction in Python.

.. _TextRank: http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf

Expand Down Expand Up @@ -46,24 +46,19 @@ Installation
------------

This software depends on `NumPy and Scipy <http://www.scipy.org/Download>`_, two Python packages for scientific computing.
You must have them installed prior to installing `summa`::
Pip will automatically install them along with `summa`::

pip install summa


If you are going to use the export function, you also need `NetworkX <https://networkx.github.io/download.html>`_.
For a better performance of keyword extraction, install `Pattern <http://www.clips.ua.ac.be/pattern>`_

This version has been tested under Python 2.7


More examples
-------------

- Command-line usage::

cd path/to/folder/summa/
python textrank.py -t FILE
textrank -t FILE

- Define length of the summary as a proportion of the text (also available in :code:`keywords`)::

Expand Down
29 changes: 17 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
from distutils.core import setup
from setuptools import setup, find_packages

setup(
name = 'summa',
packages = ['summa', 'summa.preprocessing'],
packages = find_packages(exclude=['test']),
package_data = {
'summa': ['README', 'LICENSE']
},
version = '0.1.0',
description = 'A text summarization and keyword extraction package',
description = 'A text summarization and keyword extraction package based on textrank',
long_description=open('README').read(),
author = 'Federico Barrios, Federico Lopez',
author_email = '[email protected]',
url = 'https://github.com/summanlp/textrank',
download_url = 'https://github.com/summanlp/textrank/tarball/v0.1.0',
keywords = ['summa', 'nlp', 'summarization', "NLP", "natural language processing", "automatic summarization",
"keywords", "summary", "textrank", "pagerank"],
install_requires = [
'scipy >= 0.19'
],
python_requires = '>=2.7, <3.0',
classifiers = [
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 4 - Beta',
'Development Status :: 5 - Production/Stable',

'License :: OSI Approved :: MIT License',

Expand All @@ -29,9 +30,13 @@
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Text Processing :: Linguistic',

# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2.7'
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 2 :: Only'
],
long_description = open('README').read()
test_suite="test",
entry_points={
'console_scripts': [
'textrank = summa.textrank:main',
],
}
)
15 changes: 11 additions & 4 deletions summa/textrank.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@
WORD = 1


def exit_with_error(err):
print "Error: " + str(err)
usage()
sys.exit(2)

def get_arguments():
try:
opts, args = getopt.getopt(sys.argv[1:], "t:s:r:w:h", ["text=", "summary=", "ratio=", "words=", "help"])
except getopt.GetoptError as err:
print str(err)
usage()
sys.exit(2)
exit_with_error(err)

path = None
summarize_by = SENTENCE
ratio = 0.2
Expand All @@ -35,10 +39,13 @@ def get_arguments():
else:
assert False, "unhandled option"

if path is None:
exit_with_error("-t option is required.")

return path, summarize_by, ratio, words


help_text = """Usage: python textrank.py -t FILE
help_text = """Usage: textrank -t FILE
-s UNIT, --summary=UNIT:
\tType of unit to summarize: sentence (0) or word (1). Default value: 0
\t0: Sentence. 1: Word
Expand Down

0 comments on commit 21595dc

Please sign in to comment.