事前準備

pip install spacy

python -m spacy download en_core_web_sm

コード

import spacy

nlp = spacy.load("en_core_web_sm")

doc= nlp('College of London in UK x.xxx@xxx.ac.uk')

for ent in doc.ents:
    if ent.label_ == "GPE":
        print(ent.text, ent.label_)

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です