VectorisedGraph#

class VectorisedGraph#

Bases: object

Methods:

documents_by_similarity(query, limit[, window])

Search the top scoring documents according to query with no more than limit documents

edges_by_similarity(query, limit[, window])

Search the top scoring edges according to query with no more than limit edges

empty_selection()

Return an empty selection of documents

entities_by_similarity(query, limit[, window])

Search the top scoring entities according to query with no more than limit entities

get_graph_documents()

Return all the graph level documents

nodes_by_similarity(query, limit[, window])

Search the top scoring nodes according to query with no more than limit nodes

save_embeddings(file)

Save the embeddings present in this graph to file so they can be further used in a call to vectorise

documents_by_similarity(query, limit, window=None)#

Search the top scoring documents according to query with no more than limit documents

Parameters:
  • query (str | list) – the text or the embedding to score against

  • limit (int) – the maximum number of documents to search

  • window (Tuple[int | str, int | str], optional) – the window where documents need to belong to in order to be considered

Returns:

The vector selection resulting from the search

Return type:

VectorSelection

edges_by_similarity(query, limit, window=None)#

Search the top scoring edges according to query with no more than limit edges

Parameters:
  • query (str | list) – the text or the embedding to score against

  • limit (int) – the maximum number of new edges to search

  • window (Tuple[int | str, int | str], optional) – the window where documents need to belong to in order to be considered

Returns:

The vector selection resulting from the search

Return type:

VectorSelection

empty_selection()#

Return an empty selection of documents

entities_by_similarity(query, limit, window=None)#

Search the top scoring entities according to query with no more than limit entities

Parameters:
  • query (str | list) – the text or the embedding to score against

  • limit (int) – the maximum number of new entities to search

  • window (Tuple[int | str, int | str], optional) – the window where documents need to belong to in order to be considered

Returns:

The vector selection resulting from the search

Return type:

VectorSelection

get_graph_documents()#

Return all the graph level documents

Returns:

list of graph level documents

Return type:

list[Document]

nodes_by_similarity(query, limit, window=None)#

Search the top scoring nodes according to query with no more than limit nodes

Parameters:
  • query (str | list) – the text or the embedding to score against

  • limit (int) – the maximum number of new nodes to search

  • window (Tuple[int | str, int | str], optional) – the window where documents need to belong to in order to be considered

Returns:

The vector selection resulting from the search

Return type:

VectorSelection

save_embeddings(file)#

Save the embeddings present in this graph to file so they can be further used in a call to vectorise