Easily create semantic graphs from text using SentenceTransformers
Project description
SentenceGraph
Install
pip install SentenceGraph
How to use
# from SentenceGraph.core import SentenceGraph, Format, TextNodeType
# from SentenceGraph.functional import create_text_nodes
# sentenceGraph = SentenceGraph()
# SentenceGraph requires all sentences to be passed as TextNode, which is just a namedtuple containing an id and text.
# There are several ways to prepare your sentence data for SentenceGraph.
# Use the builtin helper function which will just assign sequential ids for the data. Useful for experimentation.
# sentences = ['This framework generates embeddings for each input sentence',
# 'Sentences are passed as a list of string.',
# 'The quick brown fox jumps over the lazy dog.']
# sentences = create_text_nodes(sentences)
# #
# sentences = [TextNode(1, 'This framework generates embeddings for each input sentence'),
# TextNode(2, 'Sentences are passed as a list of string.'),
# TextNode(3,'The quick brown fox jumps over the lazy dog.')]
# sim_graph = sentenceGraph.createGraph(sentences)
# sim_graph
You can also return a graph matrix in different formats.
# sim_graph = sentenceGraph.createGraph(sentences, format=Format.Numpy)
# sim_graph
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
SentenceGraph-0.0.5.tar.gz
(8.6 kB
view hashes)
Built Distribution
Close
Hashes for SentenceGraph-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd987cfc502a9961c37b46cb3a726886d4c7388b9bee728e0fa56da997dc82cc |
|
MD5 | 412339fdcfe05ada9db67bf15ee5a848 |
|
BLAKE2b-256 | 5054c8d2e637dfd5eb3df2f9ab4990aaab838c3cb959302d7fbfa82977e6c824 |