How to extract noun phrases from a sentence using pre-trained BERT?

Viewed 129

I want to extract noun phrases from sentence using BERT. There are some available libraries like TextBlob that allows us to extract noun phrases like this:

from textblob import TextBlob

line = "Out business could be hurt by increased labor costs or labor shortages"

blob = TextBlob(line)
blob.noun_phrases

>>> WordList(['labor costs', 'labor shortages'])

The output of this seems pretty good. However, this is not able to capture longer noun phrases. Consider following example:

from textblob import TextBlob

line = "The Company’s Image Activation program may not positively affect sales at company-owned and participating " 
"franchised restaurants or improve our results of operations"

blob = TextBlob(line)
blob.noun_phrases

>>> WordList(['company ’ s', 'image activation'])

However, the ideal answer here could be a longer phrase, like : company-owned and participating franchised restaurants. Since BERT is proven to be state-of-the-art in many NLP tasks, it should perform at least better than this approach.

However, I could not find any relevant resource to use BERT for this task. Is it possible to solve this task using pre-trained BERT?

0 Answers
Related