from typing import Counter
import re


def build_wordlist(input_file):

	"""Build a wordlist Counter from lines of the corpus file"""
	
	wordlist = Counter()
	
	for line in input_file:
		words = re.findall(r'\w+', line)
		wordlist.update(words)
	
	return wordlist