๋ฐ์ํ
๋ฌธ์ฅ์ word_tokenize (ํ ํฐํ)-> pos_tag(ํ์ฌ ๋ถ๋ฅ) ๋ฅผ ํตํด pos(ํ์ฌ)๋ฅผ ์ฐพ๊ณ , ๋ฌธ์ฅ ๋ด์์ ๋จ์ด์ ํด๋นํ๋ ํ์ฌ๋ฅผ ํ๊น ํ์ฌ ์์ ์๋ค.
์ข ๋ฅ๋ ๋ค์๊ณผ ๊ฐ๋ค.
import nltk
nltk.download('punkt')
from nltk import word_tokenize
words = word_tokenize("Think like man of action and act like man of thought")
words # ๋จผ์ ๋ฌธ์ฅ์ ํ ํฐํํ ํ์ ํฌ์ค ํ๊ทธ๋ฅผ ๋ฌ๋ฉด ๋๋ค
[nltk_data] Downloading package punkt to
[nltk_data] C:\Users\AppData\Roaming\nltk_data...
[nltk_data] Package punkt is already up-to-date!
['Think',
'like',
'man',
'of',
'action',
'and',
'act',
'like',
'man',
'of',
'thought']
nltk.download('averaged_perceptron_tagger')
nltk.pos_tag(words)
[nltk_data] Downloading package averaged_perceptron_tagger to
[nltk_data] C:\Users\AppData\Roaming\nltk_data...
[nltk_data] Unzipping taggers\averaged_perceptron_tagger.zip.
[('Think', 'VBP'),
('like', 'IN'),
('man', 'NN'),
('of', 'IN'),
('action', 'NN'),
('and', 'CC'),
('act', 'NN'),
('like', 'IN'),
('man', 'NN'),
('of', 'IN'),
('thought', 'NN')]
Pos tag list
Universal Tag list
์ด์ ์ ๋ฆฌ์๋ฃ
๋ฐ์ํ