0Pricing
NLP Academy · บทเรียน

N-Gram ของอักขระเพื่อความทนทาน

รองรับคำสะกดผิดและคำที่พบได้น้อย

N-Gram ของอักขระเพื่อความทนทาน เป็นบทเรียน NLP Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน NLP Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส NLP Academy มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Word Features Are Fragile

Word-level features break on typos and rare spellings. The model sees runnning as a brand-new word, so a single slip can lose all its signal.

Drop Down to Characters

Instead of whole words, we slice text into short chunks of letters. These overlapping pieces are called character n-grams.

What a 3-gram Looks Like

For the word cat, character 3-grams are simple letter triples. They slide across the text one position at a time to form overlapping chunks.

word = "happy"
grams = [word[i:i+3] for i in range(len(word)-2)]

Why They Survive Typos

The words run and runn share most of their character grams. So a typo changes only a few features instead of erasing the whole word.

Catching Word Families

play, playing, and player all share the gram pla. Character grams quietly link related forms without any stemming step.

Great for Messy Text

Social media, usernames, and product codes are full of odd spellings. Character grams stay robust where word features fall apart.

Switching On Char Mode

scikit-learn makes this one parameter. Set analyzer to char and pick an ngram_range to extract character grams instead of words.

from sklearn.feature_extraction.text import TfidfVectorizer
vec = TfidfVectorizer(analyzer="char", ngram_range=(3, 5))

char_wb Respects Words

The char_wb analyzer only makes grams inside word boundaries, padding each word. It keeps the robustness while avoiding grams that span two words.

vec = TfidfVectorizer(analyzer="char_wb", ngram_range=(2, 4))

Handy for Other Languages

Languages that glue words together or have rich endings are tough for word tokenizers. Character grams sidestep that and stay language-friendly.

The Cost: Bigger Features

Character grams create many more features than words do. That extra dimensionality needs more memory, so keep the range tight.

Best as a Teammate

Character grams shine when combined with word features, not as a replacement. Together they cover both meaning and robustness. 💪

Quick Check

Why do character n-grams handle typos so well?

Recap

Character n-grams slice text into letter chunks, survive typos, and link word families. Use analyzer char in scikit-learn alongside word features. ✅

คำถามที่พบบ่อย

บทเรียน “N-Gram ของอักขระเพื่อความทนทาน” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “N-Gram ของอักขระเพื่อความทนทาน” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส NLP Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส NLP Academy มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “N-Gram ของอักขระเพื่อความทนทาน”

รองรับคำสะกดผิดและคำที่พบได้น้อย คุณปฏิบัติ NLP Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน NLP Academy หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน NLP Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน

บทเรียน “N-Gram ของอักขระเพื่อความทนทาน” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน NLP Academy นี้ได้ไหม

ได้ บทเรียน NLP Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. ก้าวข้ามถุงคำ
  2. N-Gram ของอักขระเพื่อความทนทาน
  3. ผสานคุณลักษณะหลายประเภท
  4. ปรับขนาดและเลือกคุณลักษณะ
← กลับไปที่ NLP Academy