Skip to main content

Easily create semantic graphs from text using SentenceTransformers

Project description

SentenceGraph

Install

pip install SentenceGraph

How to use

# from SentenceGraph.core import SentenceGraph, Format, TextNode
# 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.4.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

SentenceGraph-0.0.4-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file SentenceGraph-0.0.4.tar.gz.

File metadata

  • Download URL: SentenceGraph-0.0.4.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.15

File hashes

Hashes for SentenceGraph-0.0.4.tar.gz
Algorithm Hash digest
SHA256 9c986252c82e84f72456c174d949adf93409a1ab9cca1a2cff9e3070393bf84f
MD5 3bb3eae14461305cc7fa4a927850ce9c
BLAKE2b-256 63d3b8a94ff03deb8740220c540647d03d10f4cceb14c0b7e58adbce20b40e41

See more details on using hashes here.

File details

Details for the file SentenceGraph-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: SentenceGraph-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.15

File hashes

Hashes for SentenceGraph-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0b0a28c6b2ac177cad400c118f41c357e5caee9805d6964a53b47ce6e604cacc
MD5 1663dc7465f384dcf24b52ea9e620bfc
BLAKE2b-256 042cc45564a0f1e140a52eb6536b21f1af3e311dea674fe0a3dda6457af83c47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page