ShynBui commited on
Commit
8a92bc6
·
verified ·
1 Parent(s): b5a336b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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
- rdrsegmenter = py_vncorenlp.VnCoreNLP(annotators=["wseg"], save_dir=os.getcwd())
31
- output = rdrsegmenter.word_segment(text)
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]