Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions py_vncorenlp/vncorenlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __init__(self, max_heap_size='-Xmx2g', annotators=["wseg", "pos", "ner", "pa
self.annotators.append("wseg")

self.model = javaclass_vncorenlp(annotators)
os.chdir(self.current_working_dir)

def annotate_text(self, text):
from jnius import autoclass
Expand Down Expand Up @@ -113,7 +114,7 @@ def print_out(self, dict_sentences):
print("")

def annotate_file(self, input_file, output_file):
os.chdir(self.current_working_dir)
# os.chdir(self.current_working_dir)
input_str = self.javaclass_String(input_file)
output_str = self.javaclass_String(output_file)
self.model.processPipeline(input_str, output_str, self.annotators)
Expand All @@ -125,4 +126,4 @@ def annotate_file(self, input_file, output_file):
print(output)
model.print_out(output)
model.annotate_file(input_file="/home/vinai/Desktop/testvncore/t/input.txt", output_file="output.txt")
print(model.word_segment("Ông Nguyễn Khắc Chúc đang làm việc tại Đại học Quốc gia Hà Nội."))
print(model.word_segment("Ông Nguyễn Khắc Chúc đang làm việc tại Đại học Quốc gia Hà Nội."))