# Parser-TD : Thai Dependency Parser
`parser-td` is a Thai dependency parser trained using [stanza](https://github.com/stanfordnlp/stanza/tree/main). Parser-td uses [PhayaThaiBERT](https://huggingface.co/clicknext/phayathaibert) as a based model in training process. The model refer to **Stanza*P with no POS** model in [Thai Universal Dependency Treebank (TUD)](https://github.com/nlp-chula/TUD).
## Content
1. [Installation](#installation)
2. [Usage](#Usage)
## Installation
`parser-td` can be installed usig `pip`ː
```
pip install parser-td
```
## Usage
### Initalizing
```python
from parser-td.depparse import load_model, depparse
nlp = load_model()
```
```python
text = 'ฉันอยากกินข้าวที่แม่ทำ'
dep = depparse(text, nlp)
```
### Access the results
```python
print(f'\n{text}\n',*[f'id: {word.id}\tword: {word.text}\thead id: {word.head}\thead: {sent.words[word.head-1].text if word.head > 0 else "root"}\tdeprel: {word.deprel}' for sent in dep.sentences for word in sent.words], sep='\n')
```
- `.id` : the id of the word.
- `.head` : the head of the word.
- `.deprel` : the dependency relationship between the word and the head.
## Citation
If you use `parser-td` in your project or publication, please cite as follows:
*BibTex*
```
@article{Sriwirote-etal-2024-TUD,
title={The Thai Universal Dependency Treebank},
author={Panyut Sriwirote and Wei Qi Leong and
Charin Polpanumas and Santhawat Thanyawong and
William Chandra Tjhi and Wirote Aroonmanakun and
Attapol T. Rutherford},
journal={Transactions of the Association for Computational Linguistics},
year={in press},
publisher={MIT Press Direct}
}
```
Raw data
{
"_id": null,
"home_page": null,
"name": "parser-td",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "python, Thai dependency, Dependency parser",
"author": null,
"author_email": "Attapol Thamrongrattanarit <profte@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/c8/6a/363c7f34e348f5436a10b7ae329dc04e25b8a23be554c7eb2d3e82682556/parser_td-0.0.1.tar.gz",
"platform": null,
"description": "# Parser-TD : Thai Dependency Parser\r\n`parser-td` is a Thai dependency parser trained using [stanza](https://github.com/stanfordnlp/stanza/tree/main). Parser-td uses [PhayaThaiBERT](https://huggingface.co/clicknext/phayathaibert) as a based model in training process. The model refer to **Stanza*P with no POS** model in [Thai Universal Dependency Treebank (TUD)](https://github.com/nlp-chula/TUD).\r\n\r\n## Content\r\n1. [Installation](#installation)\r\n2. [Usage](#Usage)\r\n\r\n## Installation\r\n`parser-td` can be installed usig `pip`\u02d0\r\n```\r\npip install parser-td\r\n```\r\n\r\n## Usage\r\n### Initalizing\r\n\r\n```python\r\nfrom parser-td.depparse import load_model, depparse\r\n\r\nnlp = load_model()\r\n```\r\n\r\n```python\r\ntext = '\u0e09\u0e31\u0e19\u0e2d\u0e22\u0e32\u0e01\u0e01\u0e34\u0e19\u0e02\u0e49\u0e32\u0e27\u0e17\u0e35\u0e48\u0e41\u0e21\u0e48\u0e17\u0e33'\r\n\r\ndep = depparse(text, nlp)\r\n```\r\n\r\n### Access the results\r\n\r\n```python\r\nprint(f'\\n{text}\\n',*[f'id: {word.id}\\tword: {word.text}\\thead id: {word.head}\\thead: {sent.words[word.head-1].text if word.head > 0 else \"root\"}\\tdeprel: {word.deprel}' for sent in dep.sentences for word in sent.words], sep='\\n')\r\n```\r\n- `.id` : the id of the word.\r\n- `.head` : the head of the word.\r\n- `.deprel` : the dependency relationship between the word and the head.\r\n\r\n\r\n\r\n## Citation\r\nIf you use `parser-td` in your project or publication, please cite as follows:\r\n\r\n*BibTex*\r\n\r\n```\r\n@article{Sriwirote-etal-2024-TUD,\r\n title={The Thai Universal Dependency Treebank},\r\n author={Panyut Sriwirote and Wei Qi Leong and \r\n Charin Polpanumas and Santhawat Thanyawong and \r\n William Chandra Tjhi and Wirote Aroonmanakun and \r\n Attapol T. Rutherford},\r\n journal={Transactions of the Association for Computational Linguistics},\r\n year={in press},\r\n publisher={MIT Press Direct}\r\n}\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Thai dependency parser.",
"version": "0.0.1",
"project_urls": {
"Homepage": "https://github.com/nlp-chula/parser-td"
},
"split_keywords": [
"python",
" thai dependency",
" dependency parser"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "83bc6350ebf525dbeb265000e3424dada0b5b9ac7715c694f90daf5c5fdd210b",
"md5": "2d3378686ab5c09549041ddfa69c66f2",
"sha256": "6f734f6d23306d18b84ea12b9389b999b7227007ea512885a6e1405df3794d6b"
},
"downloads": -1,
"filename": "parser_td-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2d3378686ab5c09549041ddfa69c66f2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 3596,
"upload_time": "2024-12-11T08:12:38",
"upload_time_iso_8601": "2024-12-11T08:12:38.154781Z",
"url": "https://files.pythonhosted.org/packages/83/bc/6350ebf525dbeb265000e3424dada0b5b9ac7715c694f90daf5c5fdd210b/parser_td-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c86a363c7f34e348f5436a10b7ae329dc04e25b8a23be554c7eb2d3e82682556",
"md5": "654b63b323635e7a1a8ba7389910f22d",
"sha256": "f03eed7cc4e6ddcfde53306ab7167b209f9c8e9a2454e330ff2cf3a1abe9a328"
},
"downloads": -1,
"filename": "parser_td-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "654b63b323635e7a1a8ba7389910f22d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 3444,
"upload_time": "2024-12-11T08:12:40",
"upload_time_iso_8601": "2024-12-11T08:12:40.719636Z",
"url": "https://files.pythonhosted.org/packages/c8/6a/363c7f34e348f5436a10b7ae329dc04e25b8a23be554c7eb2d3e82682556/parser_td-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-11 08:12:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nlp-chula",
"github_project": "parser-td",
"github_not_found": true,
"lcname": "parser-td"
}