{ "info": { "author": "Tatsuya Nakamura", "author_email": "nkmrtty.com@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Topic :: Text Processing" ], "description": "trie-search\n===========\n\nTrie-search is a package for text pattern search using\n`marisa-trie `__.\n\nInstallation\n------------\n\n::\n\n $ pip install trie-search\n\nUsage\n-----\n\nCreate trie dictionary\n~~~~~~~~~~~~~~~~~~~~~~\n\nBefore using this package, you need to create trie dictionary, or\nprepare a list of patterns.\n\nThe following example simply creates trie dictionary of\n``marisa_trie.Trie`` from list of article titles in English version of\nWikipedia, and saves it to ``./example/triedict``.\n\n::\n\n $ cd ./example\n $ curl https://dumps.wikimedia.org/enwiki/latest/enwiki-latest-all-titles-in-ns0.gz | gzcat | python create_triedict.py\n\n**NOTICE** : This script will consume more than 2GB memory.\n\ntrie_search.TrieSearch\n~~~~~~~~~~~~~~~~~~~~~~\n\nCreate an instance, and load dictionary:\n\n.. code:: python\n\n >>> import trie_search\n >>> trie = trie_search.TrieSearch(filepath='./example/triedict')\n\nIf you have ``list`` or ``tuple`` object of patterns, you can create an\ninstance as follows:\n\n.. code:: python\n\n >>> patterns = ['pattern1', 'pattern2', 'pattern3']\n >>> trie = trie_search.TrieSearch(patterns)\n\nTrieSearch.search_all_patterns\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nSearch all patterns in an input text:\n\n.. code:: python\n\n >>> text = ('in computer science , a trie , also called digital tree and '\n ... 'sometimes radix tree or prefix tree ( as they can be searched '\n ... 'by prefixes ) , is a kind of search tree - an ordered tree data '\n ... 'structure that is used to store a dynamic set or associative array '\n ... 'where the keys are usually strings .')\n >>> for pattern, start_idx in trie.search_all_patterns(text):\n ... print pattern, start_idx\n ...\n in 0\n computer 3\n computer science 3\n science 12\n , 20\n a 22\n trie 24\n , 29\n also 31\n called 36\n digital 43\n ... skipped ...\n array 246\n where 252\n where the 252\n the 258\n the keys 258\n keys 262\n are 267\n usually 271\n strings 279 \n\n- The text is the 1st sentence of https://en.wikipedia.org/wiki/Trie.\n For normalization, remove capitalizations and add single white space\n before/after symbols.\n- ``search_all_patterns`` returns an iterator. Each searched pattern is\n represented as a tuple ``(pattern_string, pattern_start_index)``. The\n results are sorted by the start index. If you want to get the result\n as a ``list`` object, use ``list`` function as follow:\n\n .. code:: python\n\n >>> patterns = list(trie.search_all_patterns(text))\n\nTrieSearch.search_longest_patterns\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nSearch longest patterns in an input text:\n\n.. code:: python\n\n >>> for pattern, start_idx in sorted(trie.search_longest_patterns(text), key=lambda x: x[1]):\n ... print pattern, start_idx\n ...\n in 0\n computer science 3\n , 20\n a 22\n trie 24\n , 29\n also 31\n called 36\n digital tree 43\n and 56\n sometimes 60\n radix tree 70\n or 81\n prefix tree 84\n ( 96\n as 98\n they 101\n can 106\n be 110\n by 122\n prefixes 125\n ) 134\n , 136\n is a 138\n kind 143\n of 148\n search tree 151\n - 163\n an 165\n ordered tree data structure 168\n that 196\n is 201\n used to 204\n store 212\n a 218\n dynamic set 220\n or 232\n associative array 235\n where the 253\n the keys 259\n are 268\n usually 272\n strings 280\n\n- ``search_all_patterns`` also returns an iterator. The result sorted\n by the length of patterns. In the above example, the result is\n re-sorted by the start index.\n\ntrie_search.RecordTrieSearch\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n``trie_search.RecordTrieSearch`` is a sub class of\n``marisa_trie.RecordTrie``, which maps unicode keys to data tuples.\n\nThe functions, ``search_all_patterns`` and ``search_longest_patterns``,\nare also implemented in ``trie_search.RecordTrieSearch``.\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nkmrtty/trie-search", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "trie-search", "package_url": "https://pypi.org/project/trie-search/", "platform": "", "project_url": "https://pypi.org/project/trie-search/", "project_urls": { "Homepage": "https://github.com/nkmrtty/trie-search" }, "release_url": "https://pypi.org/project/trie-search/0.3.0/", "requires_dist": [ "marisa-trie (==0.7.4)" ], "requires_python": "", "summary": "Trie-search is a package for text pattern search using marisa-trie", "version": "0.3.0" }, "last_serial": 3492956, "releases": { "0.1.4": [ { "comment_text": "", "digests": { "md5": "c30cc6a2080df12f60ba6c7a61529338", "sha256": "b56e1238a4c3a02b469676db49d80d55fe53b1d1483fd1957d1850964a05d8cf" }, "downloads": -1, "filename": "trie_search-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c30cc6a2080df12f60ba6c7a61529338", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6413, "upload_time": "2017-02-06T09:49:04", "url": "https://files.pythonhosted.org/packages/1c/9d/e691a4471923f74133966c5cb83c8651fd615fb4d805d2125b247c3202d3/trie_search-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e41f5f9b18152ba02c7a45d04f0f58bf", "sha256": "7cccee7d5611495fb064e2f0cb27291640ba3364c9e50391b8178f6d4c1fa11c" }, "downloads": -1, "filename": "trie-search-0.1.4.tar.gz", "has_sig": false, "md5_digest": "e41f5f9b18152ba02c7a45d04f0f58bf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4521, "upload_time": "2017-02-06T09:48:48", "url": "https://files.pythonhosted.org/packages/28/dd/757855768aba667ba219ff4f9c944a763df98f81003b22c44f5e3f2aa500/trie-search-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "001ebde065b929a0690280e2fa3f33ce", "sha256": "bfa48763d2fd89a141beb5652047140ff764d1bd356c5f68027ba34db11bccd0" }, "downloads": -1, "filename": "trie_search-0.1.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "001ebde065b929a0690280e2fa3f33ce", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6410, "upload_time": "2017-02-15T07:57:05", "url": "https://files.pythonhosted.org/packages/ee/4e/551ab20da1cb35113ba4a6a700d507d90e48c8a42d7f95d1c461951a10f6/trie_search-0.1.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7065df233af45ba8f1868ba3f18e3047", "sha256": "2ce3b7f2505520a15397bedd8d72b1f0e1ab77291ac6c4c1c74e543a631b60d4" }, "downloads": -1, "filename": "trie-search-0.1.5.tar.gz", "has_sig": false, "md5_digest": "7065df233af45ba8f1868ba3f18e3047", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4549, "upload_time": "2017-02-15T07:56:20", "url": "https://files.pythonhosted.org/packages/f0/a9/8ba8b5fd7e5e00a23b9e79391a87f1d23ed8df139f7894bc2219e3ac1246/trie-search-0.1.5.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "53d1e548ce7181d569ddf80c2dacbc2b", "sha256": "38f905a4ebf2ea3fa8ac2b22f38e32d7e3a4f2be89463fcf22d8825d93b4a509" }, "downloads": -1, "filename": "trie_search-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "53d1e548ce7181d569ddf80c2dacbc2b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6594, "upload_time": "2017-02-16T05:37:18", "url": "https://files.pythonhosted.org/packages/de/f7/82eb8c6a7de4a79d7ad7972f6e88ceb64b146145fb364d2315747b18e98b/trie_search-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f1993a6f7d36ed403beff92756557af1", "sha256": "a872c4a7f60212df9d4db39b53b6232368113c8b2e28bf1127792002493bedac" }, "downloads": -1, "filename": "trie-search-0.2.0.tar.gz", "has_sig": false, "md5_digest": "f1993a6f7d36ed403beff92756557af1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4681, "upload_time": "2017-02-16T05:37:21", "url": "https://files.pythonhosted.org/packages/06/ed/cc9e081f940da1a3bd0380b928735c0c9a10ad9e42c155f54050b828d018/trie-search-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "69268288ee12ffdadf6cc901b12e7a41", "sha256": "f1fb5cad693a1a818a2d0c37acdcf0d89a742023ca0578824c72f90839e676c1" }, "downloads": -1, "filename": "trie_search-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "69268288ee12ffdadf6cc901b12e7a41", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6599, "upload_time": "2017-02-16T09:54:24", "url": "https://files.pythonhosted.org/packages/1e/2c/cd7ee42e5d7ff6371a266c61a69969f6305086a56208e9bda71972bb1b6c/trie_search-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "066c708de53f374cdbe691b561921790", "sha256": "b1dfdc9e2fc77680cc98ad03d25af452b238c392713de9ea6fc5f1a0ec78fb2b" }, "downloads": -1, "filename": "trie-search-0.2.1.tar.gz", "has_sig": false, "md5_digest": "066c708de53f374cdbe691b561921790", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4672, "upload_time": "2017-02-16T09:54:26", "url": "https://files.pythonhosted.org/packages/e5/7f/39ecd1d0b1aa83d67b68a4feae044e4edb14b709c1b94bb9e1c8170af408/trie-search-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "988e9c1bea7eb6ccf69c006f598a220a", "sha256": "633da8586149426cef1fc743f7b119e5cf19e1e57d98bbef1f7eb87330c40d8a" }, "downloads": -1, "filename": "trie_search-0.2.2-py2-none-any.whl", "has_sig": false, "md5_digest": "988e9c1bea7eb6ccf69c006f598a220a", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6589, "upload_time": "2017-10-25T02:47:07", "url": "https://files.pythonhosted.org/packages/10/1e/8139b1d9b316848ea1ea3d2ae467f4e67a35de6d5bfb3688685ffa3bd945/trie_search-0.2.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fa996a7e7ac0e952ed1bbcc544cd88c4", "sha256": "0f7305ba779e2f5f6302be397f0b84ddca8b52ebce9d37c92a97a8d8b3b43c59" }, "downloads": -1, "filename": "trie-search-0.2.2.tar.gz", "has_sig": false, "md5_digest": "fa996a7e7ac0e952ed1bbcc544cd88c4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4676, "upload_time": "2017-10-25T02:47:08", "url": "https://files.pythonhosted.org/packages/1b/ce/1603240077dc8f2c638ba931c25ea16072f886f841598a40f84b76f9cd97/trie-search-0.2.2.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "1cc98fc6fc69280fd162ecb2a44bc49e", "sha256": "37435dcb1bfd69776d58be3be34fe0e04d39cb9757b0f48f329112ebe64c9ef7" }, "downloads": -1, "filename": "trie_search-0.3.0-py2.7.egg", "has_sig": false, "md5_digest": "1cc98fc6fc69280fd162ecb2a44bc49e", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 6665, "upload_time": "2018-01-16T05:46:47", "url": "https://files.pythonhosted.org/packages/6e/e6/9896cb19402dc2490a3e5505d5419bf89de99703bd16386c108944ab82c0/trie_search-0.3.0-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "a8034376fc93abcc25c935dbbdb8aa81", "sha256": "e46f01ce6c2f2c610b822df3074a669a50b3967042dcfe7a91c91ed33b15e502" }, "downloads": -1, "filename": "trie_search-0.3.0-py2-none-any.whl", "has_sig": false, "md5_digest": "a8034376fc93abcc25c935dbbdb8aa81", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6606, "upload_time": "2018-01-16T05:46:43", "url": "https://files.pythonhosted.org/packages/ea/42/74d14b4911e623eb82687a39e53d6a8ab05fdf730d18da18d908576cc30c/trie_search-0.3.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7d5157d23bcb5a11f650578c9b29a861", "sha256": "eeeec95c0f320129382e71bc1da02e9945198608f1996b08249665ec09e512a6" }, "downloads": -1, "filename": "trie_search-0.3.0-py3.5.egg", "has_sig": false, "md5_digest": "7d5157d23bcb5a11f650578c9b29a861", "packagetype": "bdist_egg", "python_version": "3.5", "requires_python": null, "size": 6897, "upload_time": "2018-01-16T05:46:48", "url": "https://files.pythonhosted.org/packages/3b/81/a874fedaf96290365132d515269465c2b049930b8bf965fb3438184df497/trie_search-0.3.0-py3.5.egg" }, { "comment_text": "", "digests": { "md5": "f5ce2d6415417eb2f3ba57058b063f84", "sha256": "3e0d66ea7057e65a0aa0bf23da1bb50f03b41c94b4752e471884f1c82b33e885" }, "downloads": -1, "filename": "trie_search-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f5ce2d6415417eb2f3ba57058b063f84", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6573, "upload_time": "2018-01-16T05:46:45", "url": "https://files.pythonhosted.org/packages/93/4c/d0b45b593b262ef188c187e27fb726b5ec34e06585abd685a57a09c5d576/trie_search-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ce98821f813772af49ce9e1c9ffcdefe", "sha256": "a507c4696951fc7745f91a09c92367262c92d648ed05ee071ab8bc579d7deb10" }, "downloads": -1, "filename": "trie-search-0.3.0.tar.gz", "has_sig": false, "md5_digest": "ce98821f813772af49ce9e1c9ffcdefe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4668, "upload_time": "2018-01-16T05:46:46", "url": "https://files.pythonhosted.org/packages/5e/e2/f14c28bda657b9ef623d2ab4bc905a6c4adadffeda945708c9fb719d601c/trie-search-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1cc98fc6fc69280fd162ecb2a44bc49e", "sha256": "37435dcb1bfd69776d58be3be34fe0e04d39cb9757b0f48f329112ebe64c9ef7" }, "downloads": -1, "filename": "trie_search-0.3.0-py2.7.egg", "has_sig": false, "md5_digest": "1cc98fc6fc69280fd162ecb2a44bc49e", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 6665, "upload_time": "2018-01-16T05:46:47", "url": "https://files.pythonhosted.org/packages/6e/e6/9896cb19402dc2490a3e5505d5419bf89de99703bd16386c108944ab82c0/trie_search-0.3.0-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "a8034376fc93abcc25c935dbbdb8aa81", "sha256": "e46f01ce6c2f2c610b822df3074a669a50b3967042dcfe7a91c91ed33b15e502" }, "downloads": -1, "filename": "trie_search-0.3.0-py2-none-any.whl", "has_sig": false, "md5_digest": "a8034376fc93abcc25c935dbbdb8aa81", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6606, "upload_time": "2018-01-16T05:46:43", "url": "https://files.pythonhosted.org/packages/ea/42/74d14b4911e623eb82687a39e53d6a8ab05fdf730d18da18d908576cc30c/trie_search-0.3.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7d5157d23bcb5a11f650578c9b29a861", "sha256": "eeeec95c0f320129382e71bc1da02e9945198608f1996b08249665ec09e512a6" }, "downloads": -1, "filename": "trie_search-0.3.0-py3.5.egg", "has_sig": false, "md5_digest": "7d5157d23bcb5a11f650578c9b29a861", "packagetype": "bdist_egg", "python_version": "3.5", "requires_python": null, "size": 6897, "upload_time": "2018-01-16T05:46:48", "url": "https://files.pythonhosted.org/packages/3b/81/a874fedaf96290365132d515269465c2b049930b8bf965fb3438184df497/trie_search-0.3.0-py3.5.egg" }, { "comment_text": "", "digests": { "md5": "f5ce2d6415417eb2f3ba57058b063f84", "sha256": "3e0d66ea7057e65a0aa0bf23da1bb50f03b41c94b4752e471884f1c82b33e885" }, "downloads": -1, "filename": "trie_search-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f5ce2d6415417eb2f3ba57058b063f84", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6573, "upload_time": "2018-01-16T05:46:45", "url": "https://files.pythonhosted.org/packages/93/4c/d0b45b593b262ef188c187e27fb726b5ec34e06585abd685a57a09c5d576/trie_search-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ce98821f813772af49ce9e1c9ffcdefe", "sha256": "a507c4696951fc7745f91a09c92367262c92d648ed05ee071ab8bc579d7deb10" }, "downloads": -1, "filename": "trie-search-0.3.0.tar.gz", "has_sig": false, "md5_digest": "ce98821f813772af49ce9e1c9ffcdefe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4668, "upload_time": "2018-01-16T05:46:46", "url": "https://files.pythonhosted.org/packages/5e/e2/f14c28bda657b9ef623d2ab4bc905a6c4adadffeda945708c9fb719d601c/trie-search-0.3.0.tar.gz" } ] }