Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import gradio as gr
|
|
| 3 |
import re
|
| 4 |
import os
|
| 5 |
import py_vncorenlp
|
|
|
|
| 6 |
|
| 7 |
def preprocess_text(text):
|
| 8 |
# Loại bỏ các ký tự đặc biệt và dấu câu
|
|
@@ -27,9 +28,8 @@ def remove_html_tags(text):
|
|
| 27 |
return clean_text
|
| 28 |
|
| 29 |
def vi_word_segment(text):
|
| 30 |
-
|
| 31 |
-
output
|
| 32 |
-
return ' '.join(output)
|
| 33 |
|
| 34 |
def process_text(text):
|
| 35 |
text = text[:256]
|
|
|
|
| 3 |
import re
|
| 4 |
import os
|
| 5 |
import py_vncorenlp
|
| 6 |
+
from pyvi import ViTokenizer, ViPosTagger
|
| 7 |
|
| 8 |
def preprocess_text(text):
|
| 9 |
# Loại bỏ các ký tự đặc biệt và dấu câu
|
|
|
|
| 28 |
return clean_text
|
| 29 |
|
| 30 |
def vi_word_segment(text):
|
| 31 |
+
output = ViTokenizer.tokenize(text)
|
| 32 |
+
return output
|
|
|
|
| 33 |
|
| 34 |
def process_text(text):
|
| 35 |
text = text[:256]
|