Browse Source

Update 'README.md'

天问 1 month ago
parent
commit
80c7004119
1 changed files with 16 additions and 0 deletions
  1. 16 0
      README.md

+ 16 - 0
README.md

@@ -10,4 +10,20 @@ pip install -U pip setuptools wheel
 pip install spacy
 
 
+
+import spacy
+
+# 加载英文模型
+nlp = spacy.load("en_core_web_sm")
+
+# 文本
+text = "Apple is looking at buying U.K. startup for $1 billion"
+
+# 处理文本
+doc = nlp(text)
+
+# 输出分词和词性标注结果
+for token in doc:
+    print(token.text, token.pos_)
+
 ```