- Python Machine Learning By Example
- Yuxi (Hayden) Liu
- 187字
- 2021-07-02 12:41:40
Named-entity recognition
Given a text sequence, the named-entity recognition (NER) task is to locate and identify words or phrases that are of definitive categories such as names of persons, companies, locations, and dates. We will briefly mention it again in Chapter 4, Detecting Spam Email with Naive Bayes.
As an appetizer, let's take a peep at an example of using spaCy for NER.
First, tokenize an input sentence, The book written by Hayden Liu in 2018 was sold at $30 in America, as usual as shown in the following command:
>>> tokens3 = nlp('The book written by Hayden Liu in 2018 was sold at $30 in America')
The resultant token object contains an attribute called ents, which is the named entities. We can extract the tagging for each recognized named entity as follows:
print([(token_ent.text, token_ent.label_) for token_ent in tokens3.ents])
[('Hayden Liu', 'PERSON'), ('2018', 'DATE'), ('30', 'MONEY'), ('America', 'GPE')]
We can see from the results that Hayden Liu is PERSON, 2018 is DATE, 30 is MONEY, and America is GPE (country). Please refer to https://spacy.io/api/annotation#section-named-entities for a full list of named entity tags.
- 現代測控系統典型應用實例
- 工業機器人技術及應用
- Effective DevOps with AWS
- Expert AWS Development
- 自動化控制工程設計
- Mastering Machine Learning Algorithms
- 21天學通Java Web開發
- 分數階系統分析與控制研究
- 網中之我:何明升網絡社會論稿
- FPGA/CPLD應用技術(Verilog語言版)
- 統計挖掘與機器學習:大數據預測建模和分析技術(原書第3版)
- Introduction to R for Business Intelligence
- 計算機硬件技術基礎(第2版)
- Wireshark Revealed:Essential Skills for IT Professionals
- 網絡安全原理與應用