Skip to main content

orange3-nlp

A collection of Orange3 widgets for Natural Language Processing: summarization, named entity recognition, part-of-speech tagging and visualization, entity-relationship extraction, question answering, text splitting, text embeddings, retrieval-augmented generation (RAG) with local or hosted models, and Polish sentiment analysis.

The widgets work on the Corpus objects provided by the Orange3-Text add-on, which is installed automatically.

Installation

From Orange

Within the Add-ons installer, click on "Add more..." and type in orange3-nlp.

With pip

Install into the same Python environment as Orange:

pip install orange3-nlp

Requirements:

  • Python 3.11, 3.12 or 3.13 (TensorFlow has no wheels for 3.14 yet)
  • Orange3 3.41.0 or newer (supported on Linux and Windows)
  • numpy 2.0 or newer. Orange 3.41 and the NLP dependencies (gensim 4.4, faiss, TensorFlow) all support numpy 2.

The add-on pulls in several large libraries (PyTorch via sentence-transformers and flair, TensorFlow, spaCy, gensim), so the first install takes a while and needs a few gigabytes of disk space.

Models and services

Most widgets download their models on first use and cache them locally; the first run of a widget can therefore be slow.

Widget(s) What is needed
spaCy-based widgets (POS Tagger, POS Viewer, spaCy Embedder, Rule-based Entity-Relationship Extraction) The spaCy model for the corpus language is downloaded automatically.
POS Tagger (Stanza, UDPipe) The Stanza or UDPipe model for the corpus language is downloaded automatically.
Summary widgets (BART, Pegasus, T5, FLAN-T5), Question Answering, E5, SBERT Hugging Face models are downloaded automatically.
FastText Embedder The Common Crawl vectors for the corpus language are downloaded to Orange's data directory. These files are very large (several GB).
Ollama options (Abstractive/Extractive Summary, NER, Ollama RAG, Text Generator, Nomic Embedder, Ollama-based Entity-Relationship Extraction) A running Ollama server (default localhost:11434) with the model you want to use already pulled. The Nomic Embedder needs nomic-embed-text.
OpenAI Embedder, Gemini Embedder An API key, see API keys.

API keys

