Python port of the lemmatize method, see https://github.com/Liebeck/IWNLP.Lemmatizer/blob/master/IWNLP.Lemmatizer.Predictor/IWNLPSentenceProcessor.cs

def lemmatize(self, word, pos_universal_google):
        """
        Python port of the lemmatize method, see https://github.com/Liebeck/IWNLP.Lemmatizer/blob/master/IWNLP.Lemmatizer.Predictor/IWNLPSentenceProcessor.cs

        """
        if pos_universal_google == "NOUN":
            if self.contains_entry(word, "Noun"):
                return self.get_lemmas(word, "Noun")
            elif self.contains_entry(word, "X"):
                return self.get_lemmas(word, "X")
            elif self.contains_entry(word, "AdjectivalDeclension"):
                return self.get_lemmas(word, "AdjectivalDeclension")
            elif self.contains_entry(word, ["Noun", "X"], ignore_case=True):
                return self.get_lemmas(word, ["Noun", "X"], ignore_case=True)
            else:
                return None
        elif pos_universal_google == "ADJ":
            if self.contains_entry(word, "Adjective"):
                return self.get_lemmas(word, "Adjective")
            elif self.contains_entry(word, "Adjective", ignore_case=True):
                return self.get_lemmas(word, "Adjective", ignore_case=True)
            # Account for possible errors in the POS tagger. This order was fine-tuned in terms of accuracy
            elif self.contains_entry(word, "Noun", ignore_case=True):
                return self.get_lemmas(word, "Noun", ignore_case=True)
            elif self.contains_entry(word, "X", ignore_case=True):
                return self.get_lemmas(word, "X", ignore_case=True)
            elif self.contains_entry(word, "Verb", ignore_case=True):
                return self.get_lemmas(word, "Verb", ignore_case=True)
            else:
                return None
        elif pos_universal_google in ["VERB", "AUX"]:
            if self.contains_entry(word, "Verb", ignore_case=True):
                return self.get_lemmas(word, "Verb", ignore_case=True)
            else:
                return None
        else:
            return None