So here is a way to do it in R, using the Northwestern University lemmatizer, MorphAdorner.
lemmatize <- function(wordlist) {
get.lemma <- function(word, url) {
response <- GET(url,query=list(spelling=word,standardize="",
wordClass="",wordClass2="",
corpusConfig="ncf", # Nineteenth Century Fiction
media="xml"))
content <- content(response,type="text")
xml <- xmlInternalTreeParse(content)
return(xmlValue(xml["//lemma"][[1]]))
}
require(httr)
require(XML)
url <- "http://devadorner.northwestern.edu/maserver/lemmatizer"
return(sapply(wordlist,get.lemma,url=url))
}
words <- c("is","am","was","are")
lemmatize(words)
# is am was are
# "be" "be" "be" "be"
As I suspect you are aware, correct lemmatization requires knowledge of the word class (part of speech), contextually correct spelling, and also depends upon which corpus is being used.