<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: abijuru diana</title>
    <description>The latest articles on DEV Community by abijuru diana (@abijuru_diane).</description>
    <link>https://dev.to/abijuru_diane</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4151851%2Ffe0f902a-8bcc-43f5-94f7-e03aecce6931.jpg</url>
      <title>DEV Community: abijuru diana</title>
      <link>https://dev.to/abijuru_diane</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abijuru_diane"/>
    <language>en</language>
    <item>
      <title>word embeddings in NLP</title>
      <dc:creator>abijuru diana</dc:creator>
      <pubDate>Wed, 30 Sep 2026 14:42:48 +0000</pubDate>
      <link>https://dev.to/abijuru_diane/word-embeddings-in-nlp-1gmd</link>
      <guid>https://dev.to/abijuru_diane/word-embeddings-in-nlp-1gmd</guid>
      <description>&lt;h2&gt;
  
  
  what is word embeddings?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;word embedding is techniques of NLP that mapps the text into lists of vectors to represent word's meaning.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  how does word embeddings works?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;numerical conversion&lt;/p&gt;

&lt;p&gt;vector space&lt;/p&gt;

&lt;p&gt;semantic clustering&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Why does this word embeddings matters?
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;word embedding&lt;/strong&gt; matters because they were the step to make machine work  with meaning instead of just spelling.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ex: before word embeddings machine could take like "good" and "great" as unrelated data but after word embeddings model can treat them as related because of the &lt;em&gt;"vector space"&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;they enable transfer learning.&lt;br&gt;
--&amp;gt; word embeddings can be reuse in many small project,the model starts from the general langauge knowledge instead of starting from scracth. you dont need to relearn what langauge mean everytime you run a new project&lt;/p&gt;

&lt;p&gt;they are the sourced applications&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Word embedding Methods:
&lt;/h2&gt;

&lt;p&gt;Normally in word embedddings we have the &lt;strong&gt;3-be-called-approaches&lt;/strong&gt; :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;count/frequency-based&lt;/strong&gt; :This methods describe how often the words are in the sentence. &lt;br&gt;
...This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;BoW (Bag-Of-Word)&lt;/li&gt;
&lt;li&gt;TF-IDF(Term Frequency-Inverse Document Frequency)&lt;/li&gt;
&lt;li&gt;Co-occurrence Matrix&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;prediction-based&lt;/strong&gt; :Methods use neural networks to learn word representations based on surrounding context.&lt;br&gt;
...This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Word2Vec&lt;/li&gt;
&lt;li&gt;GloVe&lt;/li&gt;
&lt;li&gt;FastText&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Contextual embeddings&lt;/strong&gt;: This method generates dynamic vectors that change depending on the surrounding sentence, effectively handling polysemy&lt;br&gt;
...This includes:&lt;br&gt;
  -ELMo (Embeddings from Language Models)&lt;br&gt;
  -Transformers models(BERT, GPT&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  FOCUS: Prediction-Based Methods:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;u&gt;&lt;strong&gt;Word2Vec&lt;/strong&gt;&lt;/u&gt;
Here we train neural network to guess which words appear near each    other.Word2Vec looks at the context of words in a large text dataset. Words that appear in similar settings get vector coordinates close to each other in a multi-dimensional space. It uses two main architectures:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;• CBOW (Continuous Bag of Words): Predicts a target center word using its surrounding context words. It works faster for frequent words.&lt;br&gt;
  • Skip-gram: Predicts the surrounding context words by taking a single target center word as input. It performs better with smaller datasets and rare words.&lt;/p&gt;

&lt;p&gt;example of codes:&lt;br&gt;
`from gensim.models import Word2Vec&lt;/p&gt;

&lt;p&gt;sentences = [&lt;br&gt;
    ["Paul", "is", "driving", "the", "car"],&lt;br&gt;
    ["mary", "is", "driving", "a", "biycle"],&lt;br&gt;
    ["Cat", "drank", "the", "whole", "milk",]&lt;/p&gt;

&lt;p&gt;]&lt;br&gt;
model = Word2Vec(&lt;br&gt;
    sentences,&lt;br&gt;
    vector_size=100,&lt;br&gt;
    window=5,&lt;br&gt;
    min_count=1,&lt;br&gt;
    sg=1,&lt;br&gt;&lt;br&gt;
    negative=5,&lt;br&gt;
    epochs=50,&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;print(model.wv["driving"])&lt;br&gt;&lt;br&gt;
print(model.wv.most_similar("driving"))&lt;br&gt;&lt;br&gt;
print(model.wv.similarity("biycle", "car")) &lt;br&gt;
`&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;gensim.models&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Word2Vec&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;1.--&amp;gt;Load the Word2Vec tool&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;sentences&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[[...],&lt;/span&gt; &lt;span class="p"&gt;[...],&lt;/span&gt; &lt;span class="p"&gt;[...]]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.--&amp;gt;A list of sentences, each a list of words&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nc"&gt;Word2Vec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sentences&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.--&amp;gt;Learn a vector for every word&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;wv&lt;/span&gt;&lt;span class="p"&gt;[...],&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;most_similar&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;similarity&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4.--&amp;gt;Look at the results&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What i learned:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.What is embeddings&lt;br&gt;
2.How is word embedding giving high volume to today's tech&lt;br&gt;
3.How is it applied through different ways&lt;br&gt;
4.Word2Vec approach&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sources&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://d2l.ai/index.html" rel="noopener noreferrer"&gt;https://d2l.ai/index.html&lt;/a&gt; : from the book of &lt;strong&gt;dive into deep learning&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;-&lt;strong&gt;Chatgpt&lt;/strong&gt; : some informations were prompted from chatgpt&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Google&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>nlp</category>
      <category>python</category>
    </item>
  </channel>
</rss>
