I tried running python -m summpy.server -h 127.0.0.1 -p 8080

I wanted to try a library called summpy and ran it locally. The environment is Mac.

pip install summpy fails

I tried to install summpy, but it failed.

sudo pip install summpy
Password:
The directory '/Users/pugiemonn/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/pugiemonn/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting summpy
Collecting networkx (from summpy)
  Downloading networkx-1.11-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 966kB/s 
Requirement already satisfied (use --upgrade to upgrade): numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from summpy)
Requirement already satisfied (use --upgrade to upgrade): scipy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from summpy)
Collecting cherrypy (from summpy)
Collecting scikit-learn (from summpy)
  Downloading scikit_learn-0.18-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (7.1MB)
    100% |████████████████████████████████| 7.1MB 89kB/s 
Collecting decorator>=3.4.0 (from networkx->summpy)
  Downloading decorator-4.0.10-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from cherrypy->summpy)
Installing collected packages: decorator, networkx, cherrypy, scikit-learn, summpy
Exception:
Traceback (most recent call last):

Abbreviation

It seems that I failed due to lack of scikit-learn and so on.

Install package

It seems that numpy must also be included, so I installed it with brew referring to the searched site.

brew install gcc
brew update
brew install numpy
brew link --overwrite numpy

I forgot to make a note of the site that referred to the above, and it is just a log.

Next is to install summpy with pip.

sudo pip install scikit-learn
sudo pip install cherrypy summpy

If you start the server here

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Library/Python/2.7/site-packages/summpy/server.py", line 11, in <module>
    from . import tools
  File "/Library/Python/2.7/site-packages/summpy/tools.py", line 66, in <module>
    from .misc.janome_segmenter import word_segmenter_ja
  File "/Library/Python/2.7/site-packages/summpy/misc/janome_segmenter.py", line 5, in <module>
    from janome.tokenizer import Tokenizer
ImportError: No module named janome.tokenizer

It is said that there is no janome.

sudo pip install janome

I also added janome.

Start the server

Try starting the server.

python -m summpy.server -h 127.0.0.1 -p 8080

This time it was successful.

Quick-start


curl http://127.0.0.1:8080/summarize\?sent_limit\=3\&text\=Enter the text you want to summarize.

If you throw it like this, it will summarize the sentence. Amazing (☝՞ ਊ՞)

Local confirmation

When using curl, I have to worry about line breaks, so I felt it was easier to use the provided GUI (local URL below).

http://localhost:8080/static/test.html

Impressions

At first I imagined that it would make a completely different summary sentence, but it seems that it only extracts a part of the long sentence. Still, it was wonderful and impressed to summarize the long sentence in a few lines.

reference

Recommended Posts

I tried running python -m summpy.server -h 127.0.0.1 -p 8080
I tried Grumpy (Go running Python).
I tried running prolog with python 3.8.2.
I tried running pymc
I tried Python> autopep8
I tried running faiss with python, Go, Rust
I tried running Deep Floor Plan with Python 3.6.10.
I tried running alembic, a Python migration tool
I tried Python> decorator
I tried running TensorFlow
I tried running python etc. from a bat file
[Python] I tried running a local server using flask
I tried fp-growth with python
I tried scraping with Python
I tried Python C extension
[Python] I tried using OpenPose
I tried gRPC with Python
I tried scraping with python
I tried running Movidius NCS with python of Raspberry Pi3
I tried to touch Python (installation)
I tried web scraping with python.
I tried using Thonny (Python / IDE)
I tried Line notification in Python
I tried SMTP communication with Python
[Python] I tried using YOLO v3
I tried to summarize Python exception handling
I tried to implement PLSA in Python
I tried to implement permutation in Python
Wrangle x Python book I tried it [2]
I tried scraping Yahoo News with Python
I tried to implement PLSA in Python 2
I tried using Bayesian Optimization in Python
I tried non-photorealistic rendering with Python + opencv
I tried using UnityCloudBuild API from Python
I tried to implement ADALINE in Python
I tried a functional language with Python
I tried recursion with Python ② (Fibonacci sequence)
I tried to implement PPO in Python
Python: I tried the traveling salesman problem
Wrangle x Python book I tried it [1]
Mayungo's Python Learning Episode 8: I tried input
[Python] I tried to calculate TF-IDF steadily
I tried scraping Yahoo weather (Python edition)
I tried to touch Python (basic syntax)
I tried the Python Tornado Testing Framework
#I tried something like Vlookup with Python # 2
I tried running two Jetson Nano hardware PWMs from the Jetson.GPIO Python library.
[Python / DynamoDB / boto3] List of operations I tried
I tried "smoothing" the image with Python + OpenCV
I tried hundreds of millions of SQLite with python
[Python] I tried substituting the function name for the function name
I tried web scraping using python and selenium
I tried object detection using Python and OpenCV
I tried playing a typing game in Python
I tried simulating the "birthday paradox" in Python
I tried the least squares method in Python
I tried running YOLO v3 on Google Colab
I tried Python! ] I graduated today from "What is Python! Python!"!
I tried L-Chika with Raspberry Pi 4 (Python edition)
I tried Jacobian and partial differential with python
I tried to get CloudWatch data with Python