Module exposing: WordTokenizeCorpusReader, DataReader, TaggedCorpus, preprocess_vlsp2013
# Source: https://github.com/undertheseanlp/underthesea | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
from os.path import join
class WordTokenizeCorpusReader:
@staticmethod
def read(data_folder, train_file=None, test_file=None):
train = WordTokenizeCorpusReader.__read_data(join(data_folder, train_file))
test = WordTokenizeCorpusReader.__read_data(join(data_folder, test_file))
tagged_corpus = TaggedCorpus(train, test)
return tagged_corpus
@staticmethod
def __read_data(data_file):
text = open(data_file).read()
sentences = text.split("\n")
sentences = [WordTokenizeCorpusReader.__extract_tokens(s) for s in sen
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key