Update src/ingestion/semantic_splitter.py
Browse files
src/ingestion/semantic_splitter.py
CHANGED
|
@@ -123,19 +123,4 @@ class ActivaSemanticSplitter:
|
|
| 123 |
chunks.append(chunk_text)
|
| 124 |
start_index = end_index
|
| 125 |
|
| 126 |
-
return chunks, distances, threshold
|
| 127 |
-
|
| 128 |
-
def plot_similarity(self, distances, threshold, filename="chunking_analysis.png"):
|
| 129 |
-
try:
|
| 130 |
-
plt.figure(figsize=(10, 6))
|
| 131 |
-
plt.plot(distances, label="Cosine Similarity")
|
| 132 |
-
plt.axhline(y=threshold, color='r', linestyle='--', label=f"Threshold")
|
| 133 |
-
plt.title("Analisi della Coerenza Vettoriale")
|
| 134 |
-
plt.xlabel("Frase")
|
| 135 |
-
plt.ylabel("Similarità")
|
| 136 |
-
plt.legend()
|
| 137 |
-
plt.savefig(filename)
|
| 138 |
-
print(f"📊 Grafico salvato: {filename}")
|
| 139 |
-
plt.close()
|
| 140 |
-
except Exception:
|
| 141 |
-
pass
|
|
|
|
| 123 |
chunks.append(chunk_text)
|
| 124 |
start_index = end_index
|
| 125 |
|
| 126 |
+
return chunks, distances, threshold
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|