{ "info": { "author": "swen128", "author_email": "fujjisaaan@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Text Processing" ], "description": "twitter-text-python\n===================\n\n.. image:: https://readthedocs.org/projects/twitter-text-python/badge/?version=latest\n :target: https://twitter-text-python.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n.. image:: https://travis-ci.com/swen128/twitter-text-python.svg?branch=master\n :target: https://travis-ci.com/swen128/twitter-text-python\n\nThis is a Python port of the `twitter/twitter-text`_ libraries, fully compliant with the `official conformance test suite`_.\n\n\nFeatures\n========\n\nThis library calculates length of a tweet message according to `the documentation from Twitter Developers`_,\nso that you can validate the tweet without calling the Web API at all.\nAlthough counting characters might seem an easy task, in actual fact it is very complicated, especially when the text contains CJK characters, URLs, or emojis.\n\nThe original twitter-text libraries have *hit-highlighting* and *auto-linking* features as well,\nhowever they are not yet supported by this Python port.\n\n\nUsage\n=====\n\nInstallation\n------------\n\n.. code-block:: console\n\n $ pip install twitter-text-parser\n\n\nExamples\n--------\n\nSee `the API reference `_ for more details.\n\n.. code-block:: python\n\n from twitter_text import parse_tweet, extract_emojis_with_indices, extract_urls_with_indices\n\n text = 'english text \u65e5\u672c\u8a9e \ud83d\ude37 https://example.com'\n\n assert parse_tweet(text).asdict() == {\n 'weightedLength': 46,\n 'valid': True,\n 'permillage': 164,\n 'validRangeStart': 0,\n 'validRangeEnd': 38,\n 'displayRangeStart': 0,\n 'displayRangeEnd': 38\n }\n\n assert extract_urls_with_indices(text) == [{\n 'url': 'https://example.com',\n 'indices': [19, 38]\n }]\n\n assert extract_emojis_with_indices(text) == [{\n 'emoji': '\ud83d\ude37',\n 'indices': [17, 18]\n }]\n\n\nRelated Links\n=============\n\n- `twitter/twitter-text`_: The original, official twitter-text implementations for Java, Ruby, JavaScript and Objective-C\n- `twitter-text Parser -- Twitter Developers`_: A brief overview of the twitter-text libraries\n- `Counting characters -- Twitter Developers`_: An introduction to how to count characters in Twitter texts\n- `edmondburnett/twitter-text-python`_: Another python port of twitter-text, which is not compliant with the `official conformance test suite`_\n\n\n.. _twitter/twitter-text: https://github.com/twitter/twitter-text\n.. _edmondburnett/twitter-text-python: https://github.com/edmondburnett/twitter-text-python\n.. _official conformance test suite: https://github.com/twitter/twitter-text/tree/master/conformance\n.. _search-api: https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets.html\n.. _Counting characters -- Twitter Developers: https://developer.twitter.com/en/docs/basics/counting-characters.html\n.. _the documentation from Twitter Developers: https://developer.twitter.com/en/docs/developer-utilities/twitter-text\n.. _twitter-text Parser -- Twitter Developers: https://developer.twitter.com/en/docs/developer-utilities/twitter-text", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/swen128/twitter-text-python", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "twitter-text-parser", "package_url": "https://pypi.org/project/twitter-text-parser/", "platform": "", "project_url": "https://pypi.org/project/twitter-text-parser/", "project_urls": { "Homepage": "https://github.com/swen128/twitter-text-python" }, "release_url": "https://pypi.org/project/twitter-text-parser/1.0.0/", "requires_dist": null, "requires_python": "~=3.5", "summary": "A library to parse or validate Twitter texts properly", "version": "1.0.0" }, "last_serial": 5591545, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "57da768044e625e4dace416a0911beec", "sha256": "072af5d03d6c2284ffb5ffdd6184eb0e20d72e8ddc834473951da315b636eb8e" }, "downloads": -1, "filename": "twitter-text-parser-0.0.1.tar.gz", "has_sig": false, "md5_digest": "57da768044e625e4dace416a0911beec", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.5", "size": 60800, "upload_time": "2019-07-27T01:48:05", "url": "https://files.pythonhosted.org/packages/57/d4/1cfdd183cd734111759618d767437d92c7cd8916ac068025434876569215/twitter-text-parser-0.0.1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "95ef4da80c069370040d76626ca2f732", "sha256": "4fc900ada947d5c02d3e4bf41d31fbe3fdda5e043982c477b7b7e99ff064c66a" }, "downloads": -1, "filename": "twitter-text-parser-1.0.0.tar.gz", "has_sig": false, "md5_digest": "95ef4da80c069370040d76626ca2f732", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.5", "size": 59588, "upload_time": "2019-07-27T02:20:19", "url": "https://files.pythonhosted.org/packages/a8/77/7c74b4228ec9249ecfc96a1a66fcfc2327677c66666262401f26517f5417/twitter-text-parser-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "95ef4da80c069370040d76626ca2f732", "sha256": "4fc900ada947d5c02d3e4bf41d31fbe3fdda5e043982c477b7b7e99ff064c66a" }, "downloads": -1, "filename": "twitter-text-parser-1.0.0.tar.gz", "has_sig": false, "md5_digest": "95ef4da80c069370040d76626ca2f732", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.5", "size": 59588, "upload_time": "2019-07-27T02:20:19", "url": "https://files.pythonhosted.org/packages/a8/77/7c74b4228ec9249ecfc96a1a66fcfc2327677c66666262401f26517f5417/twitter-text-parser-1.0.0.tar.gz" } ] }