<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Amrithasuvarna on Medium]]></title>
        <description><![CDATA[Stories by Amrithasuvarna on Medium]]></description>
        <link>https://medium.com/@amrithasuvarna52?source=rss-358ab88bdef7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*eSmv-oF9Efpnz254</url>
            <title>Stories by Amrithasuvarna on Medium</title>
            <link>https://medium.com/@amrithasuvarna52?source=rss-358ab88bdef7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 23:39:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amrithasuvarna52/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[LangChain Deep Dive: Architecting Modular LLM Applications from Scratch]]></title>
            <link>https://medium.com/@amrithasuvarna52/langchain-deep-dive-architecting-modular-llm-applications-from-scratch-0d5e71255958?source=rss-358ab88bdef7------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d5e71255958</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Amrithasuvarna]]></dc:creator>
            <pubDate>Sun, 12 Apr 2026 08:18:40 GMT</pubDate>
            <atom:updated>2026-04-12T08:18:40.540Z</atom:updated>
            <content:encoded><![CDATA[<h4>A hands-on, code-driven exploration of chains, agents, memory, and real-world GenAI pipelines using Python and LangChain</h4><h4>1. Introduction to LangChain</h4><p>Large Language Models (LLMs) like GPT have revolutionized how machines understand and generate human language. However, building real-world applications using LLMs is not as simple as sending a prompt and receiving a response. Applications often require multiple steps such as prompt construction, memory handling, external tool usage, and data retrieval.</p><p>This is where <strong>LangChain</strong> comes in.</p><h4>What is LangChain?</h4><p>LangChain is an open-source framework designed to simplify the development of applications powered by LLMs. It enables developers to build<strong> </strong>modular, scalable, and production-ready AI systems by chaining together different components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/0*705HL00CTDLVfbAV" /></figure><h4>Why is LangChain Important?</h4><p>Without LangChain:</p><ul><li>You manually manage prompts</li><li>No structured pipeline</li><li>Hard to integrate tools or memory</li><li>Difficult to scale applications</li></ul><p>With LangChain:</p><ul><li>Modular architecture</li><li>Easy chaining of operations</li><li>Built-in integrations (APIs, tools, databases)</li><li>Rapid prototyping of AI applications</li></ul><h4>Problems it Solves</h4><ul><li><strong>Orchestration</strong>: Managing multiple steps in an LLM pipeline</li><li><strong>Chaining</strong>: Connecting multiple operations logically</li><li><strong>Tool Integration</strong>: Allowing LLMs to use external tools (search, APIs, etc.)</li></ul><h4><strong>2. Core Components of LangChain</strong></h4><p><strong>a)</strong> <strong>LLMs and Chat Models</strong></p><p>LLMs are the core engines that generate responses. LangChain provides wrappers to interact with them easily.</p><p><strong>Why it exists,</strong></p><p>To standardize interaction across different providers like OpenAI and HuggingFace.</p><p><strong>Code Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W85C_LmbKqkAUsn4_edPhA.png" /></figure><p><strong>b)</strong> <strong>Prompts and Prompt Templates</strong></p><p>Prompt templates help structure inputs dynamically.</p><p><strong>Why it exists,</strong></p><p>To avoid hardcoding prompts and enable reusable structures.</p><p><strong>Code Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JXjaUQ8X_3O7n757w7k_ew.png" /></figure><p><strong>c)</strong> <strong>Chains</strong></p><p>Chains combine multiple components into a pipeline.</p><p><strong>Why it exists,</strong></p><p>To automate multi-step processes.</p><p><strong>Code Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rMg4ZEnahXrTP6XsyMyJjg.png" /></figure><p><strong>d)</strong> <strong>Memory</strong></p><p>Memory allows the system to remember past interactions.</p><p><strong>Why it exists,</strong></p><p>To enable conversational continuity.</p><p><strong>Code Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ebIf0r7Et3Qw9CC9qq-4pg.png" /></figure><p><strong>e)</strong> <strong>Agents</strong></p><p>Agents decide which action to take dynamically.</p><p><strong>Why it exists,</strong></p><p>To enable reasoning and tool usage.</p><p><strong>Code Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PEzaZ8oTR3n1SEcAO3FQAg.png" /></figure><p><strong>f)</strong> <strong>Tools, Document Loaders, and Vector Stores</strong></p><p>Tools are external utilities used by agents.</p><p><strong>Why it exists,</strong></p><p>To extend LLM capabilities beyond text generation.</p><p><strong>Code Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fuYU2HVb6vJRwvjWABSdNg.png" /></figure><h4><strong>3. Architecture Explanation</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*l0T2QrDDCbTlPocHNO2bNg.png" /></figure><ul><li><strong>User Input</strong> → The starting point where the user provides a query or request.</li><li><strong>Prompt</strong> → The input is structured into a reusable prompt (often via PromptTemplate).</li><li><strong>LLM</strong> → The prompt is sent to a Large Language Model (like GPT or HuggingFace models) to generate a response.</li><li><strong>Chain</strong> → Chains link multiple steps together, allowing sequential processing (e.g., explanation → summarization).</li><li><strong>Tool/Agent</strong> → Agents decide which external tools to call (like search, calculator, or retrievers) to enrich the response.</li><li><strong>Output</strong> → The final processed answer is delivered back to the user.</li></ul><h4><strong>4. Hands-on Code Examples</strong></h4><ul><li>Basic LLM call</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ty7r-VbLpWBe8nr--6GWZA.png" /></figure><ul><li>PromptTemplate</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PlsR2c84_aWvy9hZ-dmIFA.png" /></figure><ul><li>Simple Chain</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UIyy9hO22vHrlDlItIP2Kg.png" /></figure><ul><li>Agent with tool</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vnHPs_KFvHzggCr01SZTeg.png" /></figure><ul><li>Memory example</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ewh53ROYe2QLmZNzb9TkSg.png" /></figure><h4><strong>5. Real-World Use Cases</strong></h4><p># Use Case 1: Customer Support Chatbot</p><ul><li>Problem: Users need contextual answers.</li><li>Solution: LangChain + Memory + Tools.</li><li>Components: Chat model, memory, FAQ loader.</li></ul><p># Use Case 2: Research Assistant</p><ul><li>Problem: Summarizing academic papers.</li><li>Solution: Document loaders + vector stores.</li><li>Components: Loader, embeddings, retriever.</li></ul><p># Use Case 3: AI Tutor</p><ul><li>Problem: Personalized learning.</li><li>Solution: PromptTemplates + Chains.</li><li>Components: Prompt variations, memory.</li></ul><h4><strong>6. Advantages and Limitations</strong></h4><p><strong>Advantages:</strong></p><ul><li>Modular design</li><li>Easy integration with APIs/tools</li><li>Rapid prototyping</li></ul><p><strong>Limitations:</strong></p><ul><li>Latency with complex chains</li><li>Debugging multi-agent flows</li><li>Cost with large-scale usage</li></ul><p><strong>When NOT to Use LangChain</strong></p><ul><li>Simple single prompt applications</li><li>Low-latency critical systems</li><li>When full control over pipeline is needed</li></ul><h4><strong>7. Conclusion</strong></h4><p>LangChain transforms how developers build LLM applications by introducing structure, modularity, and scalability.</p><p><strong>Key Takeaways</strong></p><ul><li>LangChain simplifies LLM orchestration</li><li>Components like chains, agents, and memory enable complex workflows</li><li>Real-world applications become easier to build</li></ul><p><strong>Learnings</strong></p><p>Understanding LangChain is not just about using APIs — it’s about designing intelligent systems.</p><p><strong>Future Scope</strong></p><ul><li>LangGraph for advanced workflows</li><li>Multi-agent systems</li><li>Autonomous AI pipelines</li></ul><h4>Reference</h4><p>· <a href="https://python.langchain.com/docs/">https://python.langchain.com/docs/</a></p><p>· <a href="https://platform.openai.com/docs/">https://platform.openai.com/docs/</a></p><p>· <a href="https://huggingface.co/docs/transformers/index">https://huggingface.co/docs/transformers/index</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d5e71255958" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Token Classification in NLP: From Words to Meaning]]></title>
            <link>https://medium.com/@amrithasuvarna52/understanding-token-classification-in-nlp-from-words-to-meaning-74427e53f7dc?source=rss-358ab88bdef7------2</link>
            <guid isPermaLink="false">https://medium.com/p/74427e53f7dc</guid>
            <category><![CDATA[chunking]]></category>
            <category><![CDATA[token-classification]]></category>
            <category><![CDATA[parts-of-speech]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[named-entity-recognition]]></category>
            <dc:creator><![CDATA[Amrithasuvarna]]></dc:creator>
            <pubDate>Mon, 06 Apr 2026 15:55:26 GMT</pubDate>
            <atom:updated>2026-04-06T15:56:43.189Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Beginner’s Guide to How Machines Understand Text</h4><h4>Introduction to NLP &amp; Token Classification</h4><p><strong>Natural Language Processing (NLP)</strong> is the branch of artificial intelligence that enables computers to understand and process human language. At its core, NLP breaks down text into smaller units called tokens (usually words or subwords).</p><p><strong>Token classification</strong> is the task of assigning labels to these tokens. This step is crucial because it allows machines to interpret the role and meaning of each word in context.</p><p><strong>Why Token-Level Understanding Matters?</strong><br>• Chatbots: Extract user intent and entities.<br>• Search Engines: Understand queries by tagging words as nouns, verbs, or named entities.<br>• Information Extraction: Pull structured data from unstructured text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/0*gw91Xp7iySiBxEZ4" /></figure><h4>Named Entity Recognition (NER)</h4><p>Named Entity Recognition (NER) in NLP focuses on identifying and categorizing important information known as entities in text. These entities can be names of people, places, organizations, dates, etc. It helps in transforming unstructured text into structured information which helps in tasks like text summarization, knowledge graph creation and question answering.</p><p>Example:<br>“Microsoft was founded in 1975 in the United States.”<br>• Microsoft → ORG<br>• 1975 → DATE<br>• United States → LOC</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*5abEskyY9sKkH81ontkLgw.png" /></figure><p><strong>BIO Tagging Concept</strong></p><p>BIO tagging (Inside, Outside, Beginning) is a standard computational linguistics format for tagging tokens in named entity recognition (NER) tasks. It identifies entity boundaries (beginning/interior) and types (e.g., person, location) by tagging tokens with <strong>B-</strong> (begin), <strong>I-</strong> (inside), or <strong>O-</strong> (outside). This format disambiguates consecutive entities.</p><p>Key BIO Tagging Concepts</p><ul><li><strong>B- (Begin):</strong> Indicates the first token of a named entity (e.g., B-PER).</li><li><strong>I- (Inside):</strong> Indicates subsequent tokens of the same entity (e.g., I-PER). A B- tag is used only when an entity immediately follows another of the same type</li><li><strong>O (Outside):</strong> Indicates the token does not belong to any entity.</li></ul><p>Example:<br>Person (PER) and Location (LOC)</p><p>Sentence: “John Doe lives in New York.”</p><p>Tagged:</p><ul><li>John -&gt; B-PER</li><li>Doe -&gt; I-PER</li><li>lives -&gt; O</li><li>in -&gt; O</li><li>New -&gt; B-LOC</li><li>York -&gt; I-LOC</li><li>. -&gt; O</li></ul><p>Applications:<br>• Healthcare: Extract diseases and drug names from medical records.<br>• Finance: Identify companies and monetary values in reports.<br>• Customer Support: Detect product names and complaint categories.</p><h4>Part-of-Speech (POS) Tagging</h4><p>Parts of Speech (PoS) tagging is a fundamental task in Natural Language Processing (NLP) where each word in a sentence is assigned a grammatical category such as noun, verb, adjective or adverb. This process help machines to understand the structure and meaning of sentences by identifying the roles of words and their relationships.</p><p>Example:<br>“The dog barked loudly.”<br>• The → Determiner<br>• Dog → Noun<br>• Barked → Verb<br>• Loudly → Adverb</p><p><strong>Types of POS Tagging</strong></p><p><strong>1. Rule-Based Tagging</strong></p><p><a href="https://www.geeksforgeeks.org/nlp/nlp-part-of-speech-default-tagging/">Rule-based POS tagging</a> assigns POS tags based on predefined grammatical rules. These rules are crafted based on morphological features (like word endings) and syntactic context, making the approach highly interpretable and transparent.</p><p>Example:</p><p>1. Rule: Assign the POS tag “Noun” to words ending in “-tion” or “-ment”.</p><p>2. Sentence: “The presentation highlighted the key achievements of the project’s development.”</p><p>3. Tagged Output:</p><ul><li>“presentation” → Noun (N)</li><li>“highlighted” → Verb (V)</li><li>“development” → Noun (N)</li></ul><p><strong>2. Transformation-Based Tagging (TBT)</strong></p><p>TBT refines POS tags through a series of context-based transformations. Unlike statistical taggers that rely on probabilities or rule-based taggers, it starts with initial tags and improves them iteratively by applying transformation rules.</p><p>Example:</p><ul><li>Text: “The cat chased the mouse.”</li><li>Initial Tags: “The” — DET, “cat” — NOUN, “chased” — VERB, “the” — DET, “mouse” — NOUN</li><li>Rule Applied: Change “chased” from Verb to Nounbecause it follows “the”.</li><li>Updated Tags: “chased” becomes Noun.</li></ul><p><strong>3. Statistical POS Tagging</strong></p><p>It uses probabilistic models to assign grammatical categories (e.g noun, verb, adjective) to words in a text. Unlike rule-based methods which rely on handcrafted rules, it learns patterns from large annotated corpora using machine learning techniques.</p><p>These models calculate the likelihood of a tag based on a word and its context, helping to resolve ambiguities and handle complex grammar. Common models include:</p><ul><li>Hidden Markov Models (HMMs)</li><li>Conditional Random Fields (CRFs)</li></ul><p><strong>Why POS Tagging is Important?</strong></p><ul><li><strong>Grammar Awareness:</strong> POS tags help systems understand how words relate to each other, enabling syntactic parsing and sentence-level analysis.</li><li><strong>Semantic Clarity:</strong> Distinguishing between nouns, verbs, adjectives, and adverbs allows models to capture meaning more accurately.</li><li><strong>Contextual Understanding:</strong> Words often change meaning depending on their role. For example:</li></ul><p>“Book a ticket” → Book = Verb</p><p>“Read a book” → Book = Noun</p><ul><li><strong>Downstream Tasks:</strong> POS tagging improves performance in higher-level NLP tasks such as:</li></ul><p>&lt;&gt; <strong>Machine Translation</strong> (preserving grammar across languages)</p><p>&lt;&gt; <strong>Information Retrieval</strong> (understanding query intent)</p><p>&lt;&gt;<strong> Sentiment Analysis</strong> (detecting emotional tone through adjectives/adverbs)</p><p>&lt;&gt; <strong>Text Summarization</strong> (identifying key subjects and actions)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*veAtJRx_thLjTfAG6jTgPQ.png" /></figure><h4>Chunking (Phrase Detection)</h4><p>Chunking is defined as the process of natural language processing used to identify parts of speech and short phrases present in a given sentence. Chunking groups tokens into meaningful phrases (noun phrases, verb phrases). It builds on POS tagging to identify higher-level structures.</p><p>Example:</p><p>“The quick brown fox” → [Noun Phrase]</p><p>“Jumped over the lazy dog” → [Verb Phrase]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*iw3x_NOpJpUtsLyUk67hCg.png" /><figcaption>Difference from NER</figcaption></figure><p><strong>Use Cases</strong></p><ul><li>Text summarization: Identify key phrases.</li><li>Question answering: Extract subject and object phrases.</li><li>Information retrieval: Improve search relevance.</li></ul><h4>Comparison of Techniques: NER vs POS Tagging vs Chunking</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*YGSp7Uy-mH-VhS4SESL82Q.png" /></figure><h4>Code Implementation with Hugging Face</h4><p>NER:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*RN4mAr3YAjnj1KSGluPxJw.png" /></figure><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z3veqhGi2Assu05K-XhPcA.png" /></figure><p>POS Tagging:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*olnsFnR-BbAI4PFc_2kYow.png" /></figure><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*rLzilCyUKJAJJw2LRt_Wzg.png" /></figure><p>Chunking:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*o1gGq50qah0_5dH-h3i8nA.png" /></figure><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*o84bc1CZiO2YM1AVcaVDsg.png" /></figure><h4>Transformer-Based Approach</h4><p>Modern models like BERT revolutionized token classification. Unlike traditional methods, BERT uses contextual embeddings, meaning each word’s meaning depends on its surrounding words.</p><p>Example:<br>• “Bank” in river bank vs money bank → BERT distinguishes based on context.</p><p><strong>How Transformers Perform Token Classification?</strong><br>1. Input text is split into subword tokens.<br>2. Each token passes through transformer layers.<br>3. The model outputs labels for each token (e.g., PERSON, VERB, LOC).</p><p>Advantages:<br>• Handles ambiguity better.<br>• Learns from massive datasets.<br>• Achieves state-of-the-art accuracy in NER, POS tagging, and chunking.</p><h4>Conclusion</h4><p>Token classification is the backbone of NLP. By labeling words as entities, grammatical roles, or phrases, machines gain the ability to interpret language with precision.<br>• NER extracts meaning.<br>• POS tagging provides structure.<br>• Chunking builds higher-level understanding.<br>• Transformers push accuracy to new heights.</p><h4>References</h4><ul><li><a href="https://www.geeksforgeeks.org/nlp/token-classification-in-natural-language-processing/">https://www.geeksforgeeks.org/nlp/token-classification-in-natural-language-processing/</a></li><li><a href="https://huggingface.co/docs/transformers/en/tasks/token_classification">https://huggingface.co/docs/transformers/en/tasks/token_classification</a></li><li><a href="https://www.tutorialspoint.com/natural_language_processing/natural_language_processing_part_of_speech_tagging.htm">https://www.tutorialspoint.com/natural_language_processing/natural_language_processing_part_of_speech_tagging.htm</a></li><li><a href="https://www.techtarget.com/whatis/definition/named-entity-recognition-NER">https://www.techtarget.com/whatis/definition/named-entity-recognition-NER</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74427e53f7dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Words to Vectors: Building an NLP Pipeline]]></title>
            <link>https://medium.com/@amrithasuvarna52/words-to-vectors-building-an-nlp-pipeline-1974e6bdea54?source=rss-358ab88bdef7------2</link>
            <guid isPermaLink="false">https://medium.com/p/1974e6bdea54</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[text-analysis]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[nlp-pipeline]]></category>
            <category><![CDATA[word-to-vector]]></category>
            <dc:creator><![CDATA[Amrithasuvarna]]></dc:creator>
            <pubDate>Mon, 30 Mar 2026 07:25:08 GMT</pubDate>
            <atom:updated>2026-03-30T13:05:34.017Z</atom:updated>
            <content:encoded><![CDATA[<h4>Understanding of the <strong>Natural Language Processing (NLP) pipeline</strong></h4><h4>Introduction: Why Machines Struggle with Language</h4><p>Humans are naturally good at understanding language. Even if a sentence has emojis, slang, or mistakes, we can still interpret its meaning.</p><p>“This phone is sooo good 😍”</p><p>We immediately understand that the sentiment is positive.</p><p>However, machines don’t think this way. They don’t understand meaning — they only process patterns and numbers. For a machine, text is just a sequence of characters without context. This is where <strong>Natural Language Processing (NLP)</strong> comes in.</p><h4>What is NLP?</h4><p>Natural Language Processing is a field of Artificial Intelligence that focuses on enabling machines to read, understand, and derive meaning from human language.</p><p>But before a machine can do anything useful with text, it must go through a structured process called an <strong>NLP pipeline</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/0*0sf1K8V97_dJH1iE" /></figure><h4>Why is preprocessing necessary?</h4><p>Raw text data is:</p><ul><li>Unstructured</li><li>Inconsistent</li><li>Noisy</li></ul><p>Machine learning models require clean, structured, and numerical input.</p><p>So preprocessing helps to:</p><ul><li>Reduce noise</li><li>Standardize text</li><li>Improve model accuracy</li></ul><h4>NLP Pipeline Steps</h4><h4><strong>Step 1: Text Preprocessing (Cleaning + Normalization)</strong></h4><p><strong>1.Lowercasing</strong></p><p>Lowercasing is a normalization technique where all characters are converted into lowercase to maintain consistency.<br>Machine learning models treat words with different cases as different tokens.<br>For example, “Data” and “data” would be counted separately, which creates redundancy.</p><p>Example:<br>“Machine Learning” → “machine learning”</p><p><strong>2. Removal of Punctuation</strong><br>Punctuation marks are removed because they usually do not contribute to the semantic meaning in most NLP tasks.<br>Keeping punctuation increases vocabulary size unnecessarily and introduces noise.</p><p>Example:<br>“Great!!!” → “Great”</p><p><strong>3. Stop-word Removal</strong></p><p>Stop-words are frequently occurring words (like <em>is, the, in</em>) that carry minimal semantic meaning.</p><ul><li>Reduces dimensionality</li><li>Improves processing speed</li><li>Focuses on meaningful words</li></ul><p>Example:<br>“This is a great product” → “great product”</p><p><strong>4. Tokenization</strong></p><p>Tokenization is the process of splitting text into smaller units called tokens (words, phrases, or sentences).<br>It is the foundational step for further processing since models work on tokens, not full sentences.</p><p>Example:<br>“I love NLP” → [“I”, “love”, “NLP”]</p><p><strong>5. Stemming</strong></p><p>Stemming reduces words to their root form by removing suffixes.<br>It groups similar words together, reducing vocabulary size. It may produce non-meaningful roots.</p><p>Example:<br>“playing”, “played” → “play”</p><p><strong>6. Lemmatization</strong></p><p>Lemmatization converts words to their base form using vocabulary and morphological analysis. Unlike stemming, it preserves meaning and produces valid words.</p><p>Example:<br>“better” → “good”</p><p><strong>7. Emojis</strong></p><p>Emojis carry emotional and contextual information.<br>Removing them may lead to loss of sentiment information.<br>By convert emojis into textual meaning we can reduce the information loss (e.g., 😍 → “love”)</p><p><strong>8. URLs and Special Characters</strong></p><p>URLs and special symbols usually do not contribute to linguistic meaning.They introduce noise and increase irrelevant features.</p><p>Example:<strong><br></strong> “Check this amazing product!!! <a href="https://example.com/">https://example.com</a> 😍 #sale”<br> → “check amazing product sale”</p><p><strong>9. Slangs and Abbreviations</strong></p><p><strong>Slang</strong> refers to informal and conversational words or phrases commonly used in everyday communication, especially on social media.</p><p>Slang words are often not part of standard vocabulary, so NLP models may fail to understand their actual meaning.</p><p>Example:<br>“gonna”, “wanna”, “lit”, “bro”</p><p><strong>Abbreviations</strong> are shortened forms of words or phrases used to save time while typing.Models may treat abbreviations as separate words, leading to incorrect interpretation.</p><p>Example:<br>“u” → “you”, “btw” → “by the way”, “lol” → “laughing out loud”</p><p><strong>10. Misspellings</strong></p><p>Misspellings occur when words are incorrectly written due to typing errors or informal usage. Misspelled words increase vocabulary size and reduce model accuracy.</p><p>Example:<br>“gud” → “good”, “recieve” → “receive”</p><h4>Step 2: Feature Engineering (Vectorization)</h4><p><strong>1.Bag of Words (BoW)</strong></p><p>BoW represents text as a vector of word frequencies. It turns text like sentence, paragraph or document into a collection of words and counts how often each word appears but ignoring the order of the words. It does not consider the order of the words or their grammar but focuses on counting how often each word appears in the text.</p><p>Each unique word becomes a feature, and its value is the count in the document.</p><ul><li>It’s simple</li><li>Easy to implement</li></ul><p>Limitations:</p><ul><li>Ignores word order</li><li>No semantic meaning</li><li>Produces sparse matrices</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/0*YLXvfqd5dBBxepfe.png" /></figure><p><strong>2. TF-IDF (Term Frequency-Inverse Document Frequency)</strong></p><p>TF-IDF (Term Frequency–Inverse Document Frequency) is a statistical method used in natural language processing and information retrieval to evaluate how important a word is to a document in relation to a larger collection of documents. TF-IDF combines two components:</p><p>a. Term Frequency (TF): Measures how often a word appears in a document. A higher frequency suggests greater importance. If a term appears frequently in a document, it is likely relevant to the document’s content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/1*8puKIXwUWOX9f53WnX29-g.png" /></figure><p>b. Inverse Document Frequency (IDF): Reduces the weight of common words across multiple documents while increasing the weight of rare words. If a term appears in fewer documents, it is more likely to be meaningful and specific.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*1K8S35Rsf1-pmW_rpW3hQw.png" /></figure><p>Let’s take an example,</p><ol><li>Document 1: “The cat sat on the mat.”</li><li>Document 2: “The dog played in the park.”</li><li>Document 3:<strong> </strong>“Cats and dogs are great pets.”</li></ol><p>Step 1: Calculate Term Frequency (TF)</p><p>For Document 1:</p><ul><li>The word <strong>“</strong>cat<strong>”</strong> appears 1 time.</li><li>The total number of terms in Document 1 is 6 (“the”, “cat”, “sat”, “on”, “the”, “mat”).</li><li>So, TF(cat,Document 1) = 1/6</li></ul><p>For Document 2:</p><ul><li>The word <strong>“</strong>cat<strong>”</strong> does not appear.</li><li>So, TF(cat,Document 2)=0.</li></ul><p>For Document 3:</p><ul><li>The word <strong>“</strong>cat” appears 1 time.</li><li>The total number of terms in Document 3 is <strong>6</strong> (“cats”, “and”, “dogs”, “are”, “great”, “pets”).</li><li>So TF (cat,Document 3)=1/6</li></ul><p>In Document 1 and Document 3 the word <strong>“</strong>cat<strong>”</strong> has the same TF score. This means it appears with the same relative frequency in both documents. In Document 2 the TF score is 0 because the word <strong>“</strong>cat<strong>”</strong> does not appear.</p><p>Step 2: Calculate Inverse Document Frequency (IDF)</p><ul><li>Total number of documents in the corpus (D): 3</li><li>Number of documents containing the term “cat”: 2 (Document 1 and Document 3).</li></ul><blockquote><em>IDF (cat,D) = log3/2 ≈ 0.176</em></blockquote><p>Step 3: Calculate TF-IDF</p><p>The TF-IDF score for “cat” is 0.029 in Document 1 and Document 3 and 0 in Document 2 that reflects both the frequency of the term in the document (TF) and its rarity across the corpus (IDF).</p><p>The TF-IDF score is the product of TF and IDF:</p><ul><li>For Document 1: TF-IDF (cat, Document 1, D)-0.167 * 0.176 - 0.029</li><li>For Document 2: TF-IDF(cat, Document 2, D)-0x 0.176 - 0</li><li>For Document 3: TF-IDF (cat, Document 3, D)-0.167 x 0.176 ~ 0.029</li></ul><p><strong>3. Word2Vec</strong></p><p>Word2Vec is a word embedding technique in natural language processing (NLP) that allows words to be represented as vectors in a continuous vector space. It maps words to high-dimensional vectors to capture the semantic relationships between words.<br>Words appearing in similar contexts have similar meanings.</p><ul><li>Captures semantic relationships</li><li>Produces dense vectors</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*xFa1UZ3Ybhbq4208LbLZ1Q.png" /></figure><h4>NLP Pipeline Flow</h4><ul><li><strong>Raw Text</strong><br>This is the original input, which is usually unstructured and messy (e.g., sentences with emojis, punctuation, etc.).</li><li><strong>Cleaning</strong><br>Removes unwanted elements like URLs, special characters, and extra spaces to reduce noise.</li><li><strong>Preprocessing</strong><br>Standardizes the text using steps like lowercasing, tokenization, and removing stopwords.</li><li><strong>Feature Extraction</strong><br>Converts the cleaned text into numerical form using techniques like Bag of Words, TF-IDF, or Word2Vec.</li><li><strong>Model Input</strong><br>The numerical data is finally fed into a machine learning model for tasks like classification or prediction.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L4npJnWd4V0HCHe5GCr8hg.png" /></figure><h4>Where is NLP Used in Real Life?</h4><ul><li><strong>Chatbots &amp; Virtual Assistants</strong><br>Whenever you chat with customer support or talk to assistants like Alexa or Google Assistant, NLP is working behind the scenes to understand your queries and respond intelligently.</li><li><strong>Sentiment Analysis</strong><br>Companies use NLP to understand what people feel about their products by analyzing reviews, tweets, and feedback — whether it’s positive, negative, or neutral.</li><li><strong>Search Engines</strong><br>When you type something into Google, it doesn’t just match keywords — it tries to understand what you actually <em>mean</em>. That’s NLP helping deliver more relevant results.</li><li><strong>Spam Detection</strong><br>Ever noticed how your email filters spam automatically? NLP helps identify suspicious or unwanted messages based on their content.</li><li><strong>Machine Translation</strong><br>Tools like Google Translate use NLP to convert text from one language to another, making communication across languages much easier.</li></ul><h4>Challenges in NLP</h4><ul><li><strong>Ambiguity in Language</strong><br>A single word can have multiple meanings depending on context. For example, the word “bank” could refer to a financial institution or the side of a river.</li><li><strong>Slang &amp; Informal Language</strong><br>People often use casual language, abbreviations, or slang on social media, which makes it harder for models to interpret the actual meaning.</li><li><strong>Sarcasm &amp; Irony</strong><br>Humans can easily detect sarcasm, but machines struggle. A sentence like “Great, another exam!” might actually express frustration, not happiness.</li><li><strong>Multilingual Complexity</strong><br>Handling multiple languages, dialects, and regional variations is a big challenge, especially in a country like India.</li><li><strong>Noisy Data (URLs, Emojis, Special Characters)</strong><br>Real-world text is messy. Emojis, links, and symbols can either add meaning or create noise, making it harder for models to process accurately.</li></ul><h4>References</h4><ol><li><a href="https://medium.com/@asjad_ali/understanding-the-nlp-pipeline-a-comprehensive-guide-828b2b3cd4e2">https://medium.com/@asjad_ali/understanding-the-nlp-pipeline-a-comprehensive-guide-828b2b3cd4e2</a></li><li><a href="https://www.kaggle.com/code/nilaychauhan/getting-started-with-nlp-pipelines">https://www.kaggle.com/code/nilaychauhan/getting-started-with-nlp-pipelines</a></li><li><a href="https://airbyte.com/data-engineering-resources/natural-language-processing-pipeline">https://airbyte.com/data-engineering-resources/natural-language-processing-pipeline</a></li><li><a href="https://www.analytixlabs.co.in/blog/building-custom-nlp-pipeline/">https://www.analytixlabs.co.in/blog/building-custom-nlp-pipeline/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1974e6bdea54" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lists vs Tuples in Python: When Should You Use Which?]]></title>
            <link>https://medium.com/@amrithasuvarna52/lists-vs-tuples-in-python-when-should-you-use-which-4298f69c8e21?source=rss-358ab88bdef7------2</link>
            <guid isPermaLink="false">https://medium.com/p/4298f69c8e21</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[coding-basics]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Amrithasuvarna]]></dc:creator>
            <pubDate>Sun, 15 Feb 2026 18:59:36 GMT</pubDate>
            <atom:updated>2026-03-30T13:10:06.189Z</atom:updated>
            <content:encoded><![CDATA[<h4>List or Tuple when, why and where to use</h4><h4>Introduction</h4><p>When you start learning Python, one of the first things you encounter is the ability to store multiple values together. Python gives us several options for this, but two of the most common are <strong>lists</strong> and <strong>tuples</strong>. At first glance, they look almost identical: both are ordered collections, both can hold mixed data types, and both are widely used.</p><p>So why does Python have both? The answer lies in their <strong>mutability, performance, memory usage, and practical applications</strong>. Understanding these differences will help you write cleaner, faster, and more reliable code. In this blog, we’ll explore these aspects step by step, with examples and real-world scenarios.</p><h4>Lists and Tuples: The Basics</h4><ul><li><strong>List</strong>: A mutable, ordered collection. You can add, remove, or modify elements.</li><li><strong>Tuple</strong>: An immutable, ordered collection. Once created, its elements cannot be changed.</li></ul><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*ILeTVx64MZaw_nZ-a2EZqQ.png" /></figure><h4>Mutability: The Key Difference</h4><p>Mutability is the <strong>biggest distinction</strong> between lists and tuples.</p><ul><li><strong>Lists are mutable</strong>: You can change their contents after creation.</li><li><strong>Tuples are immutable</strong>: Once defined, they cannot be altered.</li></ul><p>Their immutability ensures that once defined, values remain unchanged, helping maintain accuracy in your program.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*TNvE4ZsAiLFNsnj7JsTf6g.png" /></figure><h4>Performance</h4><p>Tuples are generally <strong>faster</strong> than lists. Why?</p><ul><li>Lists need extra overhead to support dynamic resizing.</li><li>Tuples are fixed so that Python can optimize their storage and iteration</li></ul><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*XKHSfIb_d5nBS_MKlNf5BA.png" /></figure><p>You’ll usually see tuples perform slightly faster in such tests. While the difference may be small, it matters in performance-critical applications.</p><h4>Memory Usage</h4><p>Tuples consume <strong>less memory</strong> compared to lists. Tuples take fewer bytes. This makes them more efficient when storing large amounts of fixed data.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C3QhiKkhLoOAJXtdeNJnFw.png" /></figure><h4>Real-World Use Cases</h4><p>When to Use Lists</p><ul><li><strong>Dynamic data</strong>: When you frequently need to add or remove items.</li><li><strong>Examples</strong>:</li><li>Shopping cart items in an e-commerce app</li><li>Student grades that may change</li><li>Logs or records that grow over time</li></ul><p>When to Use Tuples</p><ul><li><strong>Fixed data</strong>: data that should not change.</li><li><strong>Examples</strong>:</li><li>Geographic coordinates (latitude, longitude)</li><li>Configuration settings</li><li>Keys in dictionaries</li></ul><h4>Advantages and Limitations</h4><p>Lists</p><ul><li>Flexible and easy to modify</li><li>Great for dynamic datasets</li><li>Larger memory footprint</li><li>Slightly slower compared to tuples</li></ul><p>Tuples</p><ul><li>Faster and more memory-efficient</li><li>Immutable (safer for fixed data)</li><li>Can be used as dictionary keys</li><li>Cannot be modified once create</li></ul><h4>Conclusion</h4><p>Choosing between lists and tuples isn’t just about syntax; it’s about design. Lists are ideal for data that changes, while tuples are best when you need collections that remain constant. As you build larger projects, this choice can affect speed, memory, and even security. Understanding these trade-offs today will prepare you for writing scalable, professional-grade Python applications tomorrow.</p><h4>References</h4><ul><li><strong>GeeksforGeeks</strong> — (<a href="http://geeksforgeeks.org/">geeksforgeeks.org</a> in Bing)</li><li><strong>Real Python</strong> — (<a href="http://realpython.com/">realpython.com</a> in Bing)</li><li><strong>Udacity Blog</strong> —(<a href="http://udacity.com/">udacity.com</a> in Bing)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4298f69c8e21" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>