토큰화

tokens = spacy_tokenizer("Jhon's book isn't popular, but he loves his book.")
print ([(token.text, token.lemma_, token.pos_) for token in tokens])

[('Jhon', 'Jhon', 'PROPN', 'NNP', False), ("'s", "'s", 'PART', 'POS', True), ('book', 'book', 'NOUN', 'NN', False), ('is', 'be', 'AUX', 'VBZ', True), ("n't", 'not', 'PART', 'RB', True), ('popular', 'popular', 'ADJ', 'JJ', False), (',', ',', 'PUNCT', ',', False), ('but', 'but', 'CCONJ', 'CC', True), ('he', 'he', 'PRON', 'PRP', True), ('loves', 'love', 'VERB', 'VBZ', False), ('his', 'his', 'PRON', 'PRP$', True), ('book', 'book', 'NOUN', 'NN', False), ('.', '.', 'PUNCT', '.', False)]

token.lemma_ : 표제어

image.png

token.pos_ : 단어의 품사

image.png

token.tag_ : 자세한 품사

image.png

token.is_stop :불용어 여부

image.png

[참고] https://spacy.io/api/token

용어설명

spacy.explain('PROPN')

proper noun

문장구조

스크린샷 2024-08-27 오후 10.04.58.png

<IPython.core.display.SVG object>