Graph of words
Create a graph of word representation from a text. Roughly based on Malliaros, F. D., & Skianis, K. (2015). Graph-Based Term Weighting for Text Categorization. 1473–1479. https://doi.org/10.1145/2808797.2808872
Example:
import graph
graph = graph.GraphOfWords(window_size=2)
graph.build_graph(
'Roses are red. Violets are blue',
# OR a sentences list['Roses are red.', 'Violets are blue'],
remove_stopwords=False,
workers=4
)
graph.display_graph()
graph.write_graph_edges('edges_list.txt')
Note that build_graph also accepts a list of sentences.
The following actions are performed:
- Split the text into sentences if required
- Slide a window across each sentence
- Add a directed graph edge form the current word to the other ones within the window, the weight being the distance between the two words
Documentation
See the documentation.
Metadata
Release files for graph-of-words 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| graph_of_words-0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Release files / graph_of_words-0.1-py2.py3-none-any.whl
| Download URL | graph_of_words-0.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7b155b58c5ef55d3f9a616584519f2e0917ab0c5aecfbf51dd4e99cac7a79770
|
|
BLAKE2b-256 checksum How to use checksums |
0f84791839cfcecd1be64b5edbf88716f3c044b9c9be414f1b966f59e9e38e92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3
|
Security for graph-of-words 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.