Semantic and co-occurrence graphs for midsized texts
Project description
kenon
Semantic and co-occurrence graphs for midsized texts. Kenon builds weighted graphs from text using corpus-internal statistics — no neural models or external training data required. Supports co-occurrence windows, TF-IDF similarity, PMI embeddings, and disparity filter backbone extraction.
Installation
uv add kenon
python -m spacy download en_core_web_sm
Quickstart
from kenon import (
Tokenizer,
get_stopwords,
build_cooccurrence_graph,
extract_backbone,
)
# 1. Tokenize
tokenizer = Tokenizer("en_core_web_sm", lemmatize=True)
tokens = tokenizer.flat_tokens("The cat sat on the mat. The dog ran in the park.")
# 2. Build graph
stopwords = get_stopwords("english")
graph = build_cooccurrence_graph(tokens, window=2, stopwords=stopwords)
# 3. Extract backbone
backbone = extract_backbone(graph, min_alpha_ptile=0.3, min_degree=2)
print(f"Backbone: {backbone.number_of_nodes()} nodes, {backbone.number_of_edges()} edges")
Features
- Tokenization: spaCy-backed sentence splitting, tokenization, and lemmatization
- Stopwords: Merged NLTK + sklearn stopword lists with custom extensions
- Embeddings: Count vectors, TF-IDF, and PMI (via chronowords) — all corpus-internal
- Co-occurrence graphs: Skip-gram window co-occurrence with collocation detection
- Semantic graphs: Cosine similarity graphs from any embedder
- Backbone extraction: Disparity filter for statistically significant edges
Documentation
See the docs/ directory for full API reference and examples.
Made by
Kenon is made by Crow Intelligence.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kenon-0.1.1.tar.gz.
File metadata
- Download URL: kenon-0.1.1.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8858f3a58e25205c39b9676f77f528416b554db4d0c995ef21fd4925bea693c8
|
|
| MD5 |
9c9cda1d6ee08067bf953d47d72a574a
|
|
| BLAKE2b-256 |
e1fb09e9e08c8a00fb4e5a6add7fe9cac9cd57135c776921a1eb24feec70b862
|
Provenance
The following attestation bundles were made for kenon-0.1.1.tar.gz:
Publisher:
publish.yml on crow-intelligence/kenon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kenon-0.1.1.tar.gz -
Subject digest:
8858f3a58e25205c39b9676f77f528416b554db4d0c995ef21fd4925bea693c8 - Sigstore transparency entry: 1349421901
- Sigstore integration time:
-
Permalink:
crow-intelligence/kenon@06721e4fd1d84d8c9d947d9b938d23f39a22bff8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/crow-intelligence
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@06721e4fd1d84d8c9d947d9b938d23f39a22bff8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file kenon-0.1.1-py3-none-any.whl.
File metadata
- Download URL: kenon-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4eafcb2bd7bdcbde77478310545cac919c45b079da0d7273192aa1e70d377fc
|
|
| MD5 |
4c97f6713b159b87e869aec2343aa72b
|
|
| BLAKE2b-256 |
a0697882ebb1c304f39f7f346295e63554da31cc658ea4ed603e18e29b5dbcba
|
Provenance
The following attestation bundles were made for kenon-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on crow-intelligence/kenon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kenon-0.1.1-py3-none-any.whl -
Subject digest:
b4eafcb2bd7bdcbde77478310545cac919c45b079da0d7273192aa1e70d377fc - Sigstore transparency entry: 1349421977
- Sigstore integration time:
-
Permalink:
crow-intelligence/kenon@06721e4fd1d84d8c9d947d9b938d23f39a22bff8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/crow-intelligence
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@06721e4fd1d84d8c9d947d9b938d23f39a22bff8 -
Trigger Event:
release
-
Statement type: