Home/Packages/Prose

Prose · machine learning

Grammar rules first. A model only if you want one.

Prose reads plain text through the rules of grammar, keeps what it learns in a HoloDb database, and recombines that knowledge into new sentences that are grammatical, use words suited to their slots, and read plausibly. It exists to grow a training corpus: mine the grammatical knowledge already in your text — which nouns, verbs and adjectives go together, and how — then generate more of it, along with question/answer pairs for reading-comprehension training data.

v1.0.2 net8.0+ zero-training parser optional plausibility model free to use
dotnet add package EvaluatedApplications.Prose

The problem it solves

volume and variety, without a big model

Language models need volume and variety of grammatically correct text. Hand-writing or scraping more data doesn't scale, and most "data augmentation" either pastes fragments together ungrammatically or needs its own large model to run. Prose takes a different route: parse real text into its grammatical structure with deterministic rules, store what nouns/verbs/adjectives actually co-occur with what, and recombine those attested pieces into fresh sentences that are guaranteed to parse correctly before they're ever written out.

Why it's different

rules-first, nothing imaginary

Rules-first, not model-first

Parsing, mining and generation all run on deterministic grammar rules with zero training required. An optional small language model can layer on to rank candidates by plausibility, but Prose degrades gracefully to pure rules with no model at all.

No word locked to one role

The same surface form resolves to noun or verb by context, the way a person who has learned grammar reads it — not a fixed lookup table. The proof case is the classic "Eats, Shoots & Leaves" sentence: "the panda eats shoots and leaves" (no comma) parses as one verb with two coordinate noun objects; "the panda eats, shoots, and leaves" (comma) parses as three coordinate finite verbs. Same words — the punctuation alone flips the reading, and Prose gets both right.

Nothing imaginary

Every open-class word Prose emits is a form it actually observed in the source text — it never invents an inflection. Generated sentences are re-parsed and checked against a validity gate before they're kept, and generated Q&A pairs are checked the same way on both question and answer.

Real grammatical structure

Beyond simple subject-verb-object sentences, Prose mines and generates indirect objects ("gave him a book"), relative clauses ("the panda that eats bamboo"), and multi-sentence passages where later sentences refer back to earlier entities by name or pronoun.

Key features

parse, mine, generate

Parse

Sentence splitting, part-of-speech tagging, phrase chunking and role assignment (subject, verb, objects, indirect object, predicate, relative clauses) — zero training, no external model.

Mine

Scans a text corpus and builds a lexicon plus selectional tables (which subjects go with which verbs, which verbs take which objects, which adjectives modify which nouns), stored in HoloDb.

Generate

Samples a sentence shape from the mined patterns, fills each slot with an attested, agreement-correct word, and keeps only sentences that re-parse validly.

Plausibility scoring (optional)

A small language model ranks generated candidates so the output reads more sensibly, without weakening the grammatical guarantee.

Q&A generation

Turns generated sentences into context/question/answer triples, including multi-sentence passages with coreference and self-referential two-turn dialogues.

Corpus and TSV export

Write generated sentences straight to .txt files or Q&A pairs to a prompt\ttarget TSV, ready to feed into a language model's training data.

Get started

minimal example

var prose = new ProseEngine(); prose.Mine(@"C:\corpus\text"); // parse every *.txt and mine it prose.Save(@"prose.wal"); // persist the mined tables (optional) foreach (var sentence in prose.Generate(1000)) // new, grammatical, plausible sentences Console.WriteLine(sentence); prose.WriteCorpus(@"C:\corpus\synthetic", 100_000); // write sentences out as .txt for an LM prose.WriteQaPairs(@"C:\corpus\qa", 50_000); // context+question -> answer TSV

Parse a single sentence directly, no mining or database required:

var p = ProseEngine.ParseSentence("The panda eats, shoots, and leaves."); Console.WriteLine(ProseEngine.Explain(p)); // subject, verbs, objects, template

Depends on: HoloDb (the storage engine that holds mined grammar knowledge) and AlgFormer (supplies the optional plausibility-scoring model) — installing the NuGet package pulls both in automatically. License: proprietary, compiled library only; every capability is free to use.