import ssl

import nltk
from textblob import TextBlob
from nltk.corpus import stopwords


# set SSL
try:
    _create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
    pass
else:
    ssl._create_default_https_context = _create_unverified_https_context

# download noun data (if required)
nltk.download('brown')
nltk.download('punkt')
nltk.download('stopwords')

def extract_nouns(sentence):
    """Extract the nouns from a sentence using the 'textblob' library."""
    blob = TextBlob(sentence)
    return blob.noun_phrases

def remove_stopwords(sentence):
    """Remove stopwords from a sentence and return the list of words."""
    blob = TextBlob(sentence)
    return [word for word in blob.words if word not in stopwords.words('english') and len(word)>2]

[((17, 0, 17, 22), 'nltk.download', 'nltk.download', ({(17, 14, 17, 21): '"""brown"""'}, {}), "('brown')", False, 'import nltk\n'), ((18, 0, 18, 22), 'nltk.download', 'nltk.download', ({(18, 14, 18, 21): '"""punkt"""'}, {}), "('punkt')", False, 'import nltk\n'), ((19, 0, 19, 26), 'nltk.download', 'nltk.download', ({(19, 14, 19, 25): '"""stopwords"""'}, {}), "('stopwords')", False, 'import nltk\n'), ((23, 11, 23, 29), 'textblob.TextBlob', 'TextBlob', ({(23, 20, 23, 28): 'sentence'}, {}), '(sentence)', False, 'from textblob import TextBlob\n'), ((28, 11, 28, 29), 'textblob.TextBlob', 'TextBlob', ({(28, 20, 28, 28): 'sentence'}, {}), '(sentence)', False, 'from textblob import TextBlob\n'), ((29, 55, 29, 81), 'nltk.corpus.stopwords.words', 'stopwords.words', ({(29, 71, 29, 80): '"""english"""'}, {}), "('english')", False, 'from nltk.corpus import stopwords\n')]