I wanted to try a library called summpy and ran it locally. The environment is Mac.
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.
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.
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 (☝՞ ਊ՞)
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
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.
Recommended Posts