AIdeaText commited on
Commit
adca799
·
verified ·
1 Parent(s): ebb5534

Update modules/text_analysis/discourse_analysis.py

Browse files
modules/text_analysis/discourse_analysis.py CHANGED
@@ -21,8 +21,7 @@ logger = logging.getLogger(__name__)
21
  from .semantic_analysis import (
22
  create_concept_graph,
23
  visualize_concept_graph,
24
- identify_key_concepts,
25
- fig_to_bytes
26
  )
27
 
28
 
@@ -91,7 +90,16 @@ ENTITY_LABELS = {
91
  }
92
 
93
  #################
94
-
 
 
 
 
 
 
 
 
 
95
  #################
96
  def compare_semantic_analysis(text1, text2, nlp, lang):
97
  """
 
21
  from .semantic_analysis import (
22
  create_concept_graph,
23
  visualize_concept_graph,
24
+ identify_key_concepts
 
25
  )
26
 
27
 
 
90
  }
91
 
92
  #################
93
+ def fig_to_bytes(fig):
94
+ """Convierte una figura de matplotlib a bytes."""
95
+ try:
96
+ buf = io.BytesIO()
97
+ fig.savefig(buf, format='png', dpi=300, bbox_inches='tight')
98
+ buf.seek(0)
99
+ return buf.getvalue()
100
+ except Exception as e:
101
+ logger.error(f"Error en fig_to_bytes: {str(e)}")
102
+ return None
103
  #################
104
  def compare_semantic_analysis(text1, text2, nlp, lang):
105
  """