การแท็กชนิดของคำ (Part-of-speech tagging)

Feature Engineering for NLP in Python

Rounak Banik

Data Scientist

การประยุกต์ใช้งาน

  • การแก้ความกำกวมของความหมายคำ (Word-sense disambiguation)
    • "The bear is a majestic animal"
    • "Please bear with me"
  • การวิเคราะห์ความรู้สึก (Sentiment analysis)
  • การตอบคำถาม (Question answering)
  • การตรวจจับข่าวปลอมและสแปมความคิดเห็น
Feature Engineering for NLP in Python

POS tagging

  • การกำหนดชนิดของคำให้กับทุกคำในประโยค
    "Jane is an amazing guitarist."
    
  • POS Tagging:
    • Janeคำนามเฉพาะ (proper noun)
    • isกริยา (verb)
    • anคำนำหน้านาม (determiner)
    • amazingคำคุณศัพท์ (adjective)
    • guitaristคำนาม (noun)
Feature Engineering for NLP in Python

POS tagging ด้วย spaCy

import spacy

# Load the en_core_web_sm model
nlp = spacy.load('en_core_web_sm')
# Initiliaze string
string = "Jane is an amazing guitarist"
# Create a Doc object
doc = nlp(string)
Feature Engineering for NLP in Python

POS tagging ด้วย spaCy

...
...
# Generate list of tokens and pos tags
pos = [(token.text, token.pos_) for token in doc]
print(pos)
[('Jane', 'PROPN'), 
 ('is', 'VERB'), 
 ('an', 'DET'), 
 ('amazing', 'ADJ'), 
 ('guitarist', 'NOUN')]
Feature Engineering for NLP in Python

POS annotations ใน spaCy

  • PROPN → คำนามเฉพาะ (proper noun)
  • DET → คำนำหน้านาม (determinant)
  • คำอธิบาย annotation ของ spaCy ที่ https://spacy.io/api/annotation

เอกสาร spaCy เกี่ยวกับ POS annotations

Feature Engineering for NLP in Python

มาฝึกกันเถอะ!

Feature Engineering for NLP in Python

Preparing Video For Download...