This commit is contained in:
saloui 2023-07-27 17:03:21 +02:00
parent 58a0c986c3
commit 4ca65ea545

View File

@ -159,6 +159,7 @@ class TextVectorizer:
# Generate a list of colors for each data point based on the document path
point_colors = [document_path_colors["_".join(path.split("_")[:-1])] for path in ref]
# Create a scatter plot using Seaborn
sns.scatterplot(x=embeddings_2d[:, 0], y=embeddings_2d[:, 1], hue=point_colors) # Plot document embeddings
# Add labels to the scatter plot
@ -217,10 +218,10 @@ class TextVectorizer:
# Connect the click event handler to the figure
plt.gcf().canvas.mpl_connect("button_press_event", on_click)
if save_fig_path:
plt.savefig(save_fig_path)
if show_interactive_form:
plt.show()
if save_fig_path:
plt.savefig(save_fig_path)
def add_document(self, document_id, text, chunk_size, overlap_size, force_vectorize=False):
if document_id in self.embeddings and not force_vectorize: