viktorvsk/nostr-notes-labeler

Python service that labels Nostr notes with ML — language, sentiment, and named entities

0

stars

2

commits

Python

primary language

Jun 19, 2026

updated

README

nostr-notes-labeler

A Python service that consumes notes from a Nostr relay and enriches them with machine-learning labels.

It connects to a relay (default wss://saltivka.org) over WebSocket, streams in events, and for each note runs:

  • Language identification — Facebook's fastText language ID model, mapped to ISO 639-2 codes
  • Sentiment analysis — a 🤗 Transformers sentiment pipeline
  • Named-entity recognitiondslim/bert-base-NER to extract entities (people, organisations, locations)

Redis is used for coordination/state. Models run on CPU by default, or on GPU when CUDA_DEVICE is set.

Usage

With Docker Compose:

docker compose up

Or directly:

pip install -r requirements.txt
python3 app.py

Configuration

All configuration is via environment variables:

VariableDefaultDescription
RELAY_URLwss://saltivka.orgNostr relay to consume from
REDIS_URLredis://redis:6379Redis connection URL
SECRET_KEYSecret key used by the service (provide your own; do not commit it)
PAST_EVENTS_LIMIT1000How many historical events to pull on connect
CUDA_DEVICE-1GPU device index; -1 runs the models on CPU

Contributors

viktorvsk

2 commits

viktorvsk/nostr-notes-labeler

Python service that labels Nostr notes with ML — language, sentiment, and named entities

0

stars

2

commits

Python

primary language

Jun 19, 2026

updated

README

nostr-notes-labeler

A Python service that consumes notes from a Nostr relay and enriches them with machine-learning labels.

It connects to a relay (default wss://saltivka.org) over WebSocket, streams in events, and for each note runs:

  • Language identification — Facebook's fastText language ID model, mapped to ISO 639-2 codes
  • Sentiment analysis — a 🤗 Transformers sentiment pipeline
  • Named-entity recognitiondslim/bert-base-NER to extract entities (people, organisations, locations)

Redis is used for coordination/state. Models run on CPU by default, or on GPU when CUDA_DEVICE is set.

Usage

With Docker Compose:

docker compose up

Or directly:

pip install -r requirements.txt
python3 app.py

Configuration

All configuration is via environment variables:

VariableDefaultDescription
RELAY_URLwss://saltivka.orgNostr relay to consume from
REDIS_URLredis://redis:6379Redis connection URL
SECRET_KEYSecret key used by the service (provide your own; do not commit it)
PAST_EVENTS_LIMIT1000How many historical events to pull on connect
CUDA_DEVICE-1GPU device index; -1 runs the models on CPU

Contributors

viktorvsk

2 commits

Languages

Python

95.5%

Dockerfile

4.5%