<jupyter_start><jupyter_text><jupyter_code># reads in the text file whose name is specified on the command line,
# and reports the number of lines and words

import sys

def checkline():
  global l
  global wordcount
  w = l.split()
  wordcount += len(w)
  
wordcount = 0
f = open(sys.argv[1]) # THIS VERSION IS FOR COMMAND LINE, CAN ALSO IMPORT FILE INTO COLAB
flines = f.readlines()
linecount = len(flines)
for l in flines:
  checkline()
print(linecount, wordcount)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0925553319919517, 'fraction_numerical': 0.004024144869215292, 'mean_word_length': 4.724137931034483, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '358948', 'license': 'MIT', 'n_tokens_mistral': 176, 'n_tokens_neox': 170, 'n_words': 61, 'path': 'Week2-Introduction-to-Python-_-NumPy/Introductory_Example.ipynb', 'repo_name': 'lisajl/DigitalHistory', 'size': '497'}