''' Write a function that receives a text input and returns the extracted keywords with scores, utilizing spacy library in Python. The keywords must be meaningful, by excluding stopwords in English. The scores should represent the importance of the keywords, the more a keyword appears in the text, the higher the score should be. ''' import spacy from collections import Counter def extract_keywords(text): nlp = spacy.load("en_core_web_sm") doc = nlp(text) keywords = [] for token in doc: if not token.is_stop and token.is_alpha: keywords.append(token.lemma_) keyword_counts = Counter(keywords) total_counts = sum(keyword_counts.values()) keyword_scores = {word: count/total_counts for word, count in keyword_counts.items()} return keyword_scores