The OpenAI and Gemini embedders need API keys. Enter them in Orange under Options > Preferences > API Keys (or through the embedder widget's "Configure API Keys..." button). Keys are stored in Orange's settings.

Widgets

Canvas with the major widgets provided by the Orange3-NLP package

  • General Widgets
    • Abstractive Summary
    • Extractive Summary
    • Named Entity Recognition
    • Rule-based Entity-Relationship Extraction
    • Ollama-based Entity-Relationship Extraction
    • POS Tagger
    • POS Viewer
    • Question Answering
    • Reference Library
    • Ollama RAG
    • Text Generator

Text Splitting Widgets

  • Text Splitting Widgets
    • Text Chunker
    • Tokens to Corpus

Text Embedding Models

  • Text Embedding Models (each outputs an Embedder, which the Text Embedder and Reference Library widgets consume)
    • Doc2Vec
    • E5
    • FastText
    • Gemini
    • Nomic
    • OpenAI
    • Sentence Embedder (SBERT)
    • spaCy
    • USE
  • Text Embedder (applies an embedder to a corpus)

Training widget for Doc2Vec embedder

  • Training of Text Embedding Widget
    • Train Doc2Vec

Polish sentiment analysis widget, Analiza Sentymentu

  • For Polish Sentiment Analysis
    • Analiza Sentymentu

Example workflows are included in the workflows directory. Each widget also has a help page (the Help button in the widget, or the sources in doc/widgets). The documentation is also published at https://chrislee35.github.io/orange3-nlp/.

Summary Widgets

Both summary widgets take a Corpus and output a Corpus with Summaries. Choose the framework with the radio buttons; the Ollama option reveals host, port and model settings.

  • Extractive Summary (Sumy, Summa, BART, Ollama): Selects and joins key sentences or phrases from the original text.

Extractive Summary of The Little Match-Seller

  • Abstractive Summary (BART, Pegasus, T5, FLAN-T5, Ollama): Generates new sentences that paraphrase and condense the original content (more similar to how humans summarize).

Abstractive Summary of The Little Match-Seller

Named Entity Recognition

Named Entity Recognition (NER) is a task in NLP that locates and classifies named entities in text into predefined categories such as:

  • PERSON – names of people
  • ORG – organizations
  • GPE – countries, cities, or locations
  • DATE, TIME, MONEY, etc.

The widget takes a Corpus and adds a Named Entities column listing each entity with its label. Choose NLTK, spaCy, Flair, or an Ollama model (the Ollama option uses the host, port and model set in the widget and asks the model for a JSON list of entities, so results depend on the model following that format).

Entity-Relationship Extraction

Both widgets take a Corpus and output a Relations table with one row per extracted subject–verb–object triple. They produce the same columns, so they can be swapped in a workflow:

Column Meaning
input_chunk_id Index of the document the relation came from
subject The subject entity
verb The relation (a verb, or verb + preposition such as migrate_to)
object The object entity
sentence The sentence supporting the relation
  • Rule-based Entity-Relationship Extraction uses spaCy's dependency parse (English). It handles active and passive verbs, prepositional relations and copular "is" relations, and ignores discourse verbs such as "show" and "suggest". It runs automatically when a corpus arrives.
  • Ollama-based Entity-Relationship Extraction asks a local Ollama model to extract the triples as structured JSON. Configure the host, port, model and (optionally) the prompt, then press Extract. It does not run automatically because LLM extraction is slow on large corpora. Documents that fail are reported in the error box without stopping the rest.

Part of Speech Tagging

Part-of-speech (POS) tagging assigns grammatical categories to each word in a sentence. The POS Tagger (spaCy, Stanza, UDPipe) adds a POS Tags column (JSON) to the corpus.

Common POS Tags

Tag Meaning Example
NN Noun cat, city
VB Verb run, is
JJ Adjective fast, red
RB Adverb quickly
DT Determiner the, an
IN Preposition on, with

POS tagging is essential for syntactic parsing and downstream NLP tasks.

Part of Speech Viewer

This uses spaCy's displacy HTML renderer to provide a parsed dependency tree of the parts of speech of the input text. It consumes the Tagged Corpus produced by the POS Tagger.

Part of Speech Viewer with parsed Slovenian text.

Question Answering

Question Answering (QA) systems aim to extract or generate answers to user questions from a text or knowledge base. The widget answers the question against the selected document, or against all documents, and adds an Answer column.

Question and Answers for "Who Died?" against the Book Excerpts corpus

Text Splitting Widgets

Tokens to Corpus

The Tokens to Corpus widget takes the tokens from the Preprocess Text widgets and outputs a corpus with one row per token (keeping the document title when there is one).

Tokens to Corpus workflow

Text Chunker

Text Chunker supports 2 chunking strategies to split text, with a chunk size of 128, 256, 512 or 1024 characters. The first is LangChain's RecursiveCharacterTextSplitter and the second is semantic-text-splitter. The output corpus has excerpt and source_doc_idx columns.

Text Chunker widget

Text Embeddings

An embedding model widget (Doc2Vec, E5, FastText, Gemini, Nomic, OpenAI, SBERT, spaCy, USE) outputs an Embedder. Connect it, together with a corpus, to Text Embedder to add emb_0 … emb_N feature columns to the corpus, or to Reference Library to build a searchable index.

Train Doc2Vec trains a new gensim Doc2Vec model on a corpus (vector size 300, window 8, minimum count 2, 4 workers, 40 epochs). It has no controls; training starts when a corpus arrives. The trained model is saved in Orange's data directory and is then available in the Doc2Vec Embedder widget.

Retrieval-Augmented Generation

Retrieval-Augmented Generation (RAG) is a method of enhancing large language model (LLM) responses by providing external documents as supporting context. Instead of relying solely on the model's training data, RAG:

  • Retrieves relevant snippets from a document collection (knowledge base).
  • Augments the prompt to the LLM by including this retrieved content.
  • Generates a more accurate and grounded answer based on the context.

RAG Workflow

The Reference Library stores an embedded corpus in a FAISS vector index and returns the excerpts most similar to a query (the number of excerpts and a similarity threshold are configurable).

Reference Library

The Ollama RAG widget sends the retrieved excerpts, together with your prompt, to an Ollama model and shows the streamed response.

Ollama RAG Widget: Using the phi Ollama model, and a prompt of "Who were the Munchins and what are they good at?"

Text Generation

The Text Generator widget sends a prompt to a language model and returns what the model writes next, one row per generation. The prompt is a template: with a corpus connected it runs once per document, filling in {text} and {ColumnName}. Choose Ollama (raw /api/generate, streamed) or a Hugging Face causal model (default gpt2, downloaded on first use). Temperature, maximum length, top-p, an optional fixed seed and the number of samples per prompt are adjustable, which makes it a good tool for seeing how much a language model's output depends on chance.

Polish Sentiment Analysis

Since Polish sentiment analysis support in Orange was limited, Analiza Sentymentu provides a tuned model (sentimentpl).

Polish sentiment analysis workflow

Localization

Widget names and interface strings can be translated. The translation files are in orangecontrib/nlp/i18n (English and Japanese); the language is chosen in Orange's settings. In the code, translated strings are looked up by index (_tr.m[index, "text"]), so new strings must be appended to every language file.

Development

git clone https://github.com/chrislee35/orange3-nlp
cd orange3-nlp
pip install -e ".[test,doc]"

Code style and checks (configuration is in pyproject.toml and .flake8):

black .                       # formatting, 140 columns
ruff check .                  # linting, including type-annotation (ANN) rules
flake8 .
pyright                       # static type checking (the engine behind Pylance)

All functions are type-hinted. The typings/ directory contains stubs that point AnyQt at PyQt5 so that type checkers can resolve Qt classes. Helpers for typed Orange settings and Qt layouts are in orangecontrib/nlp/util.

Tests:

python tests/test_nlp.py          # runs each widget in its own process (slow; downloads models, needs Ollama)
python -m pytest tests/test_token_corpus.py

Documentation (Sphinx, Markdown pages with MyST) lives in doc. Build the HTML help before building a wheel so that it is bundled and shown by the widgets' Help button:

cd doc && make html        # or: sphinx-build -b html . _build/html

Building a wheel: python -m build --wheel. See CHANGELOG.md for release notes.

License

CC-BY-NC-SA-4.0. See LICENSE.

Metadata

Release files for orange3-nlp 0.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for orange3-nlp 0.0.11
File Size Uploaded Provenance Actions
orange3_nlp-0.0.11.tar.gz 8.5 MB Without provenance Details for orange3_nlp-0.0.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for orange3-nlp 0.0.11
File Interpreter ABI Platform Actions
orange3_nlp-0.0.11-py3-none-any.whl Python 3 none any Details for orange3_nlp-0.0.11-py3-none-any.whl

Total release size: 17.1 MB

Release files / orange3_nlp-0.0.11.tar.gz

Download URL orange3_nlp-0.0.11.tar.gz
Size 8.5 MB
Tags Source
SHA-256 checksum
How to use checksums
d5bb4290380f7215ec5b2dd25085ea920b82903803fbd7ed0edc023735ce8c64
BLAKE2b-256 checksum
How to use checksums
73eb1049a214de5668ca2d2978d7aec7201dd3158df5a1cbebbcb30aa387df33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Release files / orange3_nlp-0.0.11-py3-none-any.whl

Download URL orange3_nlp-0.0.11-py3-none-any.whl
Size 8.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
fa335dcffbbf3469a6bd20de880b9836ff8f9e4595615c8b9cabfb5a53ae1535
BLAKE2b-256 checksum
How to use checksums
08d690a7b4e1de26f73d8fd125bed50d5bc61ffb9557615d9865ac38dbc35279
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Security for orange3-nlp 0.0.11

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page