File size: 362 Bytes
0b7b08a
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import os
from tqdm import tqdm
import numpy as np
import sys

if __name__ == "__main__":
    captions = []
    with open(sys.argv[1]) as f:
        for line in tqdm(f):
            line = line.rstrip().split("\t")
            caption = line[2]
            captions.append(caption)
    lengths = [len(c.split(" ")) for c in captions]
    print(np.mean(lengths))