Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eczy/text-graphs
https://github.com/eczy/text-graphs
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/eczy/text-graphs
- Owner: eczy
- Created: 2020-02-11T06:36:33.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-26T18:56:40.000Z (almost 5 years ago)
- Last Synced: 2024-10-27T17:37:55.500Z (3 months ago)
- Language: Python
- Size: 45.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Text Graphs
A simple example of graph generation from text.We use the part-of-speech tagging and syntactic dependency parsing built into the `spaCy` library in order to extract nouns, adjectives, and verbs from a text corpus along with the relationships between them. We then use these relationships to generate a graph structure among nouns and adjectives where directed edges entail either a relation (verb) or a description (adjective, clausal modifier, compound noun).
# Example
To run this analysis on the provided sample text, run the following commands:
```
pip install -r requirements.txt
python -m spacy download en_core_web_sm
python text_graph.py sample.txt sample_graph.csv
python viz.py sample_graph.csv sample_graph.png
```You should now have a csv with source, destination, and edge type columns along with a graph similar to the following:
![Sample Graph Output](/img/sample.png)