Skip to main content

Thai Text Generator library

Project description

TTG : Thai Text Generator

[Open In Colab](https://colab.research.google.com/drive/1X6D8J0sWNi8UgJi7Hk5YL4FqepZ7laxS?usp=sharing]

Thai Text Generator

Install

pip install ttg

if you want used thai2fit, you can install :

pip install ttg[thai2fit]

Example

from thaitextgenerator import *
a=Unigram()
print(a.gen_sentence(N=10))
b=Bigram()
print(b.gen_sentence(start_seq="คน", N=10))
c=Tigram()
c.gen_sentence(N=10, start_seq=("คน","ดี"))
# Thai2Fit
from thaitextgenerator.thai2fit import gen_sentence
gen_sentence()

Docs

N-Gram

import

from thaitextgenerator import *

Unigram

we support corpus

  • TNC : Thai National Corpus (Default)
  • TCC : Thai Textbook Corpus
  • oscar : Open Super-large Crawled ALMAnaCH coRpus
Unigram(name = "tnc or tcc or oscar")

Unigram().gen_sentence(N:int=3,prob:float=0.001, start_seq:str=None ,output_str:bool = True, duplicate:bool=False)

Bigram

we support corpus

  • TNC : Thai National Corpus (Default)
Bigram(name = "tnc")

Bigram().gen_sentence(N:int=4,prob:float=0.001, start_seq:str=None, output_str:bool = True, duplicate:bool=False)

Tigram

we support corpus

  • TNC : Thai National Corpus (Default)
Tigram(name = "tnc")

Bigram().gen_sentence(N:int=4,prob:float=0.001, start_seq:tuple=None, output_str:bool = True, duplicate:bool=False)

Thai2Fit

# Thai2Fit
from thaitextgenerator.thai2fit import gen_sentence
en_sentence(N:int=4,prob:float=0.001, start_seq:str=None, output_str:bool = True)

License

   Copyright 2020 Wannaphong Phatthiyaphaibun

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ttg-0.1.dev3.tar.gz (7.3 kB view hashes)

Uploaded Source

Built Distribution

ttg-0.1.dev3-py3-none-any.whl (10.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page