Skip to main content

Use this library to transform raw text into differents graph representations.

Project description

text2graph-API

Use this library for text-to-graph tranformations. To use the API it is necessary to install its modules and dependencies in the user’s application. Also, the corpus of text documents to be transformed into graphs has to be loaded and read.

text2graphapi is a text to graph transformation pipeline that consists of four main modules::

  • Text Preprocessing and Normalization. This module aims to perform all the cleaning and pre-processing part of the text. Apply NLP methods such as POS-Tag, Lemm, Stem, etc.
  • Graph Model. This module aims to define the entities/nodes and their relationships/edges according to the problem specification.
  • Graph Extraction. This module aims to build the graph according to the selected model. We use third-party libraries such as NetworkX.
  • Graph Transformation and Analysis. This module aims to apply vector transformations to the graph as final output, such as adjacency matrix, dense matrix, etc.

Where to get it

# from PYPI
pip install text2graphapi

Example input data

# Has to be a list of dict, where ecah dict conatins an 'id' and 'doc' text data
input_text_docs = [{"id": 1, "doc": "text_data_1"},
                   {"id": 2, "doc": "text_data_2"}]

How to use it

from text2graphapi.src.Cooccurrence import Cooccurrence

to_cooccurrence = Cooccurrence(
                graph_type = 'DiGraph', 
                apply_prep = True, 
                parallel_exec = False,
                window_size = 1, 
                language = 'en',
                output_format = 'adj_matrix')
                
output_text_graphs = to_cooccurrence.transform(corpus_docs)

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

text2graphapi-0.1.1.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

text2graphapi-0.1.1-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file text2graphapi-0.1.1.tar.gz.

File metadata

  • Download URL: text2graphapi-0.1.1.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for text2graphapi-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e54beeba8de5230ee6dcf3b280e6196fd14ce8cb161f09f02fc65f5ee84af60c
MD5 6c8eec13105182b3e0fe4419fe004663
BLAKE2b-256 d1a105e110b09048a97a0a85dfaa36e734c4ba82eafbc10e75495c76c0dc0678

See more details on using hashes here.

File details

Details for the file text2graphapi-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: text2graphapi-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for text2graphapi-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89d5ba73032713dd77a0593a149a0f6ca5e7cfe934c7f068ed881a456660c636
MD5 434cabeb74d9b727b825db4dc7b879ee
BLAKE2b-256 aa0065762dffde40830bcdb543abebf6284db27b58ed08299c73a69e24142cf5

See more details on using hashes here.

Supported by

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