Commit 97fd8124 authored by NaweenTharuka's avatar NaweenTharuka

feat: refactor code

parent 8b038061
from happytransformer import HappyTextClassification,TTSettings, HappyTextToText
def grammerchecker():
happy_tt = HappyTextClassification(load_path = "F:\\CDAP-PRESENTLY\\21_22-j-02\\Presently\\presently\\users\\models\\grammermodels\\")
beam_settings = TTSettings(num_beams=5, min_length=1, max_length=500)
happy_tt = HappyTextToText("T5", "t5-base")
example_1 = "Sri Lanka's documented history goes back 3,000 years, with evidence of prehistoric human settlements that dates to at least 125,000 years ago.[14] It has a rich cultural heritage. The earliest known Buddhist writings of Sri Lanka, known collectively as the Pāli canon, date to the fourth Buddhist council, which took place in 29 BCE.[15][16] Sri Lanka's geographic location and deep harbours have made it of great strategic importance, from the earliest days of the ancient Silk Road trade route to today's so-called maritime Silk Road"
result_1 = happy_tt.generate_text(example_1, args=beam_settings)
print(result_1.text)
return(result_1.text)
result = grammerchecker()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment