{"id":18925551,"url":"https://github.com/nightmachinery/price_detector_fa","last_synced_at":"2026-03-14T15:30:17.308Z","repository":{"id":68564152,"uuid":"568643800","full_name":"NightMachinery/price_detector_fa","owner":"NightMachinery","description":"extracts product/price/amount tuples from Persian text using rule-based methods","archived":false,"fork":false,"pushed_at":"2023-12-15T11:41:44.000Z","size":171,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T17:48:02.851Z","etag":null,"topics":["nlp","persian","price","rule-based-nlp"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NightMachinery.png","metadata":{"files":{"readme":"readme.org","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-21T05:06:05.000Z","updated_at":"2023-01-27T16:54:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"5431b801-c7dc-4954-9abe-caf420f7d486","html_url":"https://github.com/NightMachinery/price_detector_fa","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/NightMachinery%2Fprice_detector_fa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightMachinery%2Fprice_detector_fa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightMachinery%2Fprice_detector_fa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightMachinery%2Fprice_detector_fa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NightMachinery","download_url":"https://codeload.github.com/NightMachinery/price_detector_fa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239921844,"owners_count":19718844,"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":["nlp","persian","price","rule-based-nlp"],"created_at":"2024-11-08T11:12:18.836Z","updated_at":"2026-03-14T15:30:17.219Z","avatar_url":"https://github.com/NightMachinery.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+TITLE: price_detector_fa\n\n=price_detector_fa= extracts product/price/amount tuples from Persian text using rule-based methods.\n\n* Contributers\n- Feraidoon Mehri\n- Fahime Hosseini\n- Soroush Vafaie Tabar\n\n* Installation\nThis library does not work on Windows.\n\n1. Run the following in this project's directory:\n#+begin_example zsh\npip install -e .\nbash install.sh\n#+end_example\n\n2. Install =graphviz= using your OS package manager.\n\n* Usage\n#+begin_src jupyter-python :kernel py_310 :session emacs_py_1 :async yes :exports both\nfrom price_detector_fa.samples import *\nfrom price_detector_fa.utils import *\nfrom price_detector_fa.extractors import *\nfrom price_detector_fa.preprocessing import *\nfrom price_detector_fa.hardcoded import *\n\n\ndef matching_extract(sample):\n    output = []\n    for s in sentence_tokenizer.tokenize(sample):\n        s_tokens, s_spans = preprocess(s)\n\n        s_parsed = parser.parse(s_tokens)\n        s_spans = find_spans(s_parsed, s_spans)\n\n        matchings = all_extract(s_parsed)\n        output = output + list(\n            matching_show(matching, s_spans) for matching in matchings\n        )\n    return output\n\n\nimport pprint \npp = pprint.PrettyPrinter(indent=2)\n#+end_src\n\n#+RESULTS:\n\n#+begin_src jupyter-python :kernel py_310 :session emacs_py_1 :async yes :exports both\npp.pprint(matching_extract(\"عباس‌آقا ده فروند شتر را به بهای پنجاه قران خریداری نموده و و خوشال شدند\"))\n#+end_src\n\n#+RESULTS:\n: [ { 'price_amount': ['مقدار:  پنجاه'],\n:     'price_unit': ['مقدار:  قران'],\n:     'product_amount': ['مقدار:  ده'],\n:     'product_name': 'مقدار:  شتر',\n:     'product_name_span': (18, 21),\n:     'product_unit': ['مقدار:  فروند']}]\n\n#+begin_src jupyter-python :kernel py_310 :session emacs_py_1 :async yes :exports both\npp.pprint(matching_extract(\"با سه هزار تومان میشود یک عدد بادکنک خرید.\"))\n#+end_src\n\n#+RESULTS:\n: [ { 'price_amount': ['مقدار:  سه هزار'],\n:     'price_unit': ['مقدار:  تومان'],\n:     'product_amount': ['مقدار:  یک'],\n:     'product_name': 'مقدار:  بادکنک خرید .',\n:     'product_name_span': (30, 42),\n:     'product_unit': ['مقدار:  عدد']}]\n\n#+begin_src jupyter-python :kernel py_310 :session emacs_py_1 :async yes :exports both\nprint(sample_16_2)\npp.pprint(matching_extract(sample_16_2))\n#+end_src\n\n#+RESULTS:\n: قیمت هندوانه ارزان شد و قیمت  هر گرم طلا هزار تومان است\n: [ { 'price_amount': ['مقدار:  هزار'],\n:     'price_unit': ['مقدار:  تومان'],\n:     'product_amount': ['مقدار:  یک'],\n:     'product_name': 'مقدار:  طلا',\n:     'product_name_span': (37, 40),\n:     'product_unit': ['مقدار:  گرم']}]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnightmachinery%2Fprice_detector_fa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnightmachinery%2Fprice_detector_fa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnightmachinery%2Fprice_detector_fa/lists"}