What is Lemmatization and tokenization. Discuss the difference between them with example.

Lemmatization and tokenization are both fundamental techniques used in Natural Language Processing (NLP), but they serve different purposes.

Tokenization involves breaking down a text into smaller units called tokens, which can be words, phrases, or sentences. The tokenization process splits the text based on specific rules, such as separating words by spaces or punctuation marks. In tokenized text, each token represents a meaningful unit that can be further analyzed or processed. For example, given the sentence: "The cat is sitting on the mat," tokenization would produce the following tokens: ["The", "cat", "is", "sitting", "on", "the", "mat"].

On the other hand, Lemmatization is the process of reducing a word to its base or root form, called the lemma, while still preserving the meaning of the word. It helps in reducing inflectional forms of words to their base form, so that different variations of the same word can be treated as one. For instance, the lemma of words like "running" and "ran" is "run". Lemmatization takes into account the grammatical context and morphological analysis of words. This is useful in many NLP tasks like text classification or information retrieval, where words with the same meaning should be treated as one. For example, the lemmatization of the tokens from the previous example would be: ["the", "cat", "be", "sit", "on", "the", "mat"].

To summarize, tokenization is the process of splitting text into smaller units, while lemmatization is the process of reducing words to their base forms. Both techniques are crucial for various NLP tasks, but tokenization focuses on breaking text into meaningful units, and lemmatization focuses on normalizing words to a common base form, considering their context.