File size: 350 Bytes
54f5ec9
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from happytransformer import HappyTextToText, TTSettings

input_text = input('Enter your mispelled text: ')
happy_tt = HappyTextToText('T5', load_path='.')

beam_settings = TTSettings(num_beams=5, min_length=1, max_length=100)

output_text_1 = happy_tt.generate_text(
    f'grammar: {input_text}',
    args=beam_settings,
)
print(output_text_1.text)