




# Import the English language class
from spacy.lang.en import English
# Create the nlp object
nlp = English()
# Process a text
doc = nlp("This is a sentence.")
# Print the document text
print(doc.text)
# Import the Spanish language class
from spacy.lang.es import Spanish
# Create the nlp object
nlp = Spanish()
# Process a text (this is Spanish for: "How are you?")
doc = nlp("¿Cómo estás?")
# Print the document text
print(doc.text)
# Import the English language class and create the nlp object
from spacy.lang.en import English
nlp = English()
# Process the text
doc = nlp("I like tree kangaroos and narwhals.")
# Select the first token
first_token = doc[0]
# Print the first token's text
print(first_token.text)
# Import the English language class and create the nlp object
from spacy.lang.en import English
nlp = English()
# Process the text
doc = nlp("I like tree kangaroos and narwhals.")
# A slice of the Doc for "tree kangaroos"
tree_kangaroos = doc[2:4]
print(tree_kangaroos.text)
# A slice of the Doc for "tree kangaroos and narwhals" (without the ".")
tree_kangaroos_and_narwhals = doc[2:6]
print(tree_kangaroos_and_narwhals.text)
from spacy.lang.en import English
nlp = English()
# Process the text
doc = nlp(
"In 1990, more than 60% of people in East Asia were in extreme poverty. "
"Now less than 4% are."
)
# Iterate over the tokens in the doc
for token in doc:
# Check if the token resembles a number
if token.like_num:
# Get the next token in the document
next_token = doc[token.i + 1]
# Check if the next token's text equals "%"
if next_token.text == "%":
print("Percentage found:", token.text)
Statistical models







출처 : course.spacy.io/en/
Advanced NLP with spaCy · A free online course
spaCy is a modern Python library for industrial-strength Natural Language Processing. In this free and interactive online course, you'll learn how to use spaCy to build advanced natural language understanding systems, using both rule-based and machine lear
course.spacy.io

728x90
'AI월드 > ⚙️AI BOOTCAMP_Section 4' 카테고리의 다른 글
특이값 분해(SVD)의 기하학적 의미, 활용_Day67(2) (0) | 2021.04.13 |
---|---|
TF-IDF_Day67 (0) | 2021.04.13 |
NLP, 텍스트 전처리 기본개념_Day66(4) (0) | 2021.04.12 |
Stopwords, 불용어, nlp_Day66(3) (0) | 2021.04.12 |
Stemmer, 어간추출, 언어 통합_Day66(2) (0) | 2021.04.12 |
댓글