OV_Text / statistics.py
Duy Huynh
Initialize
a973aa2
from os.path import dirname, join
def count_lines(filepath):
with open(filepath, encoding="utf-8") as f:
lines = f.read().splitlines()
return len(lines)
def statistic(subset_folder):
print("Train\t\t", count_lines(join(subset_folder, "train.txt")))
print("Validation\t", count_lines(join(subset_folder, "validation.txt")))
print("Test\t\t", count_lines(join(subset_folder, "test.txt")))
pwd = dirname(__file__)
dataset_folder = join(pwd, "data")
print("Subset Small")
statistic(join(dataset_folder, "small"))
print("Subset Base")
statistic(join(dataset_folder, "base"))
print("Subset Large")
statistic(join(dataset_folder, "large"))