Datasets:
File size: 1,018 Bytes
255ac07 5a66577 255ac07 5a66577 255ac07 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import os
import matplotlib.pyplot as plt
import dsbuild
stats_path: list[str] = ['../stats/full/train/', '../stats/full/test',
'../stats/pruned/train', '../stats/pruned/test']
def __plot_mean_word_counts(path: list[str], show: bool = False, save: bool = False):
for p in path:
p: str = os.path.normpath(p)
split_name: str = p.split(os.sep)[-1]
config_name: str = p.split(os.sep)[-2]
stats: dict = dsbuild.load_stats(p)
conversations: list[float] = [conversation['wordsMean'] for _, conversation in stats['conversations'].items()]
dsbuild.build_mean_word_plot(conversations, f'Mean Words ({config_name}-{split_name})',
text=f'{len(conversations)} total')
if save:
plt.savefig(f'../assets/{config_name}-{split_name}.png')
if show:
plt.show()
def main():
__plot_mean_word_counts(stats_path, show=False, save=True)
if __name__ == '__main__':
main()
|