Elasticsearch & Full Text Search Systems · บทเรียน

คำพ้องความหมายและการลดรูปคำ

เพิ่มความครอบคลุมของการค้นหาข้อความเต็มด้วยการสอนให้ Elasticsearch รู้จักรูปแบบคำและคำที่มีความหมายเท่ากัน โดยใช้ตัวกรองโทเค็นสำหรับการลดรูปคำและคำพ้องความหมาย

บทเรียน 4 จาก 413 ขั้นตอน

คำพ้องความหมายและการลดรูปคำ เป็นบทเรียน Elasticsearch & Full Text Search Systems ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Elasticsearch & Full Text Search Systems และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Elasticsearch & Full Text Search Systems มีบทเรียนทั้งหมด 4 บทเรียน

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

Closing the Vocabulary Gap

Users rarely type the exact words stored in your documents. They search running but your text says run, or they type laptop when the doc says notebook. Two analysis techniques bridge this gap: stemming and synonyms.

What Stemming Does

Stemming reduces words to a common root form. running, runs, and ran may all become run. This means a query matches regardless of the grammatical form used.

Algorithmic Stemmers

Elasticsearch ships algorithmic stemmers like porter_stem and the language-aware stemmer filter. They apply rules to strip suffixes quickly without a dictionary.

"filter": {
  "my_stemmer": {
    "type": "stemmer",
    "language": "english"
  }
}

Dictionary Stemmers

Dictionary stemmers such as hunspell use real word lists for more accurate, linguistically correct roots. They are slower and need dictionary files but avoid over-stemming.

Over- and Under-Stemming

Stemming has failure modes:

  • Over-stemming: unrelated words map to the same root (e.g. universe and university).
  • Under-stemming: related words fail to share a root.

Use keyword_marker to protect specific words from stemming.

What Synonyms Do

Synonyms map words with the same meaning to each other. Searching tv can match television. They are applied via a synonym token filter in the analyzer chain.

"filter": {
  "my_synonyms": {
    "type": "synonym",
    "synonyms": [ "tv, television", "laptop, notebook" ]
  }
}

Equivalent vs Explicit

Synonym rules come in two styles:

  • Equivalent (tv, television): all terms are interchangeable.
  • Explicit (i-pod => ipod, music player): the left maps to the right only.

Index-Time vs Search-Time

Synonyms can be applied when indexing or when searching. Search-time synonyms (via synonym_graph) are preferred because you can update the list without re-indexing the whole corpus.

"filter": {
  "graph_syns": {
    "type": "synonym_graph",
    "synonyms_path": "analysis/synonyms.txt"
  }
}

Multi-Word Synonyms

Multi-word synonyms like ny, new york need the graph-aware synonym_graph filter at search time to be tokenized correctly. The older synonym filter mishandles phrases.

Combining Both

A typical chain applies synonyms first, then stemming, after lowercasing. Order matters: stem after expanding synonyms so all variants get normalized consistently.

"my_analyzer": {
  "tokenizer": "standard",
  "filter": [ "lowercase", "graph_syns", "my_stemmer" ]
}

Testing With _analyze

Always verify your chain with the _analyze API to confirm the produced tokens match your expectations before relying on it in production.

GET my_index/_analyze
{
  "analyzer": "my_analyzer",
  "text": "running televisions"
}

Quick Check

Test your understanding of recall-boosting filters.

Recap

You learned to widen search recall:

  • Stemming reduces word forms to a shared root; watch for over/under-stemming.
  • Synonyms map equivalent terms; equivalent vs explicit rules behave differently.
  • Prefer synonym_graph at search time for editable, multi-word-safe synonyms.
  • Verify analyzer output with the _analyze API.
เริ่มต้นได้ฟรี

เรียนรู้ Elasticsearch & Full Text Search Systems ด้วย AI tutor — ฟรี

เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป

คอร์ส
12
บทเรียน
48

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

บทเรียน “คำพ้องความหมายและการลดรูปคำ” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “คำพ้องความหมายและการลดรูปคำ” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Elasticsearch & Full Text Search Systems ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Elasticsearch & Full Text Search Systems มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “คำพ้องความหมายและการลดรูปคำ”

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

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Elasticsearch & Full Text Search Systems หรือไม่

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

บทเรียน “คำพ้องความหมายและการลดรูปคำ” ใช้เวลานานแค่ไหน

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

ฉันเขียนและรันโค้ดในบทเรียน Elasticsearch & Full Text Search Systems นี้ได้ไหม

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

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

  1. ตัววิเคราะห์ ตัวแยกโทเค็น และตัวกรอง
  2. การปรับแต่งตัววิเคราะห์ข้อความ
  3. การเพิ่มน้ำหนักและการให้คะแนนความเกี่ยวข้อง
  4. คำพ้องความหมายและการลดรูปคำ
← กลับไปที่ Elasticsearch & Full Text Search Systems