Urgent.News

What's breaking now, across thousands of outlets.

Tech

I Tried to Teach a Computer "Apple" (It Thought It Was a Fruit, an iPhone, and a Vector)

Hello, DEV Community! ๐Ÿ™Œ Itโ€™s my first time writing here. As I was studying how models handle text today, I ran into a funny realization: computers don't understand human words at all. They only understand numbers. So how do we explain to a model that a cat is a pet, an apple can be a fruit or a tech company? Here is what I learned today about Word Embedding , explained from a pure logic andโ€ฆ

Hello, DEV Community! ๐Ÿ™Œ I'm writing my first post here on the topic of how computers understand language. As I explored how models handle text, I realized the surprising truth: computers don't comprehend human words, they only understand numbers. To make a computer grasp concepts like words having multiple meanings, I discovered the power of word embedding techniques.

The first step in turning words into numbers is one-hot encoding. This method assigns a unique binary code to each word in a giant list. For example, the words "cat," "dog," and "apple" would be represented as separate arrays of 1s and 0s. However, this approach has significant drawbacks - it wastes a tremendous amount of memory by creating large arrays filled with unnecessary zeros.

Moreover, computers don't have any inherent understanding of the relationships between words; they treat each word as a completely separate entity.

Researchers like Mikolov et al. at Google introduced a more efficient alternative called Word Embedding. Instead of using one-hot encoding, Word Embedding represents words as points in a high-dimensional space. These points are plotted using dozens to hundreds of invisible dimensions, each representing a hidden concept such as "is_animal," "is_food," "is_tech," or "grammatical_type." For instance, the word "apple" would be plotted near the cluster of fruit-related concepts and also close to the "iPhone" neighborhood.

The computer learns these coordinates by sliding a "context window" across millions of sentences on the internet. It observes which words consistently appear together in similar contexts, allowing it to cluster words with similar meanings in close proximity on the coordinate map. Because the computer processes vast amounts of data, it effectively "reads" the relationships between words and places them accordingly on the vector space.

One of the most fascinating aspects of word embedding is the ability to perform mathematical operations on word coordinates. For example, the famous equation "King - Man + Woman = Queen" demonstrates how you can manipulate word vectors to derive new meanings. By starting at the coordinate for "King," subtracting the "male" direction, and adding the "female" direction, the resulting coordinate lands on the "Queen" word.

This powerful geometric concept showcases the deep semantic connections that word embedding techniques can reveal.

In conclusion, word embedding provides a valuable framework for bridging the gap between machine language and human language. By representing words as high-dimensional points in a geometric space, computers can begin to understand the nuanced relationships and meanings inherent in human words. This innovative approach has opened up exciting possibilities for natural language processing and has become an essential tool in modern AI applications.

Written by urgent.news from Dev.to's reporting โ€” not their text. Machine-written โ€” may contain errors; check the original before relying on it.

Read the original at dev.to โ†’

More in Tech

Curate Verifiable ActiveAdmin 4 Themes with Markdown and CI

When a Rails theme claims ActiveAdmin 4 support, the difficult part is often not finding a screenshot. It is checking whether the theme actually targets ActiveAdmin 4's Tailwind-based asset modelโ€ฆ

  • Curated directory of ActiveAdmin 4 themes
  • Repository focuses on documentation and links
  • GitHub Actions ensures Markdown validity

Not the 90s?

Oh, yeah, those were the days? No, the 1990s werenโ€™t better. We devs werenโ€™t better, the users werenโ€™t better, and, hell, payment wasnโ€™t better.

  • Developers in the 90s faced tool and system shortcomings
  • Users appreciated improvements that enhanced experience
  • Current approach relies on prompting, potentially leading to suboptimal solutions

CDA Seals Office of Green Homes Islamabad

The Capital Development Authority (CDA) has ordered the sealing of the marketing and site offices of Green Homes/Valley on Karor โ€ฆ Read More The post CDA Seals Office of Green Homes Islamabad appearedโ€ฆ

Decoding iPhone HEIC images in the browser with WebAssembly (no server, no uploads)

Every "free HEIC converter" website I found had the same privacy model: upload your photos to my server, wait, download the result. Family photos. Screenshots. Whatever was in your camera roll.

  • SnappyKit converts HEIC images to JPG, PNG, WebP, or AVIF in browser
  • libheif library integrated into WebAssembly for local decoding
  • WASM module lazy-loaded, memory freed explicitly to prevent leaks

The Real Cost of Returning the Identity Value in EF Core

When you insert thousands of rows into SQL Server with Entity Framework Core, performance drops quickly. Most developers blame change tracking.

  • EF Core makes extra round-trip to database for identity values
  • SQL Server auto-increment primary key triggers this overhead
  • Large batches suffer significant performance slowdown

More from Wednesday 30 September โ†’