{"id":20457817,"url":"https://github.com/pythainlp/thai-text-generator","last_synced_at":"2025-05-08T22:32:13.627Z","repository":{"id":62585446,"uuid":"266338864","full_name":"PyThaiNLP/Thai-Text-Generator","owner":"PyThaiNLP","description":"Thai Text Generator","archived":true,"fork":false,"pushed_at":"2024-12-24T13:45:11.000Z","size":40,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T22:02:23.152Z","etag":null,"topics":["thai-language","thai-nlp","thai-nlp-library"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PyThaiNLP.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-23T13:08:43.000Z","updated_at":"2024-12-24T13:45:27.000Z","dependencies_parsed_at":"2022-11-03T22:00:57.827Z","dependency_job_id":null,"html_url":"https://github.com/PyThaiNLP/Thai-Text-Generator","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyThaiNLP%2FThai-Text-Generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyThaiNLP%2FThai-Text-Generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyThaiNLP%2FThai-Text-Generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyThaiNLP%2FThai-Text-Generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PyThaiNLP","download_url":"https://codeload.github.com/PyThaiNLP/Thai-Text-Generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253158154,"owners_count":21863244,"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":["thai-language","thai-nlp","thai-nlp-library"],"created_at":"2024-11-15T12:09:20.138Z","updated_at":"2025-05-08T22:32:13.610Z","avatar_url":"https://github.com/PyThaiNLP.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TTG : Thai Text Generator\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1X6D8J0sWNi8UgJi7Hk5YL4FqepZ7laxS?usp=sharing]\n\nThai Text Generator\n\n\u003e Moved to https://github.com/PyThaiNLP/pythainlp\n\n## Install\n\n```sh\npip install ttg\n```\n\nif you want used thai2fit, you can install :\n```sh\npip install ttg[thai2fit]\n```\n\n## Example\n\n```python\nfrom thaitextgenerator import *\na=Unigram()\nprint(a.gen_sentence(N=10))\nb=Bigram()\nprint(b.gen_sentence(start_seq=\"คน\", N=10))\nc=Tigram()\nc.gen_sentence(N=10, start_seq=(\"คน\",\"ดี\"))\n# Thai2Fit\nfrom thaitextgenerator.thai2fit import gen_sentence\ngen_sentence()\n```\n\n## Docs\n\n### N-Gram\n**import**\n```python\nfrom thaitextgenerator import *\n```\n#### Unigram\n\nwe support corpus\n\n- TNC : Thai National Corpus [source](https://github.com/korakot/thainlp) (Default)\n- TCC : Thai Textbook Corpus [source](https://github.com/korakot/thainlp)\n- oscar : Open Super-large Crawled ALMAnaCH coRpus [source](https://www.facebook.com/groups/colab.thailand/permalink/1524070061101680/)\n\n```python\nUnigram(name = \"tnc or tcc or oscar\")\n\nUnigram().gen_sentence(N:int=3,prob:float=0.001, start_seq:str=None ,output_str:bool = True, duplicate:bool=False)\n```\n\n#### Bigram\n\nwe support corpus\n\n- TNC : Thai National Corpus (Default) [source](http://www.arts.chula.ac.th/ling/tnc/)\n\n```python\nBigram(name = \"tnc\")\n\nBigram().gen_sentence(N:int=4,prob:float=0.001, start_seq:str=None, output_str:bool = True, duplicate:bool=False)\n```\n\n#### Tigram\n\nwe support corpus\n\n- TNC : Thai National Corpus (Default) [source](http://www.arts.chula.ac.th/ling/tnc/)\n\n```python\nTigram(name = \"tnc\")\n\nTigram().gen_sentence(N:int=4,prob:float=0.001, start_seq:tuple=None, output_str:bool = True, duplicate:bool=False)\n```\n\n### Thai2Fit\n\n[source](https://github.com/cstorm125/thai2fit)\n\n```python\n# Thai2Fit\nfrom thaitextgenerator.thai2fit import gen_sentence\ngen_sentence(N:int=4,prob:float=0.001, start_seq:str=None, output_str:bool = True)\n```\n\n## Citations\n\n```\nWannaphong Phatthiyaphaibun. (2020, May 24). TTG: Thai Text Generator. Zenodo. http://doi.org/10.5281/zenodo.3855426\n```\n\nBibTeX entry:\n\n``` bib\n@software{wannaphong_phatthiyaphaibun_2020_3855427,\n  author       = {Wannaphong Phatthiyaphaibun},\n  title        = {{TTG: Thai Text Generator}},\n  month        = may,\n  year         = 2020,\n  publisher    = {Zenodo},\n  doi          = {10.5281/zenodo.3855426},\n  url          = {https://doi.org/10.5281/zenodo.3855426}\n}\n```\n\n## License\n```\n   Copyright 2020 Wannaphong Phatthiyaphaibun\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythainlp%2Fthai-text-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpythainlp%2Fthai-text-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythainlp%2Fthai-text-generator/lists"}