AIdeaText commited on
Commit
2a97cbe
1 Parent(s): 3a8cb49

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, 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(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()