def lemmatize ( self , text , best_guess = True , return_frequencies = False ) : if isinstance ( text , str ) : tokens = wordpunct_tokenize ( text ) elif isinstance ( text , list ) : tokens = text else : raise TypeError ( "lemmatize only works with strings or lists of string tokens." ) return [ self . _lemmatize_token ( token , best_guess , return_frequencies ) for token in tokens ]
lemmitiser in python for list of words
Lemmatize all tokens in a string or a list . A string is first tokenized using punkt . Throw a type error if the input is neither a string nor a list .
def lemmatize(self, text, best_guess=True, return_frequencies=False):
		"""Lemmatize all tokens in a string or a list.  A string is first tokenized using punkt.
		Throw a type error if the input is neither a string nor a list.
		"""
		if isinstance(text, str):
			tokens = wordpunct_tokenize(text)
		elif isinstance(text, list):
			tokens= text
		else:
			raise TypeError("lemmatize only works with strings or lists of string tokens.")

		return [self._lemmatize_token(token, best_guess, return_frequencies) for token in tokens]