{ "info": { "author": "Harshit Sanghvi", "author_email": "hello@sanghviharshit.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Auto Pocket Tagger\n\nUse Google cloud's Natural Language Processing API to automatically analyze the webpage from articles saved in your Pocket list, derive tags/keywords based on the content of the page, and add tags to the articles in Pocket list for free.\n\n> Pocket has suggested tags service for their paid premium plans. You can find more about it [here](https://help.getpocket.com/article/906-pocket-premium-suggested-tags). This still requires manual work of adding the tags to each article one-by-one. This package automates all of it for free.\n\n## Features\n- Uses [Python wrapper](https://github.com/tapanpandita/pocket) for [Pocket API](http://getpocket.com/api/docs) to retrieve articles in the `My List`\n- Uses [Beautiful Soup](https://www.crummy.com/software/BeautifulSoup/) to scrape webpages\n- Uses Google Cloud's [Natural Language Processing API](https://cloud.google.com/natural-language/) to generate list of categories and entities from the content of the webpage\n- Uses Pocket API to add tags to articles in your `My List`\n\n\n## Usage\n\n### Installation\n\n#### Install published version from pypi\n```shell\n$ pip install pocket-tagger\n```\n\n#### Install latest version from git\n```shell\n$ pip install git+https://github.com/sanghviharshit/pocket-tagger\n```\n\n\n### Prerequisites\n#### [Google Cloud](https://cloud.google.com/natural-language/docs/quickstart)\n\nThis package relies on Google cloud natural language processing API, which requires billing enabled on your project.\nYou can find the quickstart instructions [here](https://cloud.google.com/natural-language/docs/quickstart)\n**Options:**\n1. Create a service account and download the credentials file - https://cloud.google.com/video-intelligence/docs/common/auth\n```python\ntagger = PocketTagger(gcloud_credentials_file=\"gcloud_credentials_file.json\")\n```\n2. or Configure gloud locally - https://cloud.google.com/sdk/gcloud/reference/init\n```python\ntagger = PocketTagger()\n```\n\n#### [Pocket API](https://getpocket.com/developer/)\n\nTo fetch the articles list and add tags, you need a developer key from [here](https://getpocket.com/developer/)\nCreate a new Application with `modify` and `retrieve` permissions. Save the Consumer Key and Access Token.\n```python\ntagger = PocketTagger(consumer_key='your-consumer-key',\n access_token='your-access-token')\n```\n\n### [Examples](./examples)\n\n```python\n# Initialize PocketTagger with GCloud and Pocket API Credentials\ntagger = PocketTagger(gcloud_credentials_file=\"gcloud_credentials_file.json\",\n consumer_key='pocket-consumer-key',\n access_token='pocket-access-token')\n\n# Check https://getpocket.com/developer/docs/v3/retrieve for additional list of options you can pass for retrieving pocket list\narticles = tagger.get_articles_from_api(count=10, offset=10, detailType='complete')\n\n# Alternatively you can load the articles from file if you saved them previously using save_articles_to_file\n# articles = tagger.get_articles_from_file(\"20190621.json\")\n# Generate tags for each article\narticles_with_tags = tagger.get_tags_for_articles(articles)\n\n# Save the articles with tags to file. You can use this file to verify it looks good before running the final step to tag the articles.\ntagger.save_articles_to_file(today.strftime('%Y%m%d-with-tags.json'), articles_with_tags)\n\n# You can skip this step if you want to do a dry run. Verify the tags in the file we generated in the previous step.\ntagger.add_tags_to_articles(articles_with_tags)\n```\n\n### Optional overrides\nYou can override the default thresholds for [entity](https://cloud.google.com/natural-language/docs/reference/rest/v1/Entity\n) salience and [category](https://cloud.google.com/natural-language/docs/reference/rest/v1/ClassificationCategory) confidence\n\n```python\nthresholds = {\n 'entity_salience_threshold': 0.7\n 'category_confidence_threshold': 0.3\n}\narticles_with_tags = tagger.get_tags_for_articles(articles, thresholds)\n```\n\n## Sample\n\nSample output from running it for my 490 items long Pocket list\n> `X` under Entities or Categories denotes the NLP client returned those as potential candidates, but we skipped them because it didn't meet the threshold. You can see the last line `Tags: abc, xyz` for list of tags pocket-tagger added for each URL.\n\n```\n(1/490) https://www.reddit.com/r/explainlikeimfive/comments/bvweym/eli5_why_do_coffee_drinkers_feel_more_clear/?utm_source=share&utm_medium=ios_app\n Title: ELI5: Why do coffee drinkers feel more clear headed after consuming caffeine? Why do some get a headache without it? Does caffeine cause any permanent brain changes and can the brain go back to 'normal' after years of caffeine use? : explainlikeimfive\n Description: r/explainlikeimfive: **Explain Like I'm Five is the best forum and archive on the internet for layperson-friendly explanations.**   Don't Panic!\n Entities:\n X Coffee Drinkers: 0.2438652664422989\n X Eli5: 0.14941969513893127\n X Caffeine: 0.12065556645393372\n X Caffeine: 0.0874909833073616\n X Some: 0.06917785853147507\n X Headache: 0.0606028214097023\n X Brain: 0.03606536239385605\n X Explainlikeimfive: 0.033727116882801056\n X Brain Changes: 0.03211209550499916\n X Caffeine Use: 0.029848895967006683\n X R: 0.02966366335749626\n X Forum: 0.028598546981811523\n X Internet: 0.022404097020626068\n X Archive: 0.022404097020626068\n X Explainlikeimfive: 0.017647551372647285\n X Don'T Panic: 0.009302889928221703\n X Five: 0.007013489492237568\n X Five: 0.0\n Categories:\n /Food & Drink/Beverages/Coffee & Tea: 0.6700000166893005\n Tags: Food & Drink, Beverages, Coffee & Tea\n(2/490) https://www.reddit.com/r/television/comments/bnpwe3/enjoy_three_full_minutes_of_the_cast_of_game_of/?utm_source=share&utm_medium=ios_app\n Title: Enjoy three full minutes of the cast of 'Game of Thrones' expressing disappointment in Season 8. : television\n Description: r/television:\n Entities:\n X Cast: 0.31218624114990234\n X Disappointment: 0.20341947674751282\n X Season: 0.20341947674751282\n X Game Of Thrones: 0.13265934586524963\n X Television: 0.08712445199489594\n X Television: 0.06119102984666824\n X 8: 0.0\n X Three: 0.0\n Categories:\n /Arts & Entertainment/TV & Video/TV Shows & Programs: 0.75\n Tags: Arts & Entertainment, TV & Video, TV Shows & Programs\n(3/490) https://www.reddit.com/r/homeautomation/comments/awvf5r/local_realtime_person_detection_for_rtsp_cameras/\n Title: Local realtime person detection for RTSP cameras : homeautomation\n Description: r/homeautomation: A subreddit focused on automating your home, housework or household activity. Sensors, switches, cameras, locks, etc. Any \u2026\n Entities:\n X Realtime Person Detection: 0.3057926297187805\n X Homeautomation: 0.15315502882003784\n X Cameras: 0.14035314321517944\n X Rtsp: 0.07461880147457123\n X Homeautomation: 0.051411159336566925\n X Home: 0.047811269760131836\n X Housework: 0.04366889223456383\n X Subreddit: 0.04183248057961464\n X R: 0.04132793843746185\n X Cameras: 0.032860007137060165\n X Locks: 0.028899790719151497\n X Household Activity: 0.012798599898815155\n X Switches: 0.012735127471387386\n X Sensors: 0.012735127471387386\n Categories:\n /Computers & Electronics: 0.7900000214576721\n Tags: Computers & Electronics\n```\n\n## References\n- [Pocket API Wrapper for Python](https://github.com/tapanpandita/pocket)\n- [Pocket API Docs](http://getpocket.com/api/docs)\n- [Google Cloud Natural Language Processing](https://cloud.google.com/natural-language/)\n- [Beautiful Soup](https://www.crummy.com/software/BeautifulSoup/)\n- [Complete list of content categories from Google Natural Language API](https://cloud.google.com/natural-language/docs/categories)", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/sanghviharshit/pocket-tagger", "keywords": "getpocket,pocket,api,articles,automatic,suggested,tag,natural language processing,nlp", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pocket-tagger", "package_url": "https://pypi.org/project/pocket-tagger/", "platform": "", "project_url": "https://pypi.org/project/pocket-tagger/", "project_urls": { "Bug Reports": "https://github.com/sanghviharshit/pocket-tagger/issues", "Homepage": "http://github.com/sanghviharshit/pocket-tagger", "Say Thanks!": "https://saythanks.io/to/sanghviharshit", "Source": "https://github.com/sanghviharshit/pocket-tagger" }, "release_url": "https://pypi.org/project/pocket-tagger/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "Tag your pocket articles from getpocket.com automatically using NLP", "version": "0.1.1" }, "last_serial": 5459384, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "b727d56abe91f039a7d59dfb2dd9104f", "sha256": "54544281fc53a6a52fa528c06944fb72fd0200397db9fbec4e85e0894f766caf" }, "downloads": -1, "filename": "pocket-tagger-0.1.0.tar.gz", "has_sig": false, "md5_digest": "b727d56abe91f039a7d59dfb2dd9104f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8111, "upload_time": "2019-06-27T23:05:23", "url": "https://files.pythonhosted.org/packages/c2/5f/b2cacab4a1d0cc504720ba5a931aec0f83b687a081eecfd1aa27f91b5782/pocket-tagger-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "efa89980db80d221dcbb09d1e76c4903", "sha256": "0ae5a7868c331b504cafb46596278d6f638b337d5aef9f23c443fde47414555f" }, "downloads": -1, "filename": "pocket-tagger-0.1.1.tar.gz", "has_sig": false, "md5_digest": "efa89980db80d221dcbb09d1e76c4903", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8106, "upload_time": "2019-06-27T23:30:14", "url": "https://files.pythonhosted.org/packages/ec/b3/cf84b113b5d1b495779b70bc04a1454e8a2d0af47452960cd03cf704ac71/pocket-tagger-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "efa89980db80d221dcbb09d1e76c4903", "sha256": "0ae5a7868c331b504cafb46596278d6f638b337d5aef9f23c443fde47414555f" }, "downloads": -1, "filename": "pocket-tagger-0.1.1.tar.gz", "has_sig": false, "md5_digest": "efa89980db80d221dcbb09d1e76c4903", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8106, "upload_time": "2019-06-27T23:30:14", "url": "https://files.pythonhosted.org/packages/ec/b3/cf84b113b5d1b495779b70bc04a1454e8a2d0af47452960cd03cf704ac71/pocket-tagger-0.1.1.tar.gz" } ] }