old_contents: from nltk.corpus import wordnet
  
  def get_synonyms(word):
  	"""Gets a list of synonyms of a given word"""
  	synonyms = set()
  
  	# this essentially loops over every meaning of the word
  	# we will probably eventually want to figure out which
  	# meaning we have in our sentence, and only add those
  	# related synonyms
  	for synset in wordnet.synsets(word):
  		for lemma in synset.lemmas():
  			synonyms.add(lemma.name())
  
  	return list(synonyms)
  
  def get_hypernyms(word):
  	"""Gets a list of hypernyms of a given word (one level up)"""
  	hypernyms = set()
  
  	for synset in wordnet.synsets(word):
  		for hypernym in synset.hypernyms():
  			for lemma in hypernym.lemmas():
  				hypernyms.add(lemma.name())
  
  	return list(hypernyms)
  
new_contents: from nltk.corpus import wordnet
  from collections import defaultdict
  
  def get_synonyms(word, pos):
  	"""Gets a list of synonyms of a given word"""
  	synonyms = set()
  	# loop over all synsets with correct part-of-speech
  	for synset in wordnet.synsets(word, pos):
  		for lemma in synset.lemmas():
  			synonyms.add(lemma.name())
  	return list(synonyms)
  
  
  def get_hypernyms(word, pos):
  	"""Gets a list of hypernyms of a given word (one level up)"""
  	hypernyms = set()
  	# loop over all synsets with correct part-of-speech
  	for synset in wordnet.synsets(word, pos):
  		for hypernym in synset.hypernyms():
  			for lemma in hypernym.lemmas():
  				hypernyms.add(lemma.name())
  	return list(hypernyms)
  
  
  def get_synonym_list(tagged_sequence):
  	"""Returns a dictionary of lists of synonyms for a tagged sequence of words"""
  	split_sequence = [tuple(word_tag.split("/")) for word_tag in tagged_sequence.split()]
  	results = defaultdict(dict)
  	for word_tag in split_sequence:
  		word = word_tag[0]
  		tag = get_pos_tag_for_wordnet(word_tag[1])
  		results[tag][word] = get_synonyms(word, tag)
  	return results
  
  
  def get_hypernym_list(tagged_sequence):
  	"""Returns a dictionary of lists of hypernyms for a tagged sequence of words"""
  	split_sequence = [tuple(word_tag.split("/")) for word_tag in tagged_sequence.split()]
  	results = defaultdict(dict)
  	for word_tag in split_sequence:
  		word = word_tag[0]
  		tag = get_pos_tag_for_wordnet(word_tag[1])
  		results[tag][word] = get_hypernyms(word, tag)
  	return results
  
  
  def get_pos_tag_for_wordnet(tag):
  	"""Returns the wordnet version of a part of speech tag if it exists"""
  	if tag.startswith("NN"):
  		return wordnet.NOUN
  	elif tag.startswith("VB"):
  		return wordnet.VERB
  	elif tag.startswith("JJ"):
  		return wordnet.ADJ
  	elif tag.startswith("RB"):
  		return wordnet.ADV
  	else:
  		return ""
  
subject: Update to take in a tagged sentence and depend on pos tags when choosing synonyms