Update modules/text_analysis/semantic_analysis.py
Browse files
modules/text_analysis/semantic_analysis.py
CHANGED
@@ -63,9 +63,10 @@ ENTITY_LABELS = {
|
|
63 |
}
|
64 |
}
|
65 |
|
66 |
-
def identify_key_concepts(doc):
|
67 |
-
|
68 |
-
|
|
|
69 |
|
70 |
def create_concept_graph(text, concepts):
|
71 |
vectorizer = TfidfVectorizer()
|
|
|
63 |
}
|
64 |
}
|
65 |
|
66 |
+
def identify_key_concepts(doc, top_n=10):
|
67 |
+
# Identificar sustantivos, verbos y adjetivos más frecuentes
|
68 |
+
word_freq = Counter([token.lemma_.lower() for token in doc if token.pos_ in ['NOUN', 'VERB', 'ADJ'] and not token.is_stop])
|
69 |
+
return word_freq.most_common(top_n)
|
70 |
|
71 |
def create_concept_graph(text, concepts):
|
72 |
vectorizer = TfidfVectorizer()
|