Update modules/text_analysis/semantic_analysis.py
Browse files
modules/text_analysis/semantic_analysis.py
CHANGED
@@ -63,10 +63,10 @@ ENTITY_LABELS = {
|
|
63 |
}
|
64 |
}
|
65 |
|
66 |
-
def identify_key_concepts(doc
|
67 |
-
|
68 |
-
|
69 |
-
return
|
70 |
|
71 |
def create_concept_graph(doc, key_concepts):
|
72 |
G = nx.Graph()
|
|
|
63 |
}
|
64 |
}
|
65 |
|
66 |
+
def identify_key_concepts(doc):
|
67 |
+
word_freq = Counter([token.lemma_.lower() for token in doc if token.pos_ in ['NOUN', 'VERB'] and not token.is_stop])
|
68 |
+
key_concepts = word_freq.most_common(10) # Top 10 conceptos clave
|
69 |
+
return [(concept, float(freq)) for concept, freq in key_concepts] # Asegurarse de que las frecuencias sean float
|
70 |
|
71 |
def create_concept_graph(doc, key_concepts):
|
72 |
G = nx.Graph()
|