{"id":13660968,"url":"https://github.com/vipul-sharma20/sharingan","last_synced_at":"2025-04-11T13:07:58.545Z","repository":{"id":76064499,"uuid":"83690473","full_name":"vipul-sharma20/sharingan","owner":"vipul-sharma20","description":"Tool to extract news articles from newspaper and give the context about the news","archived":false,"fork":false,"pushed_at":"2017-08-17T09:38:52.000Z","size":27,"stargazers_count":210,"open_issues_count":1,"forks_count":26,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-10T14:46:53.467Z","etag":null,"topics":["context-extraction","news-extraction","nlp","opencv"],"latest_commit_sha":null,"homepage":"http://www.vipul.xyz/2017/03/sharingan-newspaper-text-and-context.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vipul-sharma20.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-03-02T15:02:18.000Z","updated_at":"2024-12-03T21:13:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"b9e7cd68-c57a-4c0f-9857-71d2c6264b0b","html_url":"https://github.com/vipul-sharma20/sharingan","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vipul-sharma20%2Fsharingan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vipul-sharma20%2Fsharingan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vipul-sharma20%2Fsharingan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vipul-sharma20%2Fsharingan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vipul-sharma20","download_url":"https://codeload.github.com/vipul-sharma20/sharingan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248404582,"owners_count":21097778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["context-extraction","news-extraction","nlp","opencv"],"created_at":"2024-08-02T05:01:28.056Z","updated_at":"2025-04-11T13:07:58.516Z","avatar_url":"https://github.com/vipul-sharma20.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"Sharingan\n=========\n\n[![Build Status](https://travis-ci.org/vipul-sharma20/sharingan.svg?branch=master)](https://travis-ci.org/vipul-sharma20/sharingan)\n[![Docker Automated build](https://img.shields.io/docker/automated/vipul20/sharingan.svg)]()\n\nSharingan is a tool built on Python 3.6 using OpenCV 3.2 to extract news\ncontent as text from newspaper’s photo and perform news context extraction.\n\nFor more details and explanation, please refer the blog post here: [http://vipul.xyz/2017/03/sharingan-newspaper-text-and-context.html](http://www.vipul.xyz/2017/03/sharingan-newspaper-text-and-context.html)\n\nHow it works?\n=============\n\nNews Extraction\n---------------\n\n\u003cp align=\"center\"\u003e\n    \u003cb\u003eCapture Image\u003c/b\u003e\n\u003c/p\u003e\n\n![Alt](https://i.imgur.com/6DklnQt.jpg)\n\n\u003cp align=\"center\"\u003e\n    \u003cb\u003eCanny Edge Detection\u003c/b\u003e\n\u003c/p\u003e\n\n![Alt](https://i.imgur.com/voDsUEg.jpg)\n\n\u003cp align=\"center\"\u003e\n    \u003cb\u003eDilation\u003c/b\u003e\n\u003c/p\u003e\n\n![Alt](https://i.imgur.com/zMq2vgH.jpg)\n\n\u003cp align=\"center\"\u003e\n    \u003cb\u003eContour Detection\u003c/b\u003e\n\u003c/p\u003e\n\n![Alt](https://i.imgur.com/zbh5UAV.jpg)\n\n\u003cp align=\"center\"\u003e\n    \u003cb\u003eContour Approximation and Bound Box\u003c/b\u003e\n\u003c/p\u003e\n\n![Alt](https://i.imgur.com/LSR98LW.jpg)\n\nManual Mode\n-----------\n\n![Alt](https://cdn-images-1.medium.com/max/1600/1*6KKm4wGknXonl54dUD6tjQ.gif \"drag\")\n\n![Alt](https://cdn-images-1.medium.com/max/1600/1*_pOvzvVLvHvcgrpxQL9XeA.gif \"thresh\")\n\nContext Extraction\n------------------\n\nThe segmentation done above gives the following result after context extraction:\n\n        [‘residential terraces’, ‘busy markets’, ‘Puppies’, ‘inhumane conditions’, ‘popular e-commerce sites’, ‘Sriramapuram’, ‘Russell Market’, ‘issue licences’,\n        ‘meeting conditions’, ‘positive impact’, ‘pet owners’, ‘R. Shantha Kumar’, ‘welfare ofﬁcer’, ‘Animal Welfare Board’, ‘India’]\n        [‘Kittie’]\n        [‘Compassion Unlimited’]\n        [‘public spaces’, ‘Animal’, ‘rights activists’, ‘civic body’, ‘Bengaluru’],\n        [‘BENGALURU’, ‘Bruhat Bengaluru Mahanagar Palike’, ‘Dane’, ‘English Mastiff’, ‘Bulldog’, ‘Boxer’, ‘Rottweiler’, ‘Bernard’, ‘Shepherd’, ‘Retriever’,\n        ‘draft guidelines’, ‘sterilisation’, ‘pet dogs ’, ‘Owners’]\n\n\nInstallation\n============\n\nInstalling OpenCV 3.2 from source Python 3.6\n--------------------------------------------\n\n* `wget https://github.com/Itseez/opencv/archive/3.2.0.zip`\n* `unzip 3.2.0.zip`\n* `cd opencv-3.2.0`\n* `mkdir release \u0026\u0026 cd release`\n\n        cmake -DBUILD_TIFF=ON \\\n            -DBUILD_opencv_java=OFF \\\n            -DWITH_CUDA=OFF \\\n            -DENABLE_AVX=ON \\\n            -DWITH_OPENGL=ON \\\n            -DWITH_OPENCL=ON \\\n            -DWITH_IPP=OFF \\\n            -DWITH_TBB=ON \\\n            -DWITH_EIGEN=ON \\\n            -DWITH_V4L=ON \\\n            -DWITH_VTK=OFF \\\n            -DBUILD_TESTS=OFF \\\n            -DBUILD_PERF_TESTS=OFF \\\n            -DCMAKE_BUILD_TYPE=RELEASE \\\n            -DBUILD_opencv_python2=OFF \\\n            -DCMAKE_INSTALL_PREFIX=$(python3.6 -c \"import sys; print(sys.prefix)\") \\\n            -DPYTHON3_EXECUTABLE=$(which python3.6) \\\n            -DPYTHON3_INCLUDE_DIR=$(python3.6 -c \"from distutils.sysconfig import get_python_inc; print(get_python_inc())\") \\\n            -DPYTHON3_PACKAGES_PATH=$(python3.6 -c \"from distutils.sysconfig import get_python_lib; print(get_python_lib())\") ..\n\n* The output of above will be similar to this: [output](https://gist.github.com/vipul-sharma20/d57a779619f22b2254b66c89c957faf2)\n* `make -j4`\n* make install\n\nSetting up Sharingan\n--------------------\n\n* `git clone git@github.com:vipul-sharma20/sharingan.git`\n* `pip install -r requirements.txt`\n\n**IMPORTANT:** You will require some corpora and trained models\nfor the code to run. You can refer to: [http://www.nltk.org/data.html](http://www.nltk.org/data.html)\n\n* Interactive Method:\n\n        In [1]: import nltk\n\n        In [2]: nltk.download()\n\nDocker\n======\n\nTry out the code on Jupyter Notebook\n\n* `docker build -t sharingan-docker .`\n* `docker run -p 8888:8888 -it sharingan-docker`\n\nThanks to\n=========\n\nI am no wizard. Big thanks to people who came up with these solutions and posts:\n\n* [https://erget.wordpress.com/](https://erget.wordpress.com/2014/03/13/building-an-interactive-gui-with-opencv/)\n* [https://www.scivision.co/](https://www.scivision.co/anaconda-python-opencv3/)\n* [https://enumap.wordpress.com/](https://enumap.wordpress.com/2012/11/23/python-opencv-resize-image/)\n* [http://stackoverflow.com/questions/15341538/](http://stackoverflow.com/questions/15341538/numpy-opencv-2-how-do-i-crop-non-rectangular-region)\n* [http://stackoverflow.com/questions/30310430/](http://stackoverflow.com/questions/30310430/opencv-draw-a-rectangle-in-a-picture-were-never-shown)\n* [http://www.pyimagesearch.com/](http://www.pyimagesearch.com/2015/02/09/removing-contours-image-using-python-opencv/)\n* [http://to.predict.ch/](http://to.predict.ch/hacking/2017/02/12/opencv-with-docker.html)\n\nThe Name?\n=========\n\nSee here: [Sharingan](http://naruto.wikia.com/wiki/Sharingan)\n\nLICENSE\n=======\n\nThis project is licensed under MIT License:\n\nCopyright (c) 2017-2018: Vipul Sharma\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nThis project uses following external libraries, which have their own licenses:\n\n* NLTK (https://github.com/nltk/nltk/blob/develop/LICENSE.txt) [Apache]\n* OpenCV (https://github.com/opencv/opencv/blob/master/LICENSE) [BSD]\n* NumPy (https://github.com/numpy/numpy/blob/master/LICENSE.txt)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvipul-sharma20%2Fsharingan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvipul-sharma20%2Fsharingan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvipul-sharma20%2Fsharingan/lists"}