def fetch_name(resume_text):
tokenized_sentences = nltk.sent_tokenize(resume_text)
for sentence in tokenized_sentences:
for chunk in nltk.ne_chunk(nltk.pos_tag(nltk.word_tokenize(sentence), tagset='universal')):
if hasattr(chunk, 'label'):# and chunk.label() == 'PERSON':
chunk = chunk[0]
(name, tag) = chunk
if tag == 'NOUN':
return name
return "Applicant name couldn't be processed"
评论列表
文章目录