def get_wordnet_pos(wn, treebank_tag):
    """
    Adapted from the tutorial on text processing
    Cf. https://stackoverflow.com/questions/15586721/wordnet-lemmatization-and-pos-tagging-in-python
    :param wn: An instance of the WordNet corpus
    :param treebank_tag: a tag from nltk.pos_tag treebank
    """

    if treebank_tag.startswith('J'):
        return wn.ADJ
    elif treebank_tag.startswith('V'):
        return wn.VERB
    elif treebank_tag.startswith('N'):
        return wn.NOUN
    elif treebank_tag.startswith('R'):
        return wn.ADV
    else:
        return wn.NOUN