From 86f6aef4d10152f7a1b2037bdecd76990f84fb78 Mon Sep 17 00:00:00 2001 From: Daniel Ellison Date: Tue, 24 Nov 2026 14:56:17 -0500 Subject: [PATCH 1/3] Count the structural readings of Phi sentences The sentence parser says whether a sentence has a canonical parse. The November assessment's central finding is that many sentences have several, because Phi marks the edges of embedded clauses and leaves the commoner phrase edges unmarked. This adds the instrument to measure that before anything is decided about marking them. `phi_readings.py` counts, for each clause, the ways the words before the verb divide into subject, adjuncts, object, and manner, and the places each adverbial or relative clause could end. `audit_phrase_readings.py` runs it over the lexicon's examples and the active Markdown, or shows one sentence's divisions. The count has no verb valency and no meanings. It is an upper bound on structural choice, and the validator notes say what it leaves out. No baseline is committed and no language rule changes. D132 records the first measurement. --- .github/workflows/validate.yml | 1 + documents/validation/sentence_validator.md | 25 + project/development_log.md | 1 + scripts/README.md | 11 + scripts/audit_phrase_readings.py | 214 +++++ scripts/phi_readings.py | 871 +++++++++++++++++++++ scripts/test_phi_readings.py | 119 +++ 7 files changed, 1242 insertions(+) create mode 100644 scripts/audit_phrase_readings.py create mode 100644 scripts/phi_readings.py create mode 100644 scripts/test_phi_readings.py diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 732a7332..003f19b4 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -25,6 +25,7 @@ jobs: run: | python3 scripts/validate_sentences.py python3 scripts/test_sentence_validator.py + python3 scripts/test_phi_readings.py - name: Test vocabulary schema run: python3 scripts/test_vocabulary_schema.py diff --git a/documents/validation/sentence_validator.md b/documents/validation/sentence_validator.md index 8af3f5c7..52e615e9 100644 --- a/documents/validation/sentence_validator.md +++ b/documents/validation/sentence_validator.md @@ -91,6 +91,31 @@ A literal `--sentence` always prints its advisories. Corpus runs print them with The ledger mixes two kinds of line: sentences whose order is right under the reading their author meant, and sentences that still need repair. Presence in the ledger means a sentence has been seen, not that it has been cleared. Lines from `texts/` wait for the two-phase translation process before any change. +## Counting readings + +The parser answers whether a sentence has a canonical parse. `scripts/phi_readings.py` asks how many it has. Phi marks the edges of embedded statements, questions, and quotations with words and leaves the commoner edges unmarked: where the subject ends and the object begins, where a prepositional phrase ends, whether a quality word before the verb is manner or object, and where an adverbial or relative clause hands over to the clause around it. + +A reading is one way of dividing a clause into phrases. For each core clause the counter takes the words before the Slot 1 stack, or before the verb when there is no stack, and enumerates every division that canon's order allows: subject, adjuncts, object or complement, then manner. It adds every place a dependent clause could end, using the parser to decide which ends are grammatical and its own phrase rules to discard the ones that leave an undividable clause. Readings multiply across the clauses of a sentence. Each sentence inside a quotation is counted as a sentence of its own. + +`phao lopia shelu theo.` has three: the parent reads the child's book, the parent's child reads the book, and the single phrase in which nobody is named as reader. `mia shia wiru ma nila.` has one, because a pronoun begins its phrase. + +Two counts are reported. The conservative count lets a noun, pronoun, or name end a phrase anywhere and lets an adjective or verb stand as a phrase only by itself and only where nothing else can end the phrase. The full count also lets an adjective (quality noun) or a verb (event noun) head a phrase with modifiers of its own, so `mia nohero to helui.` gains "my belief changed" beside "I changed the belief". + +What the figure is not: + +- It is an upper bound on structural choice. The counter has no verb valency and no meanings, so `mia nosa thole.` counts "my now practices" beside "I practice now". It does not estimate how often a reader goes wrong. +- It does not count bracketing inside a phrase, the role of a clause's only bare phrase (subject or object), or which referent a pronoun picks out. The last two are where the certified texts' recorded misreadings fall. +- It follows the parser's choice for clause coordination, and a small share of sentences in the texts fall outside its clause model; the report lists them as not modelled. + +```bash +python3 scripts/audit_phrase_readings.py --sentence "phao lopia shelu theo." +python3 scripts/audit_phrase_readings.py +python3 scripts/audit_phrase_readings.py --paths texts/velveteen_rabbit.md +python3 scripts/audit_phrase_readings.py --openers ha ra lo +``` + +The last form is a what-if. Canon lets a possessor stand before a phrase that opens with `ha` or `lo` (`lo mia lo manuwe`). `--openers` counts the readings that would remain if the listed Slot 2 words always began a new phrase. No baseline is committed and CI runs only the counter's unit tests. + ## Limits The parser knows grammar, not the English translation beside it. It cannot decide whether an evidential claim is warranted, whether an honorific tells the truth about a relationship, or whether a source sentence has been translated faithfully. diff --git a/project/development_log.md b/project/development_log.md index 5d094f9f..ca6d1fab 100644 --- a/project/development_log.md +++ b/project/development_log.md @@ -147,6 +147,7 @@ Implementation status, dependencies, optional evaluation work, and the next deve | D129 | Accepted | Certify chapter 1 of *News from Nowhere* under the isolated translation process. | Seventy-seven aligned Phi units reconstruct all 5,214 normalized Morris characters. The source-to-Phi pass read every unit against the source and repaired 30 under D126 and D128: adjuncts moved behind explicit subjects, dependent clauses given their own tense, past narration that had lost `to` restored, manner words brought inside the Slot 1 block, `miso` used as possessor and after a preposition, the old `sui` with an event noun replaced by `whau`, and a concessive `lu` recast with `shai`. Three fresh source-blind contexts derived the complete frozen stream, and a fourth checked the 26 units of the risk queue and deterministic sample. Its findings led to five further repairs: a passive for the rope-supported bridge whose relative clause read both ways, a `tha` frame that held two sentences, `li` on a quantity, a degree particle on a preposition, and a relative clause whose tense said "had stood" for "was standing". A fifth and a sixth context derived and checked those. The Phi freezes at `b8e2ae226d10405915618993bb9584d4e5974f537d88863ef5d9f12e8a9258ff`. The chapter no longer has a line in the sentence-order ledger. Left for the vocabulary work: `we` where Morris says "again", and `phirae` where he says "the rest". | | D130 | Accepted | Settle the small words and the clause relations, and license `tei` over a clause. | Seven maintainer rulings on 2026-11-24 answer section 4.7 and recommendation 16 of the November assessment. Each rests on a survey of every aligned text unit by its source line and on a source-blind reading test of thirty-eight invented sentences, two fresh readers per form; the sheet he ruled from is `archive/small_words_study.md`. Again receives a word (D131). Still is `tei nosa`, not yet is `tei nosa` with a negated verb, already is `phoe nosa` with `ki`, and no longer is `to te`, since readers took present `te` as a stopping in progress; `ra shemu` replaces `nosa` in a past account. Even is `we ko`, which the Slot 2 order already allowed and no text had used; bare `we` read as too every time. Instead is negation with `thona` or `whekai`, and except is `li` with the predicate turned. No relator is coined for when: `pheo` takes sequence, `whau` takes overlap and may now hold the briefer event, whenever is `lu` with `ro`, and `lu` never renders one past occasion, which both readers read as if. `tei` may stand over a clause, the one grammar extension: the clause comes first and carries its own tense, `tei` stays a preposition, and the relators stay six; the reason is the one that brought `whau`, and two of five source lines had dropped their until. At once, as soon as, soon, since, unless, even if, whether or not, only if, as if, so that, and the more the more are registered as the existing grammar says them. Canon gains four bullets, `documents/reference/small_words.md` is the registry, five fixed phrases enter the compound registry, thirteen entries, the grammar references, six manual pages, and five pages of the Adverbial Clauses pamphlet carry the rulings, and the pamphlet no longer teaches that `tei` takes no clause. The parser accepts a clause under sentence-initial `tei` and gains advisory `PHL005` for a `lu` condition whose two sentences are past with no `ro`. No text changes; `project/deferred_questions.md` lists the affected lines for one sweep after the language has settled. | | D131 | Accepted | Coin base `ture` for again. | The reading test in D130 tried four existing devices for again (`we` before the verb, `newu` as manner, an ordinal with `shemu`, and `phirae shemu`) and none was read as again above about seventy percent; in the one source-blind chapter all three `we` lines came back as also. `ture` is an adjective: directly before the verb, inside the Slot 1 block, it is again, and before a noun it is one more of the same kind, which leaves `phirae` to mean different. The maintainer chose the form from three cleared candidates. It has no neighbour at edit distance 1 and none in the phonetic audit, is no English word, and shares its opening with `turema` (return) as audible kinship without a productive affix. Two syllables rest on the protocol's daily-round test. The gloss is `again` although the class is adjective, because a gloss line reading `repeated` would suggest many repetitions; this is a judgement call open to correction. `CV-SMALL-01` records the decision, and `CV-SMALL-07` defers other and else to the ordinary-vocabulary step. | +| D132 | Accepted | Count the structural readings of Phi sentences. | Step 1 of the November assessment's answer to its central finding (section 4.3, recommendations 3 and 6): measure the unmarked phrase boundaries before deciding whether to mark them. `scripts/phi_readings.py` extends the sentence parser to count, for every clause, the ways the words before the verb divide into subject, adjuncts, object or complement, and manner, and the places each adverbial or relative clause could end; readings multiply across a sentence's clauses, and quoted sentences count separately. It reports a conservative count, in which only nouns, pronouns, and names end a phrase freely, and a full count that also lets an event or quality noun head a phrase with its own modifiers. `scripts/audit_phrase_readings.py` runs it over the lexicon's examples and the active Markdown and can show one sentence's divisions; `--openers` is a what-if that treats the listed Slot 2 words as always opening a phrase. The counter has no verb valency or meanings, so the figure is an upper bound on structural choice and not a comprehension rate, and it does not see the role of a single bare phrase or pronoun reference, which is where the two verified misreadings in certified text fall. First measurement on 2026-11-24: 42 percent of sentences in the translations have more than one division on the conservative count and 66 percent on the full count; the primer has 22 and 34 percent. Treating `ha`, `ra`, and `lo` as phrase openers lowers the translations' conservative figure to 35 percent. About one adverbial clause in five and one relative clause in five has more than one grammatical end. No baseline is committed and CI runs only the unit tests; whether to track the figure is the maintainer's decision. No language rule changes. | ## Completed discretionary lexical migrations diff --git a/scripts/README.md b/scripts/README.md index 759d6170..8bc0da29 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -119,6 +119,17 @@ python3 scripts/audit_phonetic_neighbors.py --candidate proposed_word python3 scripts/audit_phonetic_neighbors.py --kind function --prompts 40 --seed 202601 ``` +## audit_phrase_readings.py + +Counts the structural readings of every sentence in the lexicon and the active Markdown, using `phi_readings.py`: the ways each clause divides into subject, adjuncts, object, and manner, and the places each dependent clause could end. It prints a table by corpus, the kinds of open seam, a table by text, and the sentences with the most readings. The counter has no verb valency, so the figures are an upper bound on structural choice. `documents/validation/sentence_validator.md` describes the model and its limits. + +```bash +python3 scripts/audit_phrase_readings.py +python3 scripts/audit_phrase_readings.py --sentence "phao lopia shelu theo." +python3 scripts/audit_phrase_readings.py --openers ha ra lo +python3 scripts/test_phi_readings.py +``` + ## audit_sentence_order.py Lists every sentence in the lexicon and the active Markdown that parses and still has a reading under which canon's order is broken: a manner word outside the Slot 1 block (`PHL001`), a direct object before a prepositional phrase (`PHL002`), a period before `sho` (`PHL003`), an adjunct before the subject (`PHL004`), or a past `lu` condition with no habit marked (`PHL005`). The parser has no verb valency and cannot choose between the readings, so the list is for a person. CI regenerates the committed ledger and fails on any difference. diff --git a/scripts/audit_phrase_readings.py b/scripts/audit_phrase_readings.py new file mode 100644 index 00000000..7342ed3f --- /dev/null +++ b/scripts/audit_phrase_readings.py @@ -0,0 +1,214 @@ +#!/usr/bin/env python3 +"""Report how many structural readings Phi's sentences admit. + +Every sentence in the lexicon's examples and the active Markdown is parsed +and its readings counted by ``phi_readings``. A reading is one way of +dividing a clause into subject, adjuncts, object, and manner, together with +one choice of where each dependent clause ends. The counter has no verb +valency and no meanings, so the figures are an upper bound on structural +choice and say nothing about how often a reader goes wrong. + +Two counts are given. The conservative count lets only nouns, pronouns, and +names end a phrase freely. The full count also lets an adjective (quality +noun) or a verb (event noun) head a phrase with modifiers of its own. +""" + +from __future__ import annotations + +import argparse +from collections import Counter, defaultdict +import json +from pathlib import Path +import sys + +from phi_readings import ReadingCounter +from phi_sentence_validator import Lexicon, PROJECT_ROOT +import validate_sentences + +GROUPS = ( + ("Translations", "texts/"), + ("Original compositions", "texts/"), + ("Manual", "manual/"), + ("Pamphlets", "pamphlets/"), + ("Primer", "primer/"), + ("Book", "book/"), + ("Dictionary examples", "vocabulary/"), + ("Other documents", ""), +) + + +def original_works() -> frozenset[str]: + catalogue = json.loads((PROJECT_ROOT / "texts" / "catalogue.json").read_text(encoding="utf-8")) + return frozenset( + "texts/" + work["path"] + for work in catalogue.get("works", []) + if work.get("method", "").lower().startswith("original") + ) + + +def group_of(path: str, originals: frozenset[str]) -> str: + if path.startswith("texts/"): + return "Original compositions" if path in originals else "Translations" + for name, prefix in GROUPS[2:-1]: + if path.startswith(prefix): + return name + return "Other documents" + + +def collect(paths: list[str] | None, openers: frozenset[str] = frozenset()): + lexicon = Lexicon.load() + counter = ReadingCounter(lexicon, openers=openers) + sources = [] + if not paths: + sources.extend(validate_sentences.iter_lexicon_examples(PROJECT_ROOT)) + sources.extend( + validate_sentences.iter_markdown_examples( + PROJECT_ROOT, lexicon, paths or validate_sentences.ACTIVE_DOC_ROOTS + ) + ) + seen = set() + rows = [] + for source in sources: + path = source.label.split(":", 1)[0] + parts = counter.analyse_sentences(source.text, allow_fragments=source.allow_fragments) + if parts is None: + continue + for part in parts: + key = (path, part.text) + if key in seen: + continue + seen.add(key) + rows.append((path, part)) + return rows + + +def percent(part: int, whole: int) -> str: + return f"{100 * part / whole:.0f}%" if whole else "-" + + +def render(rows, top: int) -> str: + originals = original_works() + by_group = defaultdict(list) + by_file = defaultdict(list) + for path, part in rows: + by_group[group_of(path, originals)].append(part) + by_file[path].append(part) + + lines = ["# Phrase-reading audit", ""] + lines += [ + "| Corpus | Sentences | More than one reading | Four or more | " + "More than one, full count | Outside canonical order | Not modelled |", + "|---|---:|---:|---:|---:|---:|---:|", + ] + order = [name for name, _ in GROUPS] + for name in order: + parts = by_group.get(name) + if not parts: + continue + total = len(parts) + many = sum(1 for p in parts if p.conservative > 1) + four = sum(1 for p in parts if p.conservative >= 4) + wide = sum(1 for p in parts if p.full > 1) + relaxed = sum(1 for p in parts if any(c.relaxed for c in p.clauses)) + missed = sum(1 for p in parts if p.unmodelled) + lines.append( + f"| {name} | {total} | {many} ({percent(many, total)}) | " + f"{four} ({percent(four, total)}) | {wide} ({percent(wide, total)}) | " + f"{relaxed} ({percent(relaxed, total)}) | {missed} ({percent(missed, total)}) |" + ) + + seam_counts: Counter[str] = Counter() + ambiguous_clauses = 0 + join_counts: Counter[str] = Counter() + join_total: Counter[str] = Counter() + for _, part in rows: + for clause in part.clauses: + if clause.conservative > 1 and clause.seams: + ambiguous_clauses += 1 + seam_counts.update(clause.seams) + for join in part.joins: + join_total[join.kind] += 1 + if join.alternatives > 1: + join_counts[join.kind] += 1 + + lines += ["", "## Where the open seams are", ""] + lines.append( + f"Clauses with more than one division, conservative count: {ambiguous_clauses}. " + "A clause may show several kinds." + ) + lines += ["", "| Kind of seam | Clauses |", "|---|---:|"] + for kind, count in seam_counts.most_common(): + lines.append(f"| {kind} | {count} |") + lines += ["", "| Dependent clause | With more than one possible end | Of |", "|---|---:|---:|"] + for kind in ("adverbial", "relative"): + lines.append(f"| {kind} | {join_counts[kind]} | {join_total[kind]} |") + + lines += ["", "## By text", "", "| File | Sentences | More than one reading | Full count |", "|---|---:|---:|---:|"] + for path in sorted(by_file): + if not path.startswith("texts/"): + continue + parts = by_file[path] + total = len(parts) + many = sum(1 for p in parts if p.conservative > 1) + wide = sum(1 for p in parts if p.full > 1) + lines.append( + f"| `{path}` | {total} | {many} ({percent(many, total)}) | " + f"{wide} ({percent(wide, total)}) |" + ) + + lines += ["", f"## The {top} sentences with the most readings", ""] + ranked = sorted(rows, key=lambda row: (-row[1].conservative, row[0], row[1].text))[:top] + for path, part in ranked: + lines.append(f"- {part.conservative} readings, `{path}`: `{part.text}`") + return "\n".join(lines) + "\n" + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--paths", nargs="+", help="active Markdown paths; default is everything") + parser.add_argument("--sentence", help="count one literal Phi sentence and show its divisions") + parser.add_argument("--output", type=Path, help="write the report here") + parser.add_argument("--top", type=int, default=20, help="how many sentences to list") + parser.add_argument( + "--openers", + nargs="+", + default=[], + help="what-if: count as though these Slot 2 words always began a new phrase", + ) + args = parser.parse_args() + + if args.sentence is not None: + counter = ReadingCounter(openers=frozenset(args.openers)) + parts = counter.analyse_sentences(args.sentence) + if parts is None: + print("The sentence does not parse.") + return 1 + for part in parts: + print(f"{part.text}") + print(f" readings: {part.conservative} conservative, {part.full} full") + for join in part.joins: + print( + f" {join.kind} clause opened by '{join.opener}': " + f"{join.alternatives} possible end(s)" + ) + for clause in part.clauses: + if clause.conservative < 2: + continue + print(f" clause: {clause.text}") + for division in clause.divisions: + print(f" {division}") + if clause.seams: + print(f" open seams: {', '.join(clause.seams)}") + return 0 + + text = render(collect(args.paths, frozenset(args.openers)), args.top) + if args.output: + args.output.write_text(text, encoding="utf-8") + print(f"wrote {args.output}") + else: + sys.stdout.write(text) + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/phi_readings.py b/scripts/phi_readings.py new file mode 100644 index 00000000..b22575f8 --- /dev/null +++ b/scripts/phi_readings.py @@ -0,0 +1,871 @@ +#!/usr/bin/env python3 +"""Count the structural readings of a Phi sentence. + +``phi_sentence_validator`` accepts a sentence when one canonical parse +exists. This module asks the next question: how many are there? Phi marks +the edges of embedded statements, questions, and quotations with words, and +leaves the commoner edges unmarked: where the subject ends and the object +begins, where a prepositional phrase ends, whether a quality word before the +verb is its manner or its object, and where an adverbial or relative clause +hands over to the clause around it. + +A reading here is one way of dividing a clause's words into phrases. For +each core clause the counter takes the words before the Slot 1 stack (or +before the verb when the clause has no stack) and enumerates every division +into phrases that canon's clause order allows: + + [subject] [adjuncts] [object or complement] | Slot 1 | manner | verb + +It adds the places where a dependent clause could end, using the parser +itself to decide which splits are grammatical. Readings multiply across the +clauses of one sentence. + +What the count does not do: + +* It has no verb valency and no meanings, so it cannot discard a reading + that is grammatical and absurd. ``mia nosa thole`` counts two divisions, + "I practice now" and "my now practices". The figure is an upper bound on + structural choice, never an estimate of how often a reader is confused. +* It does not count bracketing inside a phrase. ``phao lopia shelu`` as one + phrase is one reading, whichever noun owns which. +* It follows the parser's own choice for clause coordination. + +Two strictness levels are reported. The conservative count lets a noun, +pronoun, or name end a phrase anywhere, and lets an adjective or verb stand +as a phrase by itself only where nothing else can end the phrase. The full +count also lets an adjective (quality noun) or a verb (event noun) head a +phrase with its own modifiers, as in ``thia shua`` (your coming). +""" + +from __future__ import annotations + +from dataclasses import dataclass, field +from typing import Iterator, Sequence + +from phi_sentence_validator import ( + ADVERBIAL_RELATORS, + CLAUSAL_PREPOSITIONS, + COORDINATORS, + DISCOURSE_MARKERS, + Lexicon, + NOMINAL_RELATORS, + NUMERAL_DIGITS, + NUMERAL_SCALES, + PREDICATIVE_VERBS, + PhiParser, + SLOT2_DEGREE, + SLOT2_OUTER, + SLOT2_WORDS, + SyntaxNode, + TEMPORAL_NP_RELATORS, +) + +ADJUNCT_INTERROGATIVES = frozenset({"misa", "weno", "kua", "thela"}) +# Nouns that stand as bare time adjuncts between subject and object. The +# parser's own temporal set is every noun with a temporal domain, which +# includes child, elder, seed, and festival; a bare adjunct needs a narrower +# test, so these are chosen by gloss. +TIME_ADJUNCT_GLOSSES = frozenset( + { + "now", "moment", "time", "instant", "period", "past", "present", "future", + "day", "week", "month", "season", "year", "generation", + "dawn", "morning", "midday", "afternoon", "evening", "dusk", "night", "midnight", + "spring", "summer", "autumn", "winter", + } +) +NAME_MARKERS = frozenset({"ne", "sa", "ni", "le"}) + +# A clause this long is not enumerated. Nothing in the corpus comes close. +MAX_UNITS = 22 +MAX_SHOWN = 12 + + +@dataclass(frozen=True) +class Unit: + """One top-level item before the verb: a word, a frame, or a relative clause.""" + + cls: str + start: int + end: int + word: str + temporal: bool = False + inner: tuple[int, int] = (1, 1) + + +@dataclass +class ClauseReadings: + """The divisions of one core clause.""" + + start: int + end: int + text: str + conservative: int + full: int + relaxed: bool + divisions: list[str] = field(default_factory=list) + seams: list[str] = field(default_factory=list) + + +@dataclass +class JoinReadings: + """The places where one dependent clause could end.""" + + kind: str + opener: str + start: int + alternatives: int + + +@dataclass +class SentenceReadings: + """Counts for one sentence, or for a condition with its consequence.""" + + text: str + conservative: int + full: int + clauses: list[ClauseReadings] + joins: list[JoinReadings] + unmodelled: bool = False + + @property + def ambiguous(self) -> bool: + return self.conservative > 1 + + +class ReadingCounter(PhiParser): + """A parser that also counts the readings of what it accepts. + + Internally every count is a pair, conservative and full. A full count of + zero means the span has no division under this model, which is how an + alternative the looser parser would accept gets discarded. + """ + + def __init__( + self, lexicon: Lexicon | None = None, *, openers: frozenset[str] = frozenset() + ): + """``openers`` is a what-if: Slot 2 words assumed always to begin a phrase. + + Canon lets a possessor stand before a phrase that opens with ``ha`` or + ``lo`` (``lo mia lo manuwe``, our hands). Passing those words here + counts the readings that would remain if such a word always began a + new phrase. + """ + super().__init__(lexicon) + self.openers = openers + self.time_heads = frozenset( + word + for word, entry in self.lexicon.entries.items() + if entry.pos == "noun" and entry.gloss.split(" (")[0] in TIME_ADJUNCT_GLOSSES + ) + self._clauses: list[ClauseReadings] = [] + self._joins: list[JoinReadings] = [] + self._quoted: dict[tuple[int, int], SentenceReadings] = {} + self._unmodelled = False + + # ------------------------------------------------------------------ + # Entry points + # ------------------------------------------------------------------ + + def analyse(self, text: str, *, allow_fragments: bool = False) -> SentenceReadings | None: + """Counts for a whole passage, or None if it does not parse.""" + parts = self.analyse_sentences(text, allow_fragments=allow_fragments) + if parts is None: + return None + conservative, full = 1, 1 + clauses: list[ClauseReadings] = [] + joins: list[JoinReadings] = [] + for part in parts: + conservative *= part.conservative + full *= part.full + clauses.extend(part.clauses) + joins.extend(part.joins) + return SentenceReadings( + text, conservative, full, clauses, joins, any(part.unmodelled for part in parts) + ) + + def analyse_sentences( + self, text: str, *, allow_fragments: bool = False + ) -> list[SentenceReadings] | None: + """Counts for each sentence of a passage, or None if it does not parse. + + A ``lu`` condition and its consequence count as one sentence. Each + sentence inside a quotation counts as a sentence of its own. + """ + result = self.parse(text, allow_fragments=allow_fragments) + if not result.ok or result.tree is None: + return None + parts = [] + for node in result.tree.children: + self._clauses = [] + self._joins = [] + self._quoted = {} + self._unmodelled = False + cons, wide = self._floor(self._count_node(node)) + words = self._sentence_text(node.start, node.end) + parts.append( + SentenceReadings(words, cons, wide, self._clauses, self._joins, self._unmodelled) + ) + parts.extend(self._quoted[key] for key in sorted(self._quoted)) + del self.diagnostics[:] + return parts + + def _floor(self, counts: tuple[int, int]) -> tuple[int, int]: + """A sentence the parser accepted has at least one reading.""" + if counts[1] == 0: + self._unmodelled = True + return 1, 1 + return counts + + def _sentence_text(self, start: int, end: int) -> str: + """The words of a sentence, with the content of each quotation elided.""" + words = [] + index = start + while index < end: + word = self._word(index) + words.append(word) + closer = self.frame_close.get(index) + if word == "sha" and closer is not None and closer < end: + words.append("...") + index = closer + continue + index += 1 + return " ".join(words).replace(" .", ".") + "." + + def _count_node(self, node: SyntaxNode) -> tuple[int, int]: + if node.kind in {"realis-conditional", "irrealis-conditional"}: + cons, wide = 1, 1 + for child in node.children: + c, w = self._count_node(child) + cons *= c + wide *= w + return cons, wide + if node.kind == "clause": + return self._count_clause(node.start, node.end, allow_gap=False) + return 1, 1 + + # ------------------------------------------------------------------ + # Records that can be withdrawn when an alternative proves illegal + # ------------------------------------------------------------------ + + def _mark(self) -> tuple[int, int]: + return len(self._clauses), len(self._joins) + + def _rollback(self, mark: tuple[int, int]) -> None: + del self._clauses[mark[0] :] + del self._joins[mark[1] :] + + def _record_join(self, kind: str, opener: str, start: int, alternatives: int) -> None: + if not any(join.kind == kind and join.start == start for join in self._joins): + self._joins.append(JoinReadings(kind, opener, start, alternatives)) + + # ------------------------------------------------------------------ + # Clauses and their joins + # ------------------------------------------------------------------ + + def _parses(self, start: int, end: int, *, allow_gap: bool) -> bool: + checkpoint = len(self.diagnostics) + self._parse_clause(start, end, allow_gap=allow_gap) + ok = len(self.diagnostics) == checkpoint + del self.diagnostics[checkpoint:] + return ok + + def _core_parses(self, start: int, end: int, allow_gap: bool) -> bool: + checkpoint = len(self.diagnostics) + self._parse_core_clause(start, end, allow_gap=allow_gap) + ok = len(self.diagnostics) == checkpoint + del self.diagnostics[checkpoint:] + return ok + + def _count_clause(self, start: int, end: int, *, allow_gap: bool) -> tuple[int, int]: + checkpoint = len(self.diagnostics) + index, _ = self._parse_sentence_frame(start, end) + del self.diagnostics[checkpoint:] + if index < end and self._word(index) in DISCOURSE_MARKERS: + index += 1 + if index >= end: + return 1, 1 + if index + 1 == end and self._word(index) in self.lexicon.interjections: + return 1, 1 + + checkpoint = len(self.diagnostics) + coordinate = self._try_clause_coordination(index, end, allow_gap) + del self.diagnostics[checkpoint:] + if coordinate is not None and len(coordinate.children) == 2: + left, right = coordinate.children + lc, lw = self._count_clause(left.start, left.end, allow_gap=allow_gap) + rc, rw = self._count_clause(right.start, right.end, allow_gap=allow_gap) + return lc * rc, lw * rw + + opener = self._word(index) + if opener in ADVERBIAL_RELATORS or opener in CLAUSAL_PREPOSITIONS: + counted = self._count_adverbial(index, end, allow_gap) + if counted is not None: + return counted + return self._count_core(index, end, allow_gap=allow_gap) + + def _count_adverbial( + self, start: int, end: int, allow_gap: bool + ) -> tuple[int, int] | None: + """Sum over every place the dependent material could end.""" + relator = self._word(start) + cons_total, wide_total = 0, 0 + alternatives = 0 + parser_alternatives = 0 + for split in self._candidate_clause_ends(start + 1, end): + if split >= end: + continue + if not self._parses(start + 1, split, allow_gap=False): + continue + if not self._parses(split, end, allow_gap=allow_gap): + continue + parser_alternatives += 1 + mark = self._mark() + dc, dw = self._count_clause(start + 1, split, allow_gap=False) + mc, mw = self._count_clause(split, end, allow_gap=allow_gap) + if dw == 0 or mw == 0: + self._rollback(mark) + continue + cons_total += dc * mc + wide_total += dw * mw + alternatives += 1 + if relator in TEMPORAL_NP_RELATORS | NOMINAL_RELATORS: + needs_time = relator in TEMPORAL_NP_RELATORS + for split in range(start + 2, end): + if not self._valid_nominal_span(start + 1, split): + continue + if needs_time and not self._is_time_phrase(self._words(start + 1, split)): + continue + if not self._parses(split, end, allow_gap=allow_gap): + continue + parser_alternatives += 1 + if not self._is_noun_phrase(start + 1, split): + continue + mark = self._mark() + mc, mw = self._count_clause(split, end, allow_gap=allow_gap) + if mw == 0: + self._rollback(mark) + continue + cons_total += mc + wide_total += mw + alternatives += 1 + if parser_alternatives == 0: + return None + if relator in CLAUSAL_PREPOSITIONS and self._core_parses(start, end, allow_gap): + # tei is still a preposition, so the whole span may also be one + # clause that opens with a prepositional phrase. + core_c, core_w = self._count_core(start, end, allow_gap=allow_gap, record=False) + if core_w: + cons_total += core_c + wide_total += core_w + alternatives += 1 + if alternatives: + self._record_join("adverbial", relator, start, alternatives) + return cons_total, wide_total + + def _is_noun_phrase(self, start: int, end: int) -> bool: + """Whether the span is one noun phrase under the full count.""" + for units, _, inner_w in self._unit_sequences(start, end): + if inner_w and units and self._noun_phrase(units, 0, len(units), None, True): + return True + return False + + # ------------------------------------------------------------------ + # The core clause + # ------------------------------------------------------------------ + + def _count_core( + self, start: int, end: int, *, allow_gap: bool, record: bool = True + ) -> tuple[int, int]: + predicate_index = end - 1 + if predicate_index < start: + return 1, 1 + cons_total, wide_total = 0, 0 + relaxed_used = False + shown: list[str] = [] + seams: set[str] = set() + mark = self._mark() + for units, inner_c, inner_w in self._unit_sequences(start, predicate_index): + if inner_w == 0: + continue + pre, manner_ok = self._preverbal(units, predicate_index) + if len(pre) > MAX_UNITS: + cons_total += inner_c + wide_total += inner_w + continue + has_ka = any(u.cls == "S1" and u.word == "ka" for u in units) + predicative = self._word(predicate_index) in PREDICATIVE_VERBS + counts = {} + for full in (False, True): + found = self._divisions( + pre, manner_ok, has_ka, predicative, allow_gap, full, relaxed=False + ) + if not found: + found = self._divisions( + pre, manner_ok, has_ka, predicative, allow_gap, full, relaxed=True + ) + if found and full: + relaxed_used = True + counts[full] = found + cons, wide = counts[False], counts[True] + if not wide and not cons: + continue + # A clause that divides only when an event or quality noun heads + # a phrase still has that one reading on the conservative count. + cons_total += max(len(cons), 1) * inner_c + wide_total += max(len(wide), len(cons)) * inner_w + if len(cons) > 1: + seams.update(self._seam_types(pre, cons)) + for division in cons: + if len(shown) < MAX_SHOWN: + shown.append(self._render(pre, division)) + if wide_total == 0: + self._rollback(mark) + return 0, 0 + if record and not any( + clause.start == start and clause.end == end for clause in self._clauses + ): + self._clauses.append( + ClauseReadings( + start, + end, + " ".join(self._words(start, end)), + cons_total, + wide_total, + relaxed_used, + shown if cons_total > 1 else [], + sorted(seams), + ) + ) + return cons_total, wide_total + + def _unit_sequences( + self, start: int, stop: int + ) -> Iterator[tuple[list[Unit], int, int]]: + """Every way to cut the words in [start, stop) into top-level units. + + Complement frames are single units. A relative clause may end at more + than one verb, so each ``whu`` yields one sequence per legal end. + """ + + def walk(index: int) -> Iterator[tuple[list[Unit], int, int]]: + if index >= stop: + yield [], 1, 1 + return + word = self._word(index) + closer = self.frame_close.get(index) + if closer is not None and closer < stop + 1: + if word == "sha": + inner = self._count_quotation(index + 1, closer) + else: + inner = self._floor(self._count_sequence(index + 1, closer)) + unit = Unit("FRAME", index, closer + 1, word) + for rest, c, w in walk(closer + 1): + yield [unit, *rest], c * inner[0], w * inner[1] + return + if word == "whu": + ends = [] + parser_ends = [] + for clause_end in self._candidate_clause_ends(index + 1, stop + 1): + if clause_end > stop: + continue + if not self._parses(index + 1, clause_end, allow_gap=True): + continue + parser_ends.append(clause_end) + mark = self._mark() + inner = self._count_clause(index + 1, clause_end, allow_gap=True) + if inner[1] == 0: + self._rollback(mark) + continue + ends.append((clause_end, inner)) + if not ends and parser_ends: + self._unmodelled = True + ends = [(parser_ends[-1], (1, 1))] + if ends: + self._record_join("relative", "whu", index, len(ends)) + for clause_end, inner in ends: + unit = Unit("REL", index, clause_end, "whu") + for rest, c, w in walk(clause_end): + yield [unit, *rest], c * inner[0], w * inner[1] + return + unit = self._classify(index) + for rest, c, w in walk(index + 1): + yield [unit, *rest], c, w + + yield from walk(start) + + def _count_quotation(self, start: int, end: int) -> tuple[int, int]: + """Count each quoted sentence as a sentence of its own. + + A speech of ten sentences inside one ``sha ... sho`` frame is ten + sentences for a listener, so its readings are reported one by one and + do not multiply into the sentence that frames it. + """ + checkpoint = len(self.diagnostics) + ranges = self._root_sentence_ranges(start, end) + del self.diagnostics[checkpoint:] + position = 0 + while position < len(ranges): + first_start, last_end = ranges[position] + step = 1 + if self._word(first_start) == "lu" and position + 1 < len(ranges): + last_end = ranges[position + 1][1] + step = 2 + key = (first_start, last_end) + if key not in self._quoted: + saved = (self._clauses, self._joins, self._unmodelled) + self._clauses, self._joins, self._unmodelled = [], [], False + cons, wide = self._floor(self._count_sequence(first_start, last_end)) + self._quoted[key] = SentenceReadings( + self._sentence_text(first_start, last_end), + cons, + wide, + self._clauses, + self._joins, + self._unmodelled, + ) + self._clauses, self._joins, self._unmodelled = saved + position += step + return 1, 1 + + def _count_sequence(self, start: int, end: int) -> tuple[int, int]: + """Readings of the sentences inside a complement frame.""" + cons, wide = 1, 1 + checkpoint = len(self.diagnostics) + ranges = self._root_sentence_ranges(start, end) + del self.diagnostics[checkpoint:] + for sentence_start, sentence_end in ranges: + index = sentence_start + if self._word(index) == "lu": + index += 1 + if index < sentence_end and self._word(index) == "he": + index += 1 + if self._parses(index, sentence_end, allow_gap=False): + c, w = self._count_clause(index, sentence_end, allow_gap=False) + cons, wide = cons * c, wide * w + return cons, wide + + def _classify(self, index: int) -> Unit: + word = self._word(index) + lexicon = self.lexicon + pos = lexicon.pos(word) + + def unit(cls: str, temporal: bool = False) -> Unit: + return Unit(cls, index, index + 1, word, temporal) + + if index in self.name_atoms: + return unit("NAME") + if word in lexicon.slot1_words: + return unit("S1") + if word in NAME_MARKERS or word in SLOT2_WORDS: + return unit("S2") + if word in TEMPORAL_NP_RELATORS: + return unit("RELT") + if word in lexicon.prepositions or word == "lila": + return unit("PREP") + if word in COORDINATORS: + return unit("COORD") + if word in lexicon.pronouns: + return unit("PRON") + if word in ADJUNCT_INTERROGATIVES: + return unit("ADVQ") + if word == "sua": + return unit("PRON") + if ( + word in lexicon.quantifiers + or word in lexicon.classifiers + or word in NUMERAL_DIGITS + or word in NUMERAL_SCALES + or word == "wia" + or pos == "numeral" + ): + return unit("DET") + if pos == "noun" or word == "hina": + return unit("N", word in self.time_heads) + if pos == "adjective": + return unit("ADJ") + if pos == "verb": + return unit("V") + return unit("OTHER") + + def _preverbal( + self, units: Sequence[Unit], predicate_index: int + ) -> tuple[list[Unit], bool]: + """The units to divide, and whether a manner tail is possible. + + With a Slot 1 stack, only what stands before the stack is divided: + whatever follows it is manner by position. With no stack, an + adjective directly before the verb may be manner or object. + """ + stack = [position for position, u in enumerate(units) if u.cls == "S1"] + if stack: + pre = list(units[: stack[0]]) + manner_ok = False + else: + pre = list(units) + manner_ok = self._word(predicate_index) not in PREDICATIVE_VERBS + # we and li on the verb stand at the outer edge of the verb phrase, and + # a degree particle or ko directly before the verb belongs to the verb. + while pre and pre[-1].cls == "S2" and pre[-1].word in SLOT2_OUTER | SLOT2_DEGREE | {"ko"}: + pre.pop() + return pre, manner_ok + + # ------------------------------------------------------------------ + # Dividing the words before the verb + # ------------------------------------------------------------------ + + def _divisions( + self, + pre: Sequence[Unit], + manner_ok: bool, + has_ka: bool, + predicative: bool, + allow_gap: bool, + full: bool, + relaxed: bool, + ) -> list[tuple]: + """Every legal division, as (boundaries, manner_start) tuples.""" + results: list[tuple] = [] + # A manner tail is a run of adjectives, each with any degree + # particles, standing directly before the verb. A degree particle + # left behind at the end of the body fails the phrase check below. + tails = [len(pre)] + if manner_ok and pre and pre[-1].cls == "ADJ": + position = len(pre) + while position > 0 and ( + pre[position - 1].cls == "ADJ" + or (pre[position - 1].cls == "S2" and pre[position - 1].word in SLOT2_DEGREE) + ): + position -= 1 + tails.append(position) + for tail in sorted(set(tails)): + body = pre[:tail] + for boundaries, types in self._segmentations(body, allow_gap, full): + if self._template_ok(body, types, has_ka, predicative, relaxed): + results.append((boundaries, tail)) + return results + + def _segmentations( + self, body: Sequence[Unit], allow_gap: bool, full: bool + ) -> Iterator[tuple[tuple[int, ...], tuple[str, ...]]]: + count = len(body) + if count == 0: + yield (), () + return + + def walk(position: int) -> Iterator[tuple[tuple[int, ...], tuple[str, ...]]]: + if position == count: + yield (), () + return + for stop in range(position + 1, count + 1): + kind = self._phrase_type(body, position, stop, allow_gap, full) + if kind is None: + continue + for boundaries, types in walk(stop): + yield (stop, *boundaries), (kind, *types) + + yield from walk(0) + + def _phrase_type( + self, body: Sequence[Unit], start: int, stop: int, allow_gap: bool, full: bool + ) -> str | None: + following = body[stop] if stop < len(body) else None + # we, li, and ko may stand at the outer edge of a prepositional phrase. + while ( + start + 1 < stop + and body[start].cls == "S2" + and body[start].word in SLOT2_OUTER | {"ko"} + and body[start + 1].cls in {"PREP", "RELT", "S2"} + and any(unit.cls in {"PREP", "RELT"} for unit in body[start + 1 : stop]) + and all(unit.cls == "S2" for unit in body[start : self._first_opener(body, start, stop)]) + ): + start += 1 + first = body[start] + if first.cls == "ADVQ": + return "ADJUNCT" if stop == start + 1 else None + if first.cls == "OTHER": + return "ADJUNCT" if stop == start + 1 else None + if first.cls in {"PREP", "RELT"}: + # Two prepositional phrases joined by a coordinator are one adjunct. + for position in range(start + 1, stop - 1): + if body[position].cls == "COORD" and body[position + 1].cls in {"PREP", "RELT"}: + left = self._phrase_type(body[:position], start, position, allow_gap, full) + right = self._phrase_type(body, position + 1, stop, allow_gap, full) + return "ADJUNCT" if left == right == "ADJUNCT" else None + rest_start = start + 1 + if rest_start == stop: + return "ADJUNCT" if allow_gap else None + if stop == rest_start + 1 and body[rest_start].cls == "ADVQ": + return "ADJUNCT" + if body[rest_start].cls in {"PREP", "RELT"}: + inner = self._phrase_type(body, rest_start, stop, allow_gap, full) + return "ADJUNCT" if inner == "ADJUNCT" else None + head = self._noun_phrase(body, rest_start, stop, following, full) + if head is None: + return None + if first.cls == "RELT" and head != "TIME": + return None + return "ADJUNCT" + head = self._noun_phrase(body, start, stop, following, full) + if head is None: + return None + return "TIME" if head == "TIME" else "BARE" + + def _first_opener(self, body: Sequence[Unit], start: int, stop: int) -> int: + for position in range(start, stop): + if body[position].cls in {"PREP", "RELT"}: + return position + return stop + + def _noun_phrase( + self, + body: Sequence[Unit], + start: int, + stop: int, + following: Unit | None, + full: bool, + ) -> str | None: + """Whether body[start:stop] is one noun phrase; returns its head kind.""" + conjuncts: list[list[Unit]] = [[]] + for unit in body[start:stop]: + if unit.cls == "COORD": + conjuncts.append([]) + else: + conjuncts[-1].append(unit) + if any(not conjunct for conjunct in conjuncts): + return None + # Nothing can continue a noun phrase across these, so a quality word, + # an event noun, or a quantity word standing before one must be a head. + forced = following is None or following.cls in { + "PREP", "RELT", "ADVQ", "PRON", "FRAME", "OTHER", "S1" + } + head_kind = "NOUN" + for position, conjunct in enumerate(conjuncts): + last = conjunct[-1] + is_last_conjunct = position == len(conjuncts) - 1 + content = [u for u in conjunct if u.cls not in {"S2", "DET"}] + for offset, unit in enumerate(conjunct): + if unit.cls in {"PREP", "RELT", "ADVQ", "OTHER", "S1"}: + return None + if unit.cls == "FRAME" and any( + earlier.cls != "S2" for earlier in conjunct[:offset] + ): + return None + if unit.cls == "PRON" and any( + earlier.cls != "S2" for earlier in conjunct[:offset] + ): + return None + if ( + unit.cls == "S2" + and unit.word in self.openers + and any(earlier.cls != "S2" for earlier in conjunct[:offset]) + ): + return None + alone = len(content) <= 1 + edge_forced = forced if is_last_conjunct else True + if last.cls in {"N", "PRON", "NAME", "REL", "FRAME"}: + pass + elif last.cls in {"ADJ", "V"}: + if not full and not (alone and edge_forced): + return None + elif last.cls == "DET": + if not edge_forced: + return None + elif last.cls == "S2": + if last.word not in {"ha", "ra"} or any(u.cls != "S2" for u in conjunct): + return None + else: + return None + if is_last_conjunct: + head_kind = "TIME" if last.temporal else "NOUN" + return head_kind + + def _template_ok( + self, + body: Sequence[Unit], + types: Sequence[str], + has_ka: bool, + predicative: bool, + relaxed: bool, + ) -> bool: + count = len(types) + bare = [position for position, kind in enumerate(types) if kind == "BARE"] + limit = 3 if has_ka else 2 + if len(bare) > limit: + return False + if predicative: + # nai and kelu need a complement, and canon makes a clause-initial + # pronoun before one the subject: mia lohau nai is "I am a dog". + if count == 0: + return False + content = [unit for unit in body if unit.cls != "S2"] + if count == 1 and len(content) > 1 and content[0].cls == "PRON": + return False + if relaxed: + return True + allowed = {0, count - 1} + if has_ka: + allowed.add(count - 2) + return all(position in allowed for position in bare) + + # ------------------------------------------------------------------ + # Reporting + # ------------------------------------------------------------------ + + def _render(self, pre: Sequence[Unit], division: tuple) -> str: + if not division: + return "" + boundaries, tail = division + parts = [] + position = 0 + for stop in boundaries: + words = " ".join( + " ".join(self._words(u.start, u.end)) for u in pre[position:stop] + ) + parts.append(f"[{words}]") + position = stop + if tail < len(pre): + words = " ".join(u.word for u in pre[tail:]) + parts.append(f"<{words}>") + return " ".join(parts) + + def _seam_types(self, pre: Sequence[Unit], divisions: Sequence[tuple]) -> set[str]: + """Name each place that is a phrase edge in one reading and not in another.""" + types: set[str] = set() + edge_sets = [] + manner_starts = set() + for boundaries, tail in divisions: + edges = set(boundaries) + if tail < len(pre): + manner_starts.add(tail) + edge_sets.append(edges - {len(pre)}) + if len(manner_starts) > 0 and any(tail == len(pre) for _, tail in divisions): + types.add("manner or object") + every = set().union(*edge_sets) if edge_sets else set() + for edge in sorted(every): + if all(edge in edges for edges in edge_sets): + continue + left, right = pre[edge - 1], pre[edge] + if left.temporal or right.temporal or self._phrase_is_time(pre, edge): + types.add("time word") + elif right.cls == "S2": + types.add("before a Slot 2 word") + elif left.cls == "PRON": + types.add("pronoun then noun") + elif left.cls == "NAME": + types.add("name then noun") + elif left.cls in {"ADJ", "V"} or right.cls in {"ADJ", "V"}: + types.add("quality or event word") + else: + types.add("noun then noun") + return types + + def _phrase_is_time(self, pre: Sequence[Unit], edge: int) -> bool: + position = edge + while position < len(pre) and pre[position].cls in {"S2", "DET", "ADJ"}: + position += 1 + return position < len(pre) and pre[position].temporal + + +def count_readings(text: str, counter: ReadingCounter | None = None) -> SentenceReadings | None: + """Convenience wrapper for one sentence.""" + return (counter or ReadingCounter()).analyse(text) diff --git a/scripts/test_phi_readings.py b/scripts/test_phi_readings.py new file mode 100644 index 00000000..01f2966b --- /dev/null +++ b/scripts/test_phi_readings.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python3 +"""Regression tests for the structural-reading counter.""" + +from pathlib import Path +import subprocess +import sys +import unittest + +from phi_readings import ReadingCounter + + +PROJECT_ROOT = Path(__file__).resolve().parent.parent + + +class ReadingCounterTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.counter = ReadingCounter() + + def counts(self, text): + result = self.counter.analyse(text) + self.assertIsNotNone(result, text) + return result.conservative, result.full + + def test_settled_clauses_have_one_reading(self): + for text in ( + "mia thia nila.", + "melu to kamo.", + "lopia tei norawhi wile.", + "shia to pakiro whano.", + "mia thia ru woraka.", + ): + with self.subTest(text=text): + self.assertEqual((1, 1), self.counts(text)) + + def test_a_bare_noun_chain_divides_at_every_seam(self): + result = self.counter.analyse("phao lopia shelu theo.") + self.assertEqual(3, result.conservative) + self.assertEqual( + ["[phao] [lopia shelu]", "[phao lopia] [shelu]", "[phao lopia shelu]"], + result.clauses[0].divisions, + ) + self.assertEqual(["noun then noun"], result.clauses[0].seams) + + def test_the_causative_admits_a_third_bare_phrase(self): + self.assertEqual((4, 4), self.counts("phao lopia shelu ka theo.")) + + def test_a_pronoun_begins_its_phrase(self): + self.assertEqual((1, 1), self.counts("mia shia wiru ma nila.")) + + def test_canon_settles_the_pronoun_before_nai(self): + self.assertEqual((1, 1), self.counts("mia lohau nai.")) + self.assertEqual(1, self.counts("mia lohau welao nai.")[0]) + + def test_manner_or_object_without_a_slot_one_stack(self): + result = self.counter.analyse("shia welao thumela.") + self.assertEqual((2, 3), (result.conservative, result.full)) + self.assertEqual(["[shia] ", "[shia] [welao]"], result.clauses[0].divisions) + self.assertEqual(["manner or object"], result.clauses[0].seams) + + def test_an_event_noun_with_a_possessor_is_a_full_count_reading(self): + self.assertEqual((1, 2), self.counts("mia nohero to helui.")) + + def test_a_bare_time_word_is_an_open_seam(self): + result = self.counter.analyse("mia nosa thole.") + self.assertEqual(2, result.conservative) + self.assertEqual(["time word"], result.clauses[0].seams) + + def test_a_prepositional_phrase_has_no_marked_end(self): + result = self.counter.analyse("mia mua womu shelu theo.") + self.assertEqual( + ["[mia] [mua womu] [shelu]", "[mia] [mua womu shelu]"], + result.clauses[0].divisions, + ) + + def test_dependent_material_may_end_in_more_than_one_place(self): + result = self.counter.analyse("lao pheralu ruela wirua nai.") + self.assertEqual(2, result.conservative) + self.assertEqual([("adverbial", 2)], [(j.kind, j.alternatives) for j in result.joins]) + result = self.counter.analyse("tei thia shua mia so hasi.") + self.assertEqual([("adverbial", 2)], [(j.kind, j.alternatives) for j in result.joins]) + + def test_quoted_sentences_count_as_sentences_of_their_own(self): + parts = self.counter.analyse_sentences( + "ne kulo sha lia. mia melu shelu so theo sho to haolu." + ) + self.assertEqual( + [("ne kulo sha... sho to haolu.", 1), ("lia.", 1), ("mia melu shelu so theo.", 3)], + [(part.text, part.conservative) for part in parts], + ) + + def test_opener_what_if_closes_the_seam_before_a_slot_two_word(self): + self.assertEqual((2, 2), self.counts("phao ha shelu theo.")) + strict = ReadingCounter(openers=frozenset({"ha", "ra", "lo"})) + self.assertEqual(1, strict.analyse("phao ha shelu theo.").conservative) + + def test_a_sentence_that_does_not_parse_has_no_count(self): + self.assertIsNone(self.counter.analyse("mia shua mia.")) + + def test_cli_shows_the_divisions(self): + completed = subprocess.run( + [ + sys.executable, + str(PROJECT_ROOT / "scripts" / "audit_phrase_readings.py"), + "--sentence", + "phao lopia shelu theo.", + ], + cwd=PROJECT_ROOT, + capture_output=True, + text=True, + check=False, + ) + self.assertEqual(0, completed.returncode, completed.stdout + completed.stderr) + self.assertIn("readings: 3 conservative, 3 full", completed.stdout) + self.assertIn("[phao lopia] [shelu]", completed.stdout) + + +if __name__ == "__main__": + unittest.main() From 66f01d087522bf0c2a613c26c53acecfeca345d1 Mon Sep 17 00:00:00 2001 From: Daniel Ellison Date: Tue, 24 Nov 2026 15:18:11 -0500 Subject: [PATCH 2/3] Count open roles and contested pronouns, and track the figures The reading count cannot see the two kinds of misreading verified in certified text: a lone bare phrase taken as object where subject was meant, and a `shia` given to the wrong referent. The maintainer asked for both to be measured and for the figures to be tracked. `phi_roles.py` counts clauses whose one bare phrase may be subject or object, and uses of `shia` while two or more third persons are live. The lexicon has no valency field, so a verb counts as taking an object when the corpus shows it in the passive, with two separate bare phrases, or in a command over a noun phrase. `documents/validation/phrase_readings_baseline.txt` now records all three measures with one row per file. CI checks it, and the working rules name the command that regenerates it. D133 records the first measurement. --- .github/workflows/validate.yml | 4 + CLAUDE.md | 1 + documents/README.md | 1 + .../validation/phrase_readings_baseline.txt | 277 ++++++++++++ documents/validation/sentence_validator.md | 27 +- project/development_log.md | 3 +- project/handoff/repository_workflow.md | 1 + scripts/README.md | 5 +- scripts/audit_phrase_readings.py | 404 +++++++++++++----- scripts/phi_readings.py | 65 ++- scripts/phi_roles.py | 162 +++++++ scripts/test_phi_roles.py | 125 ++++++ 12 files changed, 967 insertions(+), 108 deletions(-) create mode 100644 documents/validation/phrase_readings_baseline.txt create mode 100644 scripts/phi_roles.py create mode 100644 scripts/test_phi_roles.py diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 003f19b4..530a6063 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -26,6 +26,7 @@ jobs: python3 scripts/validate_sentences.py python3 scripts/test_sentence_validator.py python3 scripts/test_phi_readings.py + python3 scripts/test_phi_roles.py - name: Test vocabulary schema run: python3 scripts/test_vocabulary_schema.py @@ -57,6 +58,9 @@ jobs: - name: Check sentence-order ledger is in sync run: python3 scripts/audit_sentence_order.py --check + - name: Check phrase-reading ledger is in sync + run: python3 scripts/audit_phrase_readings.py --check + - name: Check generated reference is in sync with vocabulary run: | python3 scripts/generate_reference.py diff --git a/CLAUDE.md b/CLAUDE.md index 88b2b12d..fc5ed17f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -17,6 +17,7 @@ Authority order when documents disagree: `canon.md`. Settled decisions there are - After vocabulary changes, regenerate derived artifacts: `python3 scripts/generate_reference.py` and `python3 scripts/build_site.py`. - After any change that touches Phi examples or citations anywhere in the corpus, regenerate the neighbor baseline with `python3 scripts/audit_phonetic_neighbors.py --output documents/validation/phonetic_neighbors_baseline.txt` and commit the file when it changes. Continuous integration diffs this baseline, and its attestation counts move whenever cited examples change, even when no word form does. - The same changes can move the sentence-order ledger. Regenerate it with `python3 scripts/audit_sentence_order.py --output documents/validation/sentence_order_baseline.txt` and read every added line before committing: each is a sentence that parses but may have a manner word outside the Slot 1 block or an object before a prepositional phrase. Repair the ones that do; commit the ledger with the ones whose order is right. +- The same changes move the phrase-reading ledger, which records for each file how many sentences divide into phrases in more than one way, how many clauses leave a role open, and how often `shia` is contested. Regenerate it with `python3 scripts/audit_phrase_readings.py --output documents/validation/phrase_readings_baseline.txt` and commit it. The figures are measurements, not faults: a higher number in a row is something to notice, not something that blocks a commit. - No AI attribution anywhere: no "Generated with" footers in PRs, no Co-Authored-By trailers in commits. Contributors are not singled out. - Self-generated filenames are lowercase snake_case; `README.md`, `CLAUDE.md`, and license files are the only exceptions. - Markdown paragraphs are single lines — never hard-wrap prose; renderers break on it. diff --git a/documents/README.md b/documents/README.md index bc62b4ae..52a104ad 100644 --- a/documents/README.md +++ b/documents/README.md @@ -62,6 +62,7 @@ The [grammar index](grammar/) leads to the authoritative machinery references an | [Four-syllable migration ledger](validation/four_syllable_migration.tsv) | Verified record of the completed lexical replacements. | | [Retired forms](validation/retired_forms.txt) | Shorter forms barred from lexical reassignment without restricting productive names. | | [Sentence validator](validation/sentence_validator.md) | Executable full-utterance grammar, diagnostic contract, commands, and known limits. | +| [Phrase-reading ledger](validation/phrase_readings_baseline.txt) | For each file: sentences that divide into phrases in more than one way, clauses with an open role, and contested uses of `shia`. | | [Sentence-order ledger](validation/sentence_order_baseline.txt) | Every sentence that parses but may hold a manner word outside the Slot 1 block or an object before a prepositional phrase; CI compares it. | The [project index](../project/) holds the records that govern work around these materials. diff --git a/documents/validation/phrase_readings_baseline.txt b/documents/validation/phrase_readings_baseline.txt new file mode 100644 index 00000000..837b407d --- /dev/null +++ b/documents/validation/phrase_readings_baseline.txt @@ -0,0 +1,277 @@ +# Phrase-reading ledger +# +# Generated by scripts/audit_phrase_readings.py. Do not edit by hand. +# One row per file; every dictionary example is gathered under vocabulary/. +# The counts are upper bounds on what the grammar leaves open. They use no +# meanings and are not rates of misunderstanding. +# +# sentences sentences parsed (each quoted sentence counts as one) +# divided sentences with more than one division into phrases, counting +# only nouns, pronouns, and names as free phrase ends +# full the same, also letting an event or quality noun head a phrase +# roles clauses whose one bare phrase may be subject or object +# relroles relative clauses whose head may be subject or object +# shia uses of shia +# contested uses of shia while two or more third persons are live +# doubled clauses with two separate shia +# +# Columns: file, sentences, divided, full, roles, relroles, shia, contested, doubled. + +book/00_the_boatman.md 7 5 5 0 1 1 0 0 +book/02_what_a_refusal_is.md 4 2 2 1 0 1 1 0 +book/03_announce_then_deliver.md 2 2 2 0 0 0 0 0 +book/05_what_it_will_not_say.md 2 1 2 0 0 0 0 0 +book/07_a_literature_before_a_community.md 2 2 2 0 0 1 0 0 +book/09_a_serious_practice.md 8 3 3 0 0 0 0 0 +book/10_the_distance_of_a_learned_tongue.md 2 0 0 0 0 0 0 0 +book/11_the_lens_not_the_cage.md 2 1 1 0 0 1 0 0 +book/12_a_language_for_the_commons.md 2 1 1 0 1 0 0 0 +book/13_escaping_words.md 1 0 0 0 0 0 0 0 +book/14_the_mind_question.md 1 0 0 1 0 0 0 0 +book/15_the_door.md 1 0 0 0 0 0 0 0 +documents/evaluation/content_vocabulary_scenario_tests.md 60 29 47 1 0 10 7 0 +documents/evaluation/narrative_test_corpus.md 75 18 27 7 0 1 1 0 +documents/evaluation/peace_linguistics_vocabulary_audit.md 2 1 1 0 0 0 0 0 +documents/evaluation/philosophical_capability_matrix.md 19 8 16 1 0 0 0 0 +documents/evaluation/philosophical_test_corpus.md 279 125 207 20 0 6 0 0 +documents/grammar/complementizer_reference.md 21 1 4 1 0 7 0 0 +documents/grammar/numeral_reference.md 14 0 0 1 0 0 0 0 +documents/grammar/particle_reference.md 57 8 17 22 0 5 0 0 +documents/grammar/philosophical_conversation.md 14 2 2 6 0 0 0 0 +documents/modules/household_and_daily_life.md 5 2 3 0 0 0 0 0 +documents/modules/work_craft_and_repair.md 2 2 2 0 0 0 0 0 +documents/reference/language_guide.md 3 1 1 0 0 0 0 0 +documents/reference/taught_patterns.md 49 11 19 0 0 0 0 0 +kia.md 5 0 0 0 0 0 0 0 +manual/part1_first_light/ch02_first_words/02_your_first_sentence.md 6 1 1 0 0 0 0 0 +manual/part1_first_light/ch02_first_words/03_the_music_of_vowel_hiatus.md 3 3 3 0 0 0 0 0 +manual/part1_first_light/ch02_first_words/04_ten_essential_words.md 6 1 1 0 0 0 0 0 +manual/part1_first_light/ch02_first_words/05_a_simple_conversation.md 8 1 1 0 0 0 0 0 +manual/part2_soul/ch05_social_philosophy/02_conversation_as_collaboration.md 2 0 0 2 0 0 0 0 +manual/part4_grammar/ch09_particle_system/01_introduction.md 2 0 0 2 0 0 0 0 +manual/part4_grammar/ch09_particle_system/02_three_slots_explained.md 2 1 1 0 0 0 0 0 +manual/part4_grammar/ch09_particle_system/03_slot_0_framing.md 14 0 2 1 0 1 1 0 +manual/part4_grammar/ch09_particle_system/04_slot_1_verb_phrase.md 27 4 5 9 0 4 0 0 +manual/part4_grammar/ch09_particle_system/05_slot_2_word_level.md 17 3 10 1 0 3 2 0 +manual/part4_grammar/ch09_particle_system/06_combining_particles.md 17 6 6 8 0 0 0 0 +manual/part4_grammar/ch10_mindful_sentence/01_introduction.md 1 1 1 0 0 0 0 0 +manual/part4_grammar/ch10_mindful_sentence/02_sov_worldview.md 1 1 1 0 0 0 0 0 +manual/part4_grammar/ch10_mindful_sentence/04_building_sentences.md 4 3 3 0 0 0 0 0 +manual/part4_grammar/ch10_mindful_sentence/05_questions_requests_conditions.md 18 6 7 3 0 0 0 0 +manual/part4_grammar/ch10_mindful_sentence/06_exercises.md 34 24 25 5 0 0 0 0 +manual/part4_grammar/ch11_nouns/02_zero_article_system.md 2 2 2 0 0 0 0 0 +manual/part4_grammar/ch11_nouns/03_plural_marking.md 1 1 1 0 0 0 0 0 +manual/part4_grammar/ch11_nouns/06_expressing_possession.md 5 2 4 0 0 0 0 0 +manual/part4_grammar/ch11_nouns/07_the_words_of_color.md 5 3 5 0 0 0 0 0 +manual/part4_grammar/ch11_nouns/08_the_words_of_place.md 21 5 9 0 0 3 3 0 +manual/part4_grammar/ch11_nouns/09_the_words_of_the_body.md 12 6 6 0 0 1 0 0 +manual/part4_grammar/ch11_nouns/10_the_words_of_the_heart.md 6 2 2 0 0 1 0 0 +manual/part4_grammar/ch11_nouns/11_the_words_of_the_arts.md 8 6 6 0 0 1 0 0 +manual/part4_grammar/ch11_nouns/12_the_words_of_the_exchange.md 4 1 1 0 0 0 0 0 +manual/part4_grammar/ch13_pronouns/01_core_pronouns.md 15 4 6 0 0 3 0 0 +manual/part4_grammar/ch13_pronouns/02_forming_plurals.md 7 1 1 0 0 2 0 0 +manual/part4_grammar/ch13_pronouns/03_reflexive_miso.md 14 0 0 1 0 6 0 0 +manual/part4_grammar/ch13_pronouns/04_reciprocal_wiso.md 11 0 0 0 0 1 0 0 +manual/part4_grammar/ch13_pronouns/05_deixis.md 8 3 5 0 0 1 0 0 +manual/part4_grammar/ch14_verbs_time/01_introduction.md 2 0 0 2 0 0 0 0 +manual/part4_grammar/ch14_verbs_time/02_past_to.md 10 1 1 6 0 3 0 0 +manual/part4_grammar/ch14_verbs_time/03_future_so.md 6 2 2 3 0 0 0 0 +manual/part4_grammar/ch14_verbs_time/04_aspect.md 9 0 0 5 0 4 0 0 +manual/part4_grammar/ch14_verbs_time/05_combining_tense_aspect.md 5 1 1 3 0 0 0 0 +manual/part4_grammar/ch14_verbs_time/06_event_nouns.md 7 1 4 1 0 1 0 0 +manual/part4_grammar/ch14_verbs_time/07_the_words_of_time.md 21 8 8 1 0 1 1 0 +manual/part4_grammar/ch14_verbs_time/08_the_turning_of_a_life.md 11 3 4 0 0 2 1 0 +manual/part4_grammar/ch15_voice_possibility/01_the_passive_se.md 9 1 1 0 0 0 0 0 +manual/part4_grammar/ch15_voice_possibility/02_the_causative_ka.md 13 6 7 0 0 0 0 0 +manual/part4_grammar/ch15_voice_possibility/03_possibility_po.md 10 0 0 2 0 1 0 0 +manual/part4_grammar/ch15_voice_possibility/04_necessity_na.md 8 0 0 1 0 0 0 0 +manual/part4_grammar/ch15_voice_possibility/05_negation_ma.md 11 0 1 5 0 0 0 0 +manual/part4_grammar/ch16_evidentiality/01_introduction.md 3 0 0 0 0 0 0 0 +manual/part4_grammar/ch16_evidentiality/02_direct_hi.md 5 0 1 1 0 2 0 0 +manual/part4_grammar/ch16_evidentiality/03_inferential_ke.md 5 0 0 0 0 2 0 0 +manual/part4_grammar/ch16_evidentiality/04_reportative_ti.md 6 0 2 1 0 1 0 0 +manual/part4_grammar/ch16_evidentiality/05_assumptive_ho.md 8 0 0 0 0 3 0 0 +manual/part4_grammar/ch16_evidentiality/06_why_evidentiality_matters.md 4 1 1 0 0 3 0 0 +manual/part5_complex/ch17_coordination/01_simple_conjunction.md 6 1 3 2 0 0 0 0 +manual/part5_complex/ch17_coordination/02_contrast.md 7 1 3 4 0 2 1 0 +manual/part5_complex/ch17_coordination/03_alternative.md 6 1 2 3 0 0 0 0 +manual/part5_complex/ch17_coordination/04_addition_we.md 8 2 3 0 0 0 0 0 +manual/part5_complex/ch18_discourse/01_introduction.md 4 0 0 3 0 0 0 0 +manual/part5_complex/ch18_discourse/02_consequence_and_contrast.md 11 0 2 6 0 2 0 0 +manual/part5_complex/ch18_discourse/03_addition_and_example.md 11 7 11 0 0 3 0 0 +manual/part5_complex/ch18_discourse/04_precision.md 10 2 3 4 0 3 0 0 +manual/part5_complex/ch19_subordinate_clauses/01_introduction.md 2 1 1 0 0 2 0 0 +manual/part5_complex/ch19_subordinate_clauses/02_complement_clauses.md 10 0 1 1 0 7 0 0 +manual/part5_complex/ch19_subordinate_clauses/03_speech.md 10 1 1 0 0 2 1 0 +manual/part5_complex/ch19_subordinate_clauses/04_adverbial_clauses.md 20 5 7 7 0 3 1 0 +manual/part5_complex/ch20_relative_clauses/01_introduction.md 2 0 0 0 0 0 0 0 +manual/part5_complex/ch20_relative_clauses/02_relativizer_whu.md 4 2 2 0 1 0 0 0 +manual/part5_complex/ch20_relative_clauses/03_headed_relative_clauses.md 11 7 7 0 3 2 0 0 +manual/part5_complex/ch20_relative_clauses/04_headless_relative_clauses.md 6 1 1 0 1 0 0 0 +manual/part6_mastery/ch21_social_context/01_the_vocative_kona.md 6 0 0 0 0 0 0 0 +manual/part6_mastery/ch21_social_context/02_politeness_pi.md 2 0 0 1 0 0 0 0 +manual/part6_mastery/ch21_social_context/03_the_honorific_system.md 5 0 0 0 0 0 0 0 +manual/part6_mastery/ch21_social_context/04_register_and_formality.md 5 1 1 2 0 0 0 0 +manual/part6_mastery/ch21_social_context/05_when_to_use_what.md 8 0 0 2 0 0 0 0 +manual/part6_mastery/ch22_living_in_phi/01_daily_practice.md 4 2 2 0 0 0 0 0 +manual/part6_mastery/ch22_living_in_phi/02_journaling.md 3 2 2 0 0 0 0 0 +manual/part6_mastery/ch22_living_in_phi/03_meditation.md 5 1 2 0 0 0 0 0 +manual/part6_mastery/ch22_living_in_phi/05_the_ongoing_journey.md 5 2 2 0 0 0 0 0 +manual/part6_mastery/ch23_source_material/01_where_source_material_lives.md 1 0 1 0 0 0 0 0 +manual/part6_mastery/ch23_source_material/02_names_across_languages.md 1 1 1 0 0 0 0 0 +manual/part6_mastery/ch23_source_material/03_exact_records_and_technical_material.md 2 0 2 0 0 0 0 0 +manual/part6_mastery/ch23_source_material/04_translation_and_responsibility.md 2 0 1 0 0 1 0 0 +manual/part7_reference/modules/accessibility_and_participation.md 29 8 22 0 0 4 1 0 +manual/part7_reference/modules/commons_and_collective_governance.md 34 25 32 0 0 1 0 0 +manual/part7_reference/modules/ecological_systems_and_material_life.md 33 23 31 0 0 0 0 0 +manual/part7_reference/modules/household_and_daily_life.md 32 27 30 0 0 0 0 0 +manual/part7_reference/modules/medical_and_bodily_care.md 31 15 23 0 0 13 1 0 +manual/part7_reference/modules/philosophical_reasoning.md 29 11 22 1 0 6 2 0 +manual/part7_reference/modules/systems_and_shared_infrastructure.md 32 23 31 0 0 0 0 0 +manual/part7_reference/modules/work_craft_and_repair.md 35 24 28 0 0 8 0 0 +manual/part7_reference/sample_texts.md 23 4 6 1 0 0 0 0 +pamphlets/adverbial_clauses/01_the_frame_before_the_deed.md 1 0 0 0 0 0 0 0 +pamphlets/adverbial_clauses/02_sequence_pheo_phoe.md 5 0 0 3 0 1 0 0 +pamphlets/adverbial_clauses/03_simultaneity_whau.md 4 1 1 0 0 0 0 0 +pamphlets/adverbial_clauses/04_reason_lao.md 3 1 2 1 0 0 0 0 +pamphlets/adverbial_clauses/05_purpose_lila.md 3 0 1 3 0 1 0 0 +pamphlets/adverbial_clauses/06_concession_shai.md 2 1 1 0 0 0 0 0 +pamphlets/adverbial_clauses/07_the_frame_and_the_main_clause.md 2 1 1 1 0 0 0 0 +pamphlets/coordination/01_equal_partners_nela.md 6 2 3 2 0 0 0 0 +pamphlets/coordination/02_the_contrast_thona.md 4 0 1 2 0 2 1 0 +pamphlets/coordination/03_the_fork_sola.md 5 1 1 3 0 0 0 0 +pamphlets/coordination/04_adding_alongside_we.md 8 0 1 0 0 2 2 0 +pamphlets/evidentiality/01_four_sources_one_stack.md 7 1 1 0 0 2 0 0 +pamphlets/evidentiality/02_witness_hi.md 7 6 6 0 0 0 0 0 +pamphlets/evidentiality/03_signs_ke.md 9 3 3 0 0 1 0 0 +pamphlets/evidentiality/04_word_ti.md 13 3 4 0 0 4 2 0 +pamphlets/evidentiality/05_expectation_ho.md 10 1 1 0 0 5 0 0 +pamphlets/evidentiality/06_choosing_and_combining.md 10 4 5 1 0 2 2 0 +pamphlets/evidentiality/07_a_journal_of_sources.md 7 2 2 0 0 0 0 0 +pamphlets/evidentiality/08_common_errors.md 10 2 2 0 0 2 0 0 +pamphlets/evidentiality/10_appendix.md 11 2 2 0 0 1 0 0 +pamphlets/naming/01_a_name_is_a_word.md 4 4 4 0 0 0 0 0 +pamphlets/naming/02_the_announcing_ne.md 10 6 8 0 0 2 0 0 +pamphlets/naming/03_calling_kona.md 8 0 0 0 0 0 0 0 +pamphlets/naming/04_the_three_honorifics.md 5 0 0 0 0 0 0 0 +pamphlets/naming/05_the_family_register.md 8 0 2 2 0 0 0 0 +pamphlets/naming/07_the_open_door.md 20 7 8 1 0 0 0 0 +pamphlets/naming/08_common_errors.md 6 0 0 0 0 0 0 0 +pamphlets/nouns_classifiers/01_the_bare_noun.md 1 1 1 0 0 0 0 0 +pamphlets/nouns_classifiers/02_marking_many_lo.md 1 1 1 0 0 0 0 0 +pamphlets/nouns_classifiers/05_describing_before_the_noun.md 1 1 1 0 0 0 0 0 +pamphlets/nouns_classifiers/07_having_and_holding.md 2 2 2 0 0 0 0 0 +pamphlets/pronouns_topic_drop/01_three_words_one_shape.md 4 0 0 0 0 2 0 0 +pamphlets/pronouns_topic_drop/02_case_from_position.md 5 1 2 0 0 0 0 0 +pamphlets/pronouns_topic_drop/03_building_we.md 5 1 1 0 0 2 0 0 +pamphlets/pronouns_topic_drop/04_back_to_yourself_miso.md 8 0 0 1 0 3 0 0 +pamphlets/pronouns_topic_drop/05_between_each_other_wiso.md 8 0 0 0 0 1 0 0 +pamphlets/pronouns_topic_drop/06_pointing_ha_ra.md 5 0 2 0 0 1 0 0 +pamphlets/pronouns_topic_drop/07_the_dropped_subject.md 8 2 2 0 0 0 0 0 +pamphlets/relative_clauses/03_headed_relatives_examples.md 10 5 5 0 3 2 0 0 +pamphlets/relative_clauses/04_headless_relatives.md 16 6 6 1 4 0 0 0 +pamphlets/relative_clauses/05_advanced_patterns.md 21 10 10 0 1 2 0 0 +pamphlets/relative_clauses/07_exercises.md 2 1 1 0 1 0 0 0 +pamphlets/source_material/02_names_and_adaptation.md 1 1 1 0 0 0 0 0 +pamphlets/source_material/03_preserving_records.md 2 0 2 0 0 0 0 0 +pamphlets/source_material/04_reference_without_an_atom.md 2 2 2 0 0 0 0 0 +pamphlets/source_material/05_translation_and_commitment.md 1 0 1 0 0 0 0 0 +pamphlets/source_material/06_voice_page_and_modes.md 1 0 1 0 0 0 0 0 +pamphlets/source_material/08_answers.md 2 1 2 0 0 0 0 0 +pamphlets/spoken_punctuation/01_one_silent_mark.md 2 0 0 0 0 0 0 0 +pamphlets/spoken_punctuation/02_the_question_mark_wa.md 8 2 3 1 0 0 0 0 +pamphlets/spoken_punctuation/03_the_quotation_marks.md 10 3 3 0 0 1 0 0 +pamphlets/spoken_punctuation/04_comma_of_address_capital.md 6 1 1 1 0 0 0 0 +pamphlets/spoken_punctuation/05_the_clause_commas.md 6 2 3 3 0 1 0 0 +pamphlets/spoken_punctuation/06_the_exclamation_worded.md 4 0 1 0 0 0 0 0 +pamphlets/spoken_punctuation/07_twenty_complete_utterances.md 15 1 1 1 0 0 0 0 +pamphlets/spoken_punctuation/08_the_marks_with_no_counterpart.md 8 3 4 2 0 2 0 0 +pamphlets/spoken_punctuation/09_the_dictation_test.md 9 0 0 1 0 0 0 0 +pamphlets/tengwar_mode/01_two_hands_for_one_language.md 1 1 1 0 0 0 0 0 +pamphlets/tengwar_mode/03_the_vowel_marks_above_and_below.md 1 1 1 0 0 0 0 0 +pamphlets/tengwar_mode/04_one_tengwa_two_vowels.md 2 1 1 0 0 0 0 0 +pamphlets/tengwar_mode/05_romen_and_ore_the_two_rs.md 2 2 2 0 0 0 0 0 +pamphlets/tengwar_mode/06_the_silent_marks.md 1 0 1 0 0 0 0 0 +pamphlets/tengwar_mode/07_a_line_written_by_hand.md 3 1 1 0 0 0 0 0 +pamphlets/tengwar_mode/08_common_errors.md 5 3 4 0 0 0 0 0 +pamphlets/tengwar_mode/11_examples.md 23 5 7 0 0 4 2 0 +pamphlets/tense_aspect/01_the_verb_at_rest.md 3 0 0 3 0 0 0 0 +pamphlets/tense_aspect/02_looking_back_to.md 4 0 0 2 0 1 0 0 +pamphlets/tense_aspect/03_looking_forward_so.md 4 1 1 2 0 0 0 0 +pamphlets/tense_aspect/04_within_and_whole_si_ki.md 6 2 2 2 0 1 0 0 +pamphlets/tense_aspect/05_the_edges_pa_te.md 4 0 0 0 0 1 1 0 +pamphlets/tense_aspect/06_the_pattern_ro.md 5 0 0 0 0 0 0 0 +pamphlets/tense_aspect/07_the_ten_combinations.md 6 2 2 0 0 2 1 0 +pamphlets/tense_aspect/08_the_day_around_the_verb.md 7 3 3 1 0 0 0 0 +pamphlets/ternary_numerals/01_counting_in_threes.md 5 1 1 0 0 0 0 0 +pamphlets/ternary_numerals/03_the_four_natures.md 6 0 0 0 0 0 0 0 +pamphlets/ternary_numerals/04_position_nu.md 2 0 0 0 0 0 0 0 +pamphlets/ternary_numerals/05_the_honest_about.md 4 0 0 0 0 0 0 0 +pamphlets/ternary_numerals/06_calculating_aloud.md 16 0 0 1 0 0 0 0 +pamphlets/ternary_numerals/07_market_day.md 24 9 9 0 0 0 0 0 +pamphlets/ternary_numerals/08_common_errors.md 6 0 0 0 0 0 0 0 +pamphlets/three_slots/01_one_machine_three_scopes.md 1 1 1 0 0 0 0 0 +pamphlets/three_slots/02_slot_0_framing.md 7 0 0 1 0 1 0 0 +pamphlets/three_slots/03_slot_1_tense_aspect.md 7 0 0 4 0 1 0 0 +pamphlets/three_slots/04_slot_1_voice.md 7 4 4 0 0 0 0 0 +pamphlets/three_slots/05_slot_1_evidence_modality.md 6 0 1 2 0 0 0 0 +pamphlets/three_slots/07_slot_2_nesting_phrase.md 4 1 2 1 0 1 0 0 +pamphlets/three_slots/09_one_sentence_grown.md 8 5 5 0 0 0 0 0 +primer/01_the_household.md 24 9 17 0 0 0 0 0 +primer/02_the_day_begins.md 18 9 9 0 0 0 0 0 +primer/03_big_and_small.md 17 5 13 0 0 0 0 0 +primer/04_at_the_door.md 20 1 5 0 0 0 0 0 +primer/05_whose_and_where.md 21 2 7 0 0 0 0 0 +primer/06_around_the_village.md 24 6 6 0 0 0 0 0 +primer/07_yesterday.md 23 4 6 0 0 0 0 0 +primer/08_tomorrow.md 25 9 10 0 0 0 0 0 +primer/09_meanwhile.md 18 2 2 3 0 0 0 0 +primer/10_finished_work.md 20 8 8 0 0 0 0 0 +primer/11_every_morning.md 18 3 5 0 0 0 0 0 +primer/12_the_year_turns.md 28 1 4 0 0 0 0 0 +primer/13_what_is_not.md 17 2 4 1 0 0 0 0 +primer/14_the_rules_of_the_house.md 23 3 3 0 0 0 0 0 +primer/15_at_the_market.md 25 5 5 1 0 1 1 0 +primer/16_visitors.md 25 2 3 0 0 1 0 0 +primer/17_the_gift.md 27 6 11 4 0 0 0 0 +primer/18_together.md 16 5 6 0 0 0 0 0 +primer/19_the_message.md 17 4 6 1 0 0 0 0 +primer/20_the_question.md 14 4 4 0 0 0 0 0 +primer/21_the_elders_story.md 21 7 8 0 0 0 0 0 +primer/22_the_one_who.md 16 1 1 0 0 0 0 0 +primer/23_weather_plans.md 17 2 2 0 0 0 0 0 +primer/24_the_news.md 24 10 10 3 0 0 0 0 +primer/25_the_work_gets_done.md 13 2 3 0 0 0 0 0 +primer/26_making_it_happen.md 13 7 8 0 0 0 0 0 +primer/27_the_wish.md 13 5 5 0 0 0 0 0 +primer/28_how_warm_is_the_soup.md 13 0 13 0 0 0 0 0 +primer/29_more_and_most.md 11 2 11 0 0 1 1 0 +primer/30_this_one_only_this_one.md 11 2 2 0 0 0 0 0 +short_road.md 16 6 6 0 0 0 0 0 +texts/a_second_way_for_water.md 198 93 143 8 0 44 35 0 +texts/babel_text.md 28 17 19 1 0 17 8 0 +texts/care_and_coercion.md 82 28 51 5 0 0 0 0 +texts/gibran/on_children.md 31 15 19 1 0 14 2 0 +texts/gibran/on_giving.md 50 24 36 8 0 1 0 0 +texts/gibran/on_love.md 50 21 33 8 0 17 7 1 +texts/gibran/on_work.md 24 8 18 8 0 1 0 0 +texts/heart_sutra.md 37 11 26 1 0 8 1 0 +texts/human_rights_article_one.md 4 3 3 0 0 5 3 1 +texts/little_prince_excerpts.md 7 4 5 1 0 0 0 0 +texts/metta_sutta.md 28 8 17 1 0 17 3 0 +texts/news_from_nowhere/chapter_01.md 109 54 77 2 2 82 20 1 +texts/news_from_nowhere/chapter_02.md 403 157 266 31 7 87 11 0 +texts/news_from_nowhere/chapter_03.md 462 186 298 40 5 119 21 2 +texts/news_from_nowhere/chapter_04.md 159 76 115 9 4 39 12 0 +texts/news_from_nowhere/chapter_05.md 308 134 210 32 4 119 30 4 +texts/news_from_nowhere/chapter_06.md 361 139 227 22 5 127 57 4 +texts/north_wind_and_sun.md 25 11 14 3 0 13 7 0 +texts/ring_verse_refusal.md 4 2 2 0 0 2 2 0 +texts/schleicher_fable.md 17 9 10 1 0 0 0 0 +texts/solarpunk_manifesto.md 110 71 88 2 7 41 13 0 +texts/tao_te_ching.md 52 13 39 1 0 17 9 0 +texts/the_mended_wall.md 57 25 45 2 0 1 1 0 +texts/the_report_at_dusk.md 56 30 47 2 0 2 2 0 +texts/the_worth_of_a_fallen_branch.md 56 26 42 0 0 1 1 0 +texts/velveteen_rabbit.md 530 223 323 25 4 376 158 25 +vocabulary/ 1464 613 944 44 2 0 0 0 diff --git a/documents/validation/sentence_validator.md b/documents/validation/sentence_validator.md index 52e615e9..952ad814 100644 --- a/documents/validation/sentence_validator.md +++ b/documents/validation/sentence_validator.md @@ -104,7 +104,7 @@ Two counts are reported. The conservative count lets a noun, pronoun, or name en What the figure is not: - It is an upper bound on structural choice. The counter has no verb valency and no meanings, so `mia nosa thole.` counts "my now practices" beside "I practice now". It does not estimate how often a reader goes wrong. -- It does not count bracketing inside a phrase, the role of a clause's only bare phrase (subject or object), or which referent a pronoun picks out. The last two are where the certified texts' recorded misreadings fall. +- It does not count bracketing inside a phrase, the role of a clause's only bare phrase (subject or object), or which referent a pronoun picks out. The last two are where the certified texts' recorded misreadings fall, and the next section counts them. - It follows the parser's choice for clause coordination, and a small share of sentences in the texts fall outside its clause model; the report lists them as not modelled. ```bash @@ -114,7 +114,30 @@ python3 scripts/audit_phrase_readings.py --paths texts/velveteen_rabbit.md python3 scripts/audit_phrase_readings.py --openers ha ra lo ``` -The last form is a what-if. Canon lets a possessor stand before a phrase that opens with `ha` or `lo` (`lo mia lo manuwe`). `--openers` counts the readings that would remain if the listed Slot 2 words always began a new phrase. No baseline is committed and CI runs only the counter's unit tests. +The last form is a what-if. Canon lets a possessor stand before a phrase that opens with `ha` or `lo` (`lo mia lo manuwe`). `--openers` counts the readings that would remain if the listed Slot 2 words always began a new phrase. + +## Open roles and third persons + +`scripts/phi_roles.py` counts the two things the reading count leaves out. + +An open role is a clause with one bare phrase and a verb that takes an object elsewhere. Phi marks no case and lets an established subject go unsaid, so the phrase is the subject, with nothing said about an object, or the object, with the subject unsaid. `lopia nuola.` is "the child eats" and "(it) eats the child". A relative clause has the same opening when one phrase is left inside it: in `whu mia nila miona`, the person is the one I see or the one who sees me. A passive, a command, or a second bare phrase settles the role. + +The lexicon records no valency, so the corpus supplies it. A verb counts as taking an object when it appears at least once in the passive, with two bare phrases that cannot be read as one (`mia thia nila.`), or in a command over a noun phrase (`no shelu theo.`), in a clause that has a single structural reading. A verb never witnessed that way is treated as taking no object, so the count leans low for rare verbs. + +A contested third person is a `shia`, or an unsaid subject, at a point where two or more third persons are live. A third person here is the head of a clause-initial bare phrase that is a noun or a name, and it stays live for three further sentences. The tracker knows nothing of animacy or plausibility. It also counts clauses with two separate `shia`, where the listener has to tell them apart inside one clause. + +Both counts are indicators of exposure. A first-person `mia nila.` is an open role by this definition and no reader stumbles on it, so the report also gives the open roles whose phrase is not `mia` or `thia`. + +## The phrase-reading ledger + +`documents/validation/phrase_readings_baseline.txt` holds one row per file: sentences, sentences with more than one division on each count, open roles, relative clauses with an open head, uses of `shia`, contested uses, and clauses with two `shia`. Every dictionary example is gathered into one `vocabulary/` row. CI regenerates the ledger and fails on any difference. + +```bash +python3 scripts/audit_phrase_readings.py --output documents/validation/phrase_readings_baseline.txt +python3 scripts/audit_phrase_readings.py --check +``` + +The figures are for watching a trend, text by text. A row usually changes only when its file does. The open-role columns can also move when another file adds the first witness that a verb takes an object. ## Limits diff --git a/project/development_log.md b/project/development_log.md index ca6d1fab..9846bea5 100644 --- a/project/development_log.md +++ b/project/development_log.md @@ -147,7 +147,8 @@ Implementation status, dependencies, optional evaluation work, and the next deve | D129 | Accepted | Certify chapter 1 of *News from Nowhere* under the isolated translation process. | Seventy-seven aligned Phi units reconstruct all 5,214 normalized Morris characters. The source-to-Phi pass read every unit against the source and repaired 30 under D126 and D128: adjuncts moved behind explicit subjects, dependent clauses given their own tense, past narration that had lost `to` restored, manner words brought inside the Slot 1 block, `miso` used as possessor and after a preposition, the old `sui` with an event noun replaced by `whau`, and a concessive `lu` recast with `shai`. Three fresh source-blind contexts derived the complete frozen stream, and a fourth checked the 26 units of the risk queue and deterministic sample. Its findings led to five further repairs: a passive for the rope-supported bridge whose relative clause read both ways, a `tha` frame that held two sentences, `li` on a quantity, a degree particle on a preposition, and a relative clause whose tense said "had stood" for "was standing". A fifth and a sixth context derived and checked those. The Phi freezes at `b8e2ae226d10405915618993bb9584d4e5974f537d88863ef5d9f12e8a9258ff`. The chapter no longer has a line in the sentence-order ledger. Left for the vocabulary work: `we` where Morris says "again", and `phirae` where he says "the rest". | | D130 | Accepted | Settle the small words and the clause relations, and license `tei` over a clause. | Seven maintainer rulings on 2026-11-24 answer section 4.7 and recommendation 16 of the November assessment. Each rests on a survey of every aligned text unit by its source line and on a source-blind reading test of thirty-eight invented sentences, two fresh readers per form; the sheet he ruled from is `archive/small_words_study.md`. Again receives a word (D131). Still is `tei nosa`, not yet is `tei nosa` with a negated verb, already is `phoe nosa` with `ki`, and no longer is `to te`, since readers took present `te` as a stopping in progress; `ra shemu` replaces `nosa` in a past account. Even is `we ko`, which the Slot 2 order already allowed and no text had used; bare `we` read as too every time. Instead is negation with `thona` or `whekai`, and except is `li` with the predicate turned. No relator is coined for when: `pheo` takes sequence, `whau` takes overlap and may now hold the briefer event, whenever is `lu` with `ro`, and `lu` never renders one past occasion, which both readers read as if. `tei` may stand over a clause, the one grammar extension: the clause comes first and carries its own tense, `tei` stays a preposition, and the relators stay six; the reason is the one that brought `whau`, and two of five source lines had dropped their until. At once, as soon as, soon, since, unless, even if, whether or not, only if, as if, so that, and the more the more are registered as the existing grammar says them. Canon gains four bullets, `documents/reference/small_words.md` is the registry, five fixed phrases enter the compound registry, thirteen entries, the grammar references, six manual pages, and five pages of the Adverbial Clauses pamphlet carry the rulings, and the pamphlet no longer teaches that `tei` takes no clause. The parser accepts a clause under sentence-initial `tei` and gains advisory `PHL005` for a `lu` condition whose two sentences are past with no `ro`. No text changes; `project/deferred_questions.md` lists the affected lines for one sweep after the language has settled. | | D131 | Accepted | Coin base `ture` for again. | The reading test in D130 tried four existing devices for again (`we` before the verb, `newu` as manner, an ordinal with `shemu`, and `phirae shemu`) and none was read as again above about seventy percent; in the one source-blind chapter all three `we` lines came back as also. `ture` is an adjective: directly before the verb, inside the Slot 1 block, it is again, and before a noun it is one more of the same kind, which leaves `phirae` to mean different. The maintainer chose the form from three cleared candidates. It has no neighbour at edit distance 1 and none in the phonetic audit, is no English word, and shares its opening with `turema` (return) as audible kinship without a productive affix. Two syllables rest on the protocol's daily-round test. The gloss is `again` although the class is adjective, because a gloss line reading `repeated` would suggest many repetitions; this is a judgement call open to correction. `CV-SMALL-01` records the decision, and `CV-SMALL-07` defers other and else to the ordinary-vocabulary step. | -| D132 | Accepted | Count the structural readings of Phi sentences. | Step 1 of the November assessment's answer to its central finding (section 4.3, recommendations 3 and 6): measure the unmarked phrase boundaries before deciding whether to mark them. `scripts/phi_readings.py` extends the sentence parser to count, for every clause, the ways the words before the verb divide into subject, adjuncts, object or complement, and manner, and the places each adverbial or relative clause could end; readings multiply across a sentence's clauses, and quoted sentences count separately. It reports a conservative count, in which only nouns, pronouns, and names end a phrase freely, and a full count that also lets an event or quality noun head a phrase with its own modifiers. `scripts/audit_phrase_readings.py` runs it over the lexicon's examples and the active Markdown and can show one sentence's divisions; `--openers` is a what-if that treats the listed Slot 2 words as always opening a phrase. The counter has no verb valency or meanings, so the figure is an upper bound on structural choice and not a comprehension rate, and it does not see the role of a single bare phrase or pronoun reference, which is where the two verified misreadings in certified text fall. First measurement on 2026-11-24: 42 percent of sentences in the translations have more than one division on the conservative count and 66 percent on the full count; the primer has 22 and 34 percent. Treating `ha`, `ra`, and `lo` as phrase openers lowers the translations' conservative figure to 35 percent. About one adverbial clause in five and one relative clause in five has more than one grammatical end. No baseline is committed and CI runs only the unit tests; whether to track the figure is the maintainer's decision. No language rule changes. | +| D132 | Accepted | Count the structural readings of Phi sentences. | Step 1 of the November assessment's answer to its central finding (section 4.3, recommendations 3 and 6): measure the unmarked phrase boundaries before deciding whether to mark them. `scripts/phi_readings.py` extends the sentence parser to count, for every clause, the ways the words before the verb divide into subject, adjuncts, object or complement, and manner, and the places each adverbial or relative clause could end; readings multiply across a sentence's clauses, and quoted sentences count separately. It reports a conservative count, in which only nouns, pronouns, and names end a phrase freely, and a full count that also lets an event or quality noun head a phrase with its own modifiers. `scripts/audit_phrase_readings.py` runs it over the lexicon's examples and the active Markdown and can show one sentence's divisions; `--openers` is a what-if that treats the listed Slot 2 words as always opening a phrase. The counter has no verb valency or meanings, so the figure is an upper bound on structural choice and not a comprehension rate, and it does not see the role of a single bare phrase or pronoun reference, which is where the two verified misreadings in certified text fall. First measurement on 2026-11-24: 42 percent of sentences in the translations have more than one division on the conservative count and 66 percent on the full count; the primer has 22 and 34 percent. Treating `ha`, `ra`, and `lo` as phrase openers lowers the translations' conservative figure to 35 percent. About one adverbial clause in five and one relative clause in five has more than one grammatical end. No language rule changes. | +| D133 | Accepted | Count open roles and contested third persons, and track all three figures. | Two maintainer rulings on 2026-11-24 after the first reading count: measure roles and reference next, and track the figure. The reading count does not see the two kinds of misreading verified in certified text, a single bare phrase taken as object where subject was meant and a `shia` assigned to the wrong referent. `scripts/phi_roles.py` counts both exposures. An open role is a clause, or a relative clause, with one bare phrase and a verb that takes an object elsewhere; the lexicon has no valency field, so a verb counts as taking an object when the corpus shows it in the passive, with two bare phrases that cannot be read as one, or in a command over a noun phrase, in a clause with a single structural reading (154 verbs on first measurement). A contested third person is a `shia` or an unsaid subject while two or more third persons are live, a third person being the noun or name heading a clause-initial bare phrase within the last three sentences; clauses with two separate `shia` are counted too. First measurement: in the translations 5 percent of clauses have an open role (197, of which 124 are not `mia` or `thia`), a third of the 1,102 uses of `shia` are contested, and 38 clauses hold two `shia`, 25 of them in *The Velveteen Rabbit*; both verified misreadings fall in clauses the counts flag. `documents/validation/phrase_readings_baseline.txt` records one row per file for all three measures, CI checks it, and the working rules name the regeneration command. The figures use no meanings and are upper bounds on exposure; a corpus-derived valency is a stopgap for the valency field the assessment recommends. No language rule changes. | ## Completed discretionary lexical migrations diff --git a/project/handoff/repository_workflow.md b/project/handoff/repository_workflow.md index f71c918e..b8137a86 100644 --- a/project/handoff/repository_workflow.md +++ b/project/handoff/repository_workflow.md @@ -103,6 +103,7 @@ python3 scripts/validate_sentences.py --paths texts/example.md python3 scripts/validate_sentences.py --docs python3 scripts/validate_sentences.py --paths texts/example.md --lint python3 scripts/audit_sentence_order.py --output documents/validation/sentence_order_baseline.txt +python3 scripts/audit_phrase_readings.py --output documents/validation/phrase_readings_baseline.txt ``` The full active Markdown scan remains a migration command because the evaluation corpus predates the parser. As of D113, `--docs` parses 5,532 complete examples and reports two diagnostics in `documents/evaluation/narrative_test_corpus.md`: PHS103 at line 46 and PHS115 at line 212. Triage each as parser or corpus before editing it. The parser's boundary and diagnostic contract are in `documents/validation/sentence_validator.md`. diff --git a/scripts/README.md b/scripts/README.md index 8bc0da29..8f7dae4f 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -121,13 +121,16 @@ python3 scripts/audit_phonetic_neighbors.py --kind function --prompts 40 --seed ## audit_phrase_readings.py -Counts the structural readings of every sentence in the lexicon and the active Markdown, using `phi_readings.py`: the ways each clause divides into subject, adjuncts, object, and manner, and the places each dependent clause could end. It prints a table by corpus, the kinds of open seam, a table by text, and the sentences with the most readings. The counter has no verb valency, so the figures are an upper bound on structural choice. `documents/validation/sentence_validator.md` describes the model and its limits. +Measures where sentences leave structure to the listener, over the lexicon's examples and the active Markdown. `phi_readings.py` counts the ways each clause divides into subject, adjuncts, object, and manner, and the places each dependent clause could end. `phi_roles.py` counts clauses whose one bare phrase may be subject or object, and uses of `shia` while two or more third persons are live. The report gives tables by corpus and by text; the committed ledger, which CI checks, gives one row per file. None of the counts uses meanings, so each is an upper bound. `documents/validation/sentence_validator.md` describes the models and their limits. ```bash python3 scripts/audit_phrase_readings.py python3 scripts/audit_phrase_readings.py --sentence "phao lopia shelu theo." python3 scripts/audit_phrase_readings.py --openers ha ra lo +python3 scripts/audit_phrase_readings.py --output documents/validation/phrase_readings_baseline.txt +python3 scripts/audit_phrase_readings.py --check python3 scripts/test_phi_readings.py +python3 scripts/test_phi_roles.py ``` ## audit_sentence_order.py diff --git a/scripts/audit_phrase_readings.py b/scripts/audit_phrase_readings.py index 7342ed3f..8b0ca679 100644 --- a/scripts/audit_phrase_readings.py +++ b/scripts/audit_phrase_readings.py @@ -1,41 +1,99 @@ #!/usr/bin/env python3 -"""Report how many structural readings Phi's sentences admit. +"""Report where Phi's sentences leave structure to the listener. Every sentence in the lexicon's examples and the active Markdown is parsed -and its readings counted by ``phi_readings``. A reading is one way of -dividing a clause into subject, adjuncts, object, and manner, together with -one choice of where each dependent clause ends. The counter has no verb -valency and no meanings, so the figures are an upper bound on structural -choice and say nothing about how often a reader goes wrong. - -Two counts are given. The conservative count lets only nouns, pronouns, and -names end a phrase freely. The full count also lets an adjective (quality -noun) or a verb (event noun) head a phrase with modifiers of its own. +and measured three ways. + +* **Readings** (``phi_readings``): the ways each clause divides into subject, + adjuncts, object, and manner, and the places each dependent clause could + end. The conservative count lets only nouns, pronouns, and names end a + phrase freely; the full count also lets an event or quality noun head a + phrase with modifiers of its own. +* **Open roles** (``phi_roles``): clauses whose one bare phrase may be + subject or object, because the verb takes an object elsewhere. +* **Third persons** (``phi_roles``): uses of ``shia``, and unsaid subjects, + while two or more third persons are live in the text. + +None of the counts uses meanings, so each is an upper bound on what the +grammar leaves open. None is a rate of misunderstanding. + +The committed ledger records one row per file. Continuous integration +regenerates it and fails on any difference, so a change in a text shows up +as a changed row. """ from __future__ import annotations import argparse from collections import Counter, defaultdict +from dataclasses import dataclass, field import json from pathlib import Path import sys -from phi_readings import ReadingCounter +from phi_readings import ReadingCounter, SentenceReadings +from phi_roles import ( + ReferenceCounts, + ReferenceTracker, + object_taking_verbs, + open_role, + settled, +) from phi_sentence_validator import Lexicon, PROJECT_ROOT import validate_sentences -GROUPS = ( - ("Translations", "texts/"), - ("Original compositions", "texts/"), - ("Manual", "manual/"), - ("Pamphlets", "pamphlets/"), - ("Primer", "primer/"), - ("Book", "book/"), - ("Dictionary examples", "vocabulary/"), - ("Other documents", ""), +LEDGER = PROJECT_ROOT / "documents" / "validation" / "phrase_readings_baseline.txt" + +GROUP_ORDER = ( + "Translations", + "Original compositions", + "Manual", + "Pamphlets", + "Primer", + "Book", + "Dictionary examples", + "Other documents", +) +PREFIX_GROUPS = ( + ("manual/", "Manual"), + ("pamphlets/", "Pamphlets"), + ("primer/", "Primer"), + ("book/", "Book"), + ("vocabulary/", "Dictionary examples"), ) +LEDGER_HEADER = """\ +# Phrase-reading ledger +# +# Generated by scripts/audit_phrase_readings.py. Do not edit by hand. +# One row per file; every dictionary example is gathered under vocabulary/. +# The counts are upper bounds on what the grammar leaves open. They use no +# meanings and are not rates of misunderstanding. +# +# sentences sentences parsed (each quoted sentence counts as one) +# divided sentences with more than one division into phrases, counting +# only nouns, pronouns, and names as free phrase ends +# full the same, also letting an event or quality noun head a phrase +# roles clauses whose one bare phrase may be subject or object +# relroles relative clauses whose head may be subject or object +# shia uses of shia +# contested uses of shia while two or more third persons are live +# doubled clauses with two separate shia +# +# Columns: file, sentences, divided, full, roles, relroles, shia, contested, doubled. +""" + + +@dataclass +class Row: + path: str + sentence: SentenceReadings + roles: list[str] = field(default_factory=list) + role_verbs: list[str] = field(default_factory=list) + # Open roles whose phrase is not headed by mia or thia. + third_person_roles: int = 0 + reference: ReferenceCounts = field(default_factory=ReferenceCounts) + def original_works() -> frozenset[str]: catalogue = json.loads((PROJECT_ROOT / "texts" / "catalogue.json").read_text(encoding="utf-8")) @@ -49,25 +107,24 @@ def original_works() -> frozenset[str]: def group_of(path: str, originals: frozenset[str]) -> str: if path.startswith("texts/"): return "Original compositions" if path in originals else "Translations" - for name, prefix in GROUPS[2:-1]: + for prefix, name in PREFIX_GROUPS: if path.startswith(prefix): return name return "Other documents" -def collect(paths: list[str] | None, openers: frozenset[str] = frozenset()): +def collect(openers: frozenset[str] = frozenset()) -> tuple[list[Row], Counter[str]]: + """Measure the whole corpus, in document order.""" lexicon = Lexicon.load() counter = ReadingCounter(lexicon, openers=openers) - sources = [] - if not paths: - sources.extend(validate_sentences.iter_lexicon_examples(PROJECT_ROOT)) + sources = list(validate_sentences.iter_lexicon_examples(PROJECT_ROOT)) sources.extend( validate_sentences.iter_markdown_examples( - PROJECT_ROOT, lexicon, paths or validate_sentences.ACTIVE_DOC_ROOTS + PROJECT_ROOT, lexicon, validate_sentences.ACTIVE_DOC_ROOTS ) ) seen = set() - rows = [] + rows: list[Row] = [] for source in sources: path = source.label.split(":", 1)[0] parts = counter.analyse_sentences(source.text, allow_fragments=source.allow_fragments) @@ -78,39 +135,90 @@ def collect(paths: list[str] | None, openers: frozenset[str] = frozenset()): if key in seen: continue seen.add(key) - rows.append((path, part)) - return rows + rows.append(Row(path, part)) + + verbs = object_taking_verbs(row.sentence for row in rows) + tracker = ReferenceTracker() + current = None + for row in rows: + # Where a dependent clause has several possible ends, the clauses of + # every alternative are on record, so roles are counted only where + # the clause structure is settled. + if settled(row.sentence): + for clause in row.sentence.clauses: + kind = open_role(clause, verbs) + if kind: + row.roles.append(kind) + row.role_verbs.append(clause.verb) + if kind == "main" and clause.bare_heads[0][1] not in {"mia", "thia"}: + row.third_person_roles += 1 + if row.path.startswith("vocabulary/"): + continue + if row.path != current: + tracker.reset() + current = row.path + row.reference = tracker.observe(row.sentence) + return rows, verbs def percent(part: int, whole: int) -> str: return f"{100 * part / whole:.0f}%" if whole else "-" -def render(rows, top: int) -> str: +def ledger_key(path: str) -> str: + return "vocabulary/" if path.startswith("vocabulary/") else path + + +def render_ledger(rows: list[Row]) -> str: + by_file: dict[str, list[Row]] = defaultdict(list) + for row in rows: + by_file[ledger_key(row.path)].append(row) + lines = [LEDGER_HEADER] + for path in sorted(by_file): + group = by_file[path] + lines.append( + "\t".join( + str(value) + for value in ( + path, + len(group), + sum(1 for r in group if r.sentence.conservative > 1), + sum(1 for r in group if r.sentence.full > 1), + sum(r.roles.count("main") for r in group), + sum(r.roles.count("relative") for r in group), + sum(r.reference.third_person_pronouns for r in group), + sum(r.reference.contested_pronouns for r in group), + sum(r.reference.doubled_clauses for r in group), + ) + ) + ) + return "\n".join(lines) + "\n" + + +def render_report(rows: list[Row], verbs: Counter[str], top: int) -> str: originals = original_works() - by_group = defaultdict(list) - by_file = defaultdict(list) - for path, part in rows: - by_group[group_of(path, originals)].append(part) - by_file[path].append(part) + by_group: dict[str, list[Row]] = defaultdict(list) + by_file: dict[str, list[Row]] = defaultdict(list) + for row in rows: + by_group[group_of(row.path, originals)].append(row) + by_file[row.path].append(row) - lines = ["# Phrase-reading audit", ""] + lines = ["# Phrase-reading audit", "", "## Readings", ""] lines += [ "| Corpus | Sentences | More than one reading | Four or more | " "More than one, full count | Outside canonical order | Not modelled |", "|---|---:|---:|---:|---:|---:|---:|", ] - order = [name for name, _ in GROUPS] - for name in order: - parts = by_group.get(name) - if not parts: + for name in GROUP_ORDER: + group = by_group.get(name) + if not group: continue - total = len(parts) - many = sum(1 for p in parts if p.conservative > 1) - four = sum(1 for p in parts if p.conservative >= 4) - wide = sum(1 for p in parts if p.full > 1) - relaxed = sum(1 for p in parts if any(c.relaxed for c in p.clauses)) - missed = sum(1 for p in parts if p.unmodelled) + total = len(group) + many = sum(1 for r in group if r.sentence.conservative > 1) + four = sum(1 for r in group if r.sentence.conservative >= 4) + wide = sum(1 for r in group if r.sentence.full > 1) + relaxed = sum(1 for r in group if any(c.relaxed for c in r.sentence.clauses)) + missed = sum(1 for r in group if r.sentence.unmodelled) lines.append( f"| {name} | {total} | {many} ({percent(many, total)}) | " f"{four} ({percent(four, total)}) | {wide} ({percent(wide, total)}) | " @@ -118,56 +226,156 @@ def render(rows, top: int) -> str: ) seam_counts: Counter[str] = Counter() - ambiguous_clauses = 0 - join_counts: Counter[str] = Counter() + divided_clauses = 0 + join_open: Counter[str] = Counter() join_total: Counter[str] = Counter() - for _, part in rows: - for clause in part.clauses: + for row in rows: + for clause in row.sentence.clauses: if clause.conservative > 1 and clause.seams: - ambiguous_clauses += 1 + divided_clauses += 1 seam_counts.update(clause.seams) - for join in part.joins: + for join in row.sentence.joins: join_total[join.kind] += 1 if join.alternatives > 1: - join_counts[join.kind] += 1 - - lines += ["", "## Where the open seams are", ""] - lines.append( - f"Clauses with more than one division, conservative count: {ambiguous_clauses}. " - "A clause may show several kinds." - ) - lines += ["", "| Kind of seam | Clauses |", "|---|---:|"] + join_open[join.kind] += 1 + lines += [ + "", + f"Clauses with more than one division, conservative count: {divided_clauses}. " + "A clause may show several kinds of seam.", + "", + "| Kind of seam | Clauses |", + "|---|---:|", + ] for kind, count in seam_counts.most_common(): lines.append(f"| {kind} | {count} |") lines += ["", "| Dependent clause | With more than one possible end | Of |", "|---|---:|---:|"] for kind in ("adverbial", "relative"): - lines.append(f"| {kind} | {join_counts[kind]} | {join_total[kind]} |") + lines.append(f"| {kind} | {join_open[kind]} | {join_total[kind]} |") + + lines += [ + "", + "## Open roles", + "", + f"Verbs the corpus shows with an object: {len(verbs)}.", + "", + "| Corpus | Clauses | One bare phrase, subject or object | " + "Of which not `mia` or `thia` | Relative clauses, head subject or object | " + "Sentences with either |", + "|---|---:|---:|---:|---:|---:|", + ] + role_verbs: Counter[str] = Counter() + for name in GROUP_ORDER: + group = by_group.get(name) + if not group: + continue + clauses = sum(len(r.sentence.clauses) for r in group) + main = sum(r.roles.count("main") for r in group) + relative = sum(r.roles.count("relative") for r in group) + either = sum(1 for r in group if r.roles) + third = sum(r.third_person_roles for r in group) + for r in group: + role_verbs.update(r.role_verbs) + lines.append( + f"| {name} | {clauses} | {main} ({percent(main, clauses)}) | {third} | {relative} | " + f"{either} ({percent(either, len(group))} of sentences) |" + ) + lines += [ + "", + "Verbs most often found with an open role: " + + ", ".join(f"`{verb}` ({count})" for verb, count in role_verbs.most_common(15)) + + ".", + ] - lines += ["", "## By text", "", "| File | Sentences | More than one reading | Full count |", "|---|---:|---:|---:|"] + lines += [ + "", + "## Third persons", + "", + "| Corpus | Uses of `shia` | While two or more third persons are live | " + "Clauses with two `shia` | Unsaid subjects | Unsaid while two or more are live |", + "|---|---:|---:|---:|---:|---:|", + ] + for name in GROUP_ORDER: + group = by_group.get(name) + if not group or name == "Dictionary examples": + continue + uses = sum(r.reference.third_person_pronouns for r in group) + contested = sum(r.reference.contested_pronouns for r in group) + doubled = sum(r.reference.doubled_clauses for r in group) + unsaid = sum(r.reference.unsaid_subjects for r in group) + unsaid_contested = sum(r.reference.contested_unsaid for r in group) + lines.append( + f"| {name} | {uses} | {contested} ({percent(contested, uses)}) | {doubled} | " + f"{unsaid} | {unsaid_contested} ({percent(unsaid_contested, unsaid)}) |" + ) + + lines += [ + "", + "## By text", + "", + "| File | Sentences | More than one reading | Full count | Open roles | " + "`shia` | Contested | Two `shia` in a clause |", + "|---|---:|---:|---:|---:|---:|---:|---:|", + ] for path in sorted(by_file): if not path.startswith("texts/"): continue - parts = by_file[path] - total = len(parts) - many = sum(1 for p in parts if p.conservative > 1) - wide = sum(1 for p in parts if p.full > 1) + group = by_file[path] + total = len(group) + many = sum(1 for r in group if r.sentence.conservative > 1) + wide = sum(1 for r in group if r.sentence.full > 1) + roles = sum(len(r.roles) for r in group) + uses = sum(r.reference.third_person_pronouns for r in group) + contested = sum(r.reference.contested_pronouns for r in group) + doubled = sum(r.reference.doubled_clauses for r in group) lines.append( f"| `{path}` | {total} | {many} ({percent(many, total)}) | " - f"{wide} ({percent(wide, total)}) |" + f"{wide} ({percent(wide, total)}) | {roles} | {uses} | " + f"{contested} ({percent(contested, uses)}) | {doubled} |" ) lines += ["", f"## The {top} sentences with the most readings", ""] - ranked = sorted(rows, key=lambda row: (-row[1].conservative, row[0], row[1].text))[:top] - for path, part in ranked: - lines.append(f"- {part.conservative} readings, `{path}`: `{part.text}`") + ranked = sorted(rows, key=lambda r: (-r.sentence.conservative, r.path, r.sentence.text)) + for row in ranked[:top]: + lines.append( + f"- {row.sentence.conservative} readings, `{row.path}`: `{row.sentence.text}`" + ) return "\n".join(lines) + "\n" +def show_sentence(text: str, openers: frozenset[str]) -> int: + counter = ReadingCounter(openers=openers) + parts = counter.analyse_sentences(text) + if parts is None: + print("The sentence does not parse.") + return 1 + for part in parts: + print(f"{part.text}") + print(f" readings: {part.conservative} conservative, {part.full} full") + for join in part.joins: + print( + f" {join.kind} clause opened by '{join.opener}': " + f"{join.alternatives} possible end(s)" + ) + for clause in part.clauses: + if clause.conservative < 2: + continue + print(f" clause: {clause.text}") + for division in clause.divisions: + print(f" {division}") + if clause.seams: + print(f" open seams: {', '.join(clause.seams)}") + return 0 + + def main() -> int: parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("--paths", nargs="+", help="active Markdown paths; default is everything") parser.add_argument("--sentence", help="count one literal Phi sentence and show its divisions") - parser.add_argument("--output", type=Path, help="write the report here") + parser.add_argument("--paths", nargs="+", help="limit the report to files under these paths") + parser.add_argument("--report", type=Path, help="write the Markdown report here") + parser.add_argument("--output", type=Path, help="write the per-file ledger here") + parser.add_argument( + "--check", action="store_true", help="fail when the committed ledger is stale" + ) parser.add_argument("--top", type=int, default=20, help="how many sentences to list") parser.add_argument( "--openers", @@ -176,37 +384,41 @@ def main() -> int: help="what-if: count as though these Slot 2 words always began a new phrase", ) args = parser.parse_args() + openers = frozenset(args.openers) if args.sentence is not None: - counter = ReadingCounter(openers=frozenset(args.openers)) - parts = counter.analyse_sentences(args.sentence) - if parts is None: - print("The sentence does not parse.") - return 1 - for part in parts: - print(f"{part.text}") - print(f" readings: {part.conservative} conservative, {part.full} full") - for join in part.joins: + return show_sentence(args.sentence, openers) + + rows, verbs = collect(openers) + if args.check or args.output: + if openers: + print("the ledger records the language as it is; drop --openers") + return 2 + ledger = render_ledger(rows) + if args.check: + current = LEDGER.read_text(encoding="utf-8") if LEDGER.is_file() else "" + if current != ledger: print( - f" {join.kind} clause opened by '{join.opener}': " - f"{join.alternatives} possible end(s)" + "phrase-reading ledger is stale; run " + "python3 scripts/audit_phrase_readings.py --output " + "documents/validation/phrase_readings_baseline.txt" ) - for clause in part.clauses: - if clause.conservative < 2: - continue - print(f" clause: {clause.text}") - for division in clause.divisions: - print(f" {division}") - if clause.seams: - print(f" open seams: {', '.join(clause.seams)}") + return 1 + print("phrase-reading ledger is current.") + return 0 + args.output.write_text(ledger, encoding="utf-8") + files = len(ledger.splitlines()) - len(LEDGER_HEADER.splitlines()) + print(f"wrote {args.output}: {files} file(s)") return 0 - text = render(collect(args.paths, frozenset(args.openers)), args.top) - if args.output: - args.output.write_text(text, encoding="utf-8") - print(f"wrote {args.output}") + if args.paths: + rows = [row for row in rows if any(row.path.startswith(path) for path in args.paths)] + report = render_report(rows, verbs, args.top) + if args.report: + args.report.write_text(report, encoding="utf-8") + print(f"wrote {args.report}") else: - sys.stdout.write(text) + sys.stdout.write(report) return 0 diff --git a/scripts/phi_readings.py b/scripts/phi_readings.py index b22575f8..cb38e956 100644 --- a/scripts/phi_readings.py +++ b/scripts/phi_readings.py @@ -104,6 +104,19 @@ class ClauseReadings: relaxed: bool divisions: list[str] = field(default_factory=list) seams: list[str] = field(default_factory=list) + # Facts the role and reference counts need. + verb: str = "" + slot0: tuple[str, ...] = () + slot1: tuple[str, ...] = () + gapped: bool = False + # How many bare phrases (subject, object, complement) each division has. + bare_counts: tuple[int, ...] = () + # The head of the first phrase when it is bare: (class, word). + first_bare: tuple[str, str] | None = None + # The head of every bare phrase in the first division. + bare_heads: tuple[tuple[str, str], ...] = () + # Third-person pronouns standing as separate words in the clause. + third_persons: int = 0 @dataclass @@ -278,8 +291,9 @@ def _core_parses(self, start: int, end: int, allow_gap: bool) -> bool: def _count_clause(self, start: int, end: int, *, allow_gap: bool) -> tuple[int, int]: checkpoint = len(self.diagnostics) - index, _ = self._parse_sentence_frame(start, end) + index, frame_nodes = self._parse_sentence_frame(start, end) del self.diagnostics[checkpoint:] + slot0 = tuple(node.value for node in frame_nodes if node.value) if index < end and self._word(index) in DISCOURSE_MARKERS: index += 1 if index >= end: @@ -301,7 +315,7 @@ def _count_clause(self, start: int, end: int, *, allow_gap: bool) -> tuple[int, counted = self._count_adverbial(index, end, allow_gap) if counted is not None: return counted - return self._count_core(index, end, allow_gap=allow_gap) + return self._count_core(index, end, allow_gap=allow_gap, slot0=slot0) def _count_adverbial( self, start: int, end: int, allow_gap: bool @@ -374,7 +388,13 @@ def _is_noun_phrase(self, start: int, end: int) -> bool: # ------------------------------------------------------------------ def _count_core( - self, start: int, end: int, *, allow_gap: bool, record: bool = True + self, + start: int, + end: int, + *, + allow_gap: bool, + record: bool = True, + slot0: tuple[str, ...] = (), ) -> tuple[int, int]: predicate_index = end - 1 if predicate_index < start: @@ -383,6 +403,11 @@ def _count_core( relaxed_used = False shown: list[str] = [] seams: set[str] = set() + bare_counts: set[int] = set() + first_bare: tuple[str, str] | None = None + bare_heads: tuple[tuple[str, str], ...] | None = None + slot1: tuple[str, ...] = () + third_persons = 0 mark = self._mark() for units, inner_c, inner_w in self._unit_sequences(start, predicate_index): if inner_w == 0: @@ -418,6 +443,22 @@ def _count_core( for division in cons: if len(shown) < MAX_SHOWN: shown.append(self._render(pre, division)) + slot1 = tuple(u.word for u in units if u.cls == "S1") + third_persons = max( + third_persons, + sum(1 for u in pre if u.cls == "PRON" and u.word == "shia"), + ) + for boundaries, _, types in cons or wide: + bare_counts.add(sum(1 for kind in types if kind == "BARE")) + if first_bare is None and types and types[0] == "BARE": + head = pre[boundaries[0] - 1] + first_bare = (head.cls, head.word) + if bare_heads is None: + bare_heads = tuple( + (pre[stop - 1].cls, pre[stop - 1].word) + for stop, kind in zip(boundaries, types) + if kind == "BARE" + ) if wide_total == 0: self._rollback(mark) return 0, 0 @@ -434,6 +475,14 @@ def _count_core( relaxed_used, shown if cons_total > 1 else [], sorted(seams), + verb=self._word(predicate_index), + slot0=slot0, + slot1=slot1, + gapped=allow_gap, + bare_counts=tuple(sorted(bare_counts)), + first_bare=first_bare, + bare_heads=bare_heads or (), + third_persons=third_persons, ) ) return cons_total, wide_total @@ -623,7 +672,7 @@ def _divisions( full: bool, relaxed: bool, ) -> list[tuple]: - """Every legal division, as (boundaries, manner_start) tuples.""" + """Every legal division, as (boundaries, manner_start, phrase_types).""" results: list[tuple] = [] # A manner tail is a run of adjectives, each with any degree # particles, standing directly before the verb. A degree particle @@ -641,7 +690,7 @@ def _divisions( body = pre[:tail] for boundaries, types in self._segmentations(body, allow_gap, full): if self._template_ok(body, types, has_ka, predicative, relaxed): - results.append((boundaries, tail)) + results.append((boundaries, tail, types)) return results def _segmentations( @@ -814,7 +863,7 @@ def _template_ok( def _render(self, pre: Sequence[Unit], division: tuple) -> str: if not division: return "" - boundaries, tail = division + boundaries, tail, _ = division parts = [] position = 0 for stop in boundaries: @@ -833,12 +882,12 @@ def _seam_types(self, pre: Sequence[Unit], divisions: Sequence[tuple]) -> set[st types: set[str] = set() edge_sets = [] manner_starts = set() - for boundaries, tail in divisions: + for boundaries, tail, _ in divisions: edges = set(boundaries) if tail < len(pre): manner_starts.add(tail) edge_sets.append(edges - {len(pre)}) - if len(manner_starts) > 0 and any(tail == len(pre) for _, tail in divisions): + if len(manner_starts) > 0 and any(tail == len(pre) for _, tail, _ in divisions): types.add("manner or object") every = set().union(*edge_sets) if edge_sets else set() for edge in sorted(every): diff --git a/scripts/phi_roles.py b/scripts/phi_roles.py new file mode 100644 index 00000000..9b764ef5 --- /dev/null +++ b/scripts/phi_roles.py @@ -0,0 +1,162 @@ +#!/usr/bin/env python3 +"""Count open roles and contested third persons in Phi text. + +``phi_readings`` counts how a clause divides into phrases. Two things it +cannot see are where readers of the certified texts actually went wrong: + +* **An open role.** A clause has one bare phrase and a verb that elsewhere + takes both a subject and an object. Phi lets an established subject go + unsaid and marks no case, so the phrase is the subject (with nothing said + about an object) or the object (with the subject unsaid). ``lopia nuola`` + is "the child eats" and "(it) eats the child". +* **A contested third person.** Phi has one third-person pronoun. When two + or more third persons are live in the story, ``shia`` and an unsaid + subject both leave the listener to choose. + +Neither count uses meanings. Whether a verb takes an object is read from +the corpus itself, so the figures are indicators of exposure, not rates of +misunderstanding. + +A verb counts as taking an object when the corpus shows it at least once + +* in the passive (``shelu se theo``), +* with two bare phrases that cannot be read as one, each headed by a noun, + pronoun, name, or complement frame (``mia thia nila``, + ``mia tha ... tho sano``), or +* in a command over a noun phrase that is not the person addressed + (``no shelu theo``). + +Only clauses with a single structural reading are taken as witnesses, so an +adjective standing as manner or complement is not mistaken for an object. +""" + +from __future__ import annotations + +from collections import Counter, deque +from dataclasses import dataclass, field +from typing import Iterable + +from phi_readings import ClauseReadings, SentenceReadings +from phi_sentence_validator import PREDICATIVE_VERBS + +ADDRESSEE = frozenset({"thia"}) +ARGUMENT_HEADS = frozenset({"N", "PRON", "NAME", "FRAME", "REL"}) +# How many earlier sentences a third person stays live for. +WINDOW = 3 + + +def settled(sentence: SentenceReadings) -> bool: + """Whether every dependent clause in the sentence has one possible end.""" + return all(join.alternatives == 1 for join in sentence.joins) + + +def object_taking_verbs(sentences: Iterable[SentenceReadings]) -> Counter[str]: + """Verbs the corpus shows with an object, with the number of witnesses.""" + seen: Counter[str] = Counter() + for sentence in sentences: + if not settled(sentence): + continue + for clause in sentence.clauses: + verb = clause.verb + if not verb or verb in PREDICATIVE_VERBS or "ka" in clause.slot1: + continue + if "se" in clause.slot1: + seen[verb] += 1 + continue + if clause.gapped or clause.full != 1: + continue + heads_ok = all(cls in ARGUMENT_HEADS for cls, _ in clause.bare_heads) + if clause.bare_counts == (2,) and heads_ok: + seen[verb] += 1 + elif ( + "no" in clause.slot0 + and clause.bare_counts == (1,) + and clause.bare_heads + and clause.bare_heads[0][0] in {"N", "NAME"} + ): + seen[verb] += 1 + return seen + + +def open_role(clause: ClauseReadings, object_verbs: Counter[str] | set[str]) -> str | None: + """Name the open role in a clause, if it has one. + + ``main`` is a clause whose one bare phrase may be subject or object. + ``relative`` is a relative clause whose head may be either, because the + one phrase left inside it may be the other. + """ + if clause.verb not in object_verbs or clause.verb in PREDICATIVE_VERBS: + return None + if "se" in clause.slot1 or "ka" in clause.slot1: + return None + if clause.bare_counts != (1,): + return None + if not clause.bare_heads or clause.bare_heads[0][0] not in ARGUMENT_HEADS: + return None + if clause.gapped: + return "relative" + if "no" in clause.slot0: + return None + return "main" + + +@dataclass +class ReferenceCounts: + """Third-person exposure in one sentence.""" + + third_person_pronouns: int = 0 + contested_pronouns: int = 0 + doubled_clauses: int = 0 + unsaid_subjects: int = 0 + contested_unsaid: int = 0 + live: tuple[str, ...] = () + + +@dataclass +class ReferenceTracker: + """Follow which third persons are live as a text goes by. + + A third person is the head of a clause-initial bare phrase that is a + noun or a name: the likeliest subjects. It stays live for ``window`` + further sentences. This is a heuristic. It knows nothing of animacy or + plausibility, and it treats a thing and a person alike, as ``shia`` does. + """ + + window: int = WINDOW + recent: deque = field(default_factory=deque) + + def reset(self) -> None: + self.recent.clear() + + def observe(self, sentence: SentenceReadings) -> ReferenceCounts: + own = [] + for clause in sentence.clauses: + if clause.gapped or clause.first_bare is None: + continue + cls, word = clause.first_bare + if cls in {"N", "NAME"}: + own.append(word) + live = set(own) + for earlier in self.recent: + live.update(earlier) + counts = ReferenceCounts(live=tuple(sorted(live))) + words = sentence.text.replace(".", " ").split() + counts.third_person_pronouns = words.count("shia") + if len(live) >= 2: + counts.contested_pronouns = counts.third_person_pronouns + for clause in sentence.clauses: + if clause.third_persons >= 2: + counts.doubled_clauses += 1 + if ( + not clause.gapped + and clause.bare_counts == (0,) + and "no" not in clause.slot0 + and clause.verb not in PREDICATIVE_VERBS + ): + counts.unsaid_subjects += 1 + if len(live) >= 2: + counts.contested_unsaid += 1 + self.recent.append(own) + while len(self.recent) > self.window: + self.recent.popleft() + return counts diff --git a/scripts/test_phi_roles.py b/scripts/test_phi_roles.py new file mode 100644 index 00000000..70263ac0 --- /dev/null +++ b/scripts/test_phi_roles.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 +"""Regression tests for the open-role and third-person counts.""" + +from pathlib import Path +import subprocess +import sys +import tempfile +import unittest + +from phi_readings import ReadingCounter +from phi_roles import ReferenceTracker, object_taking_verbs, open_role + + +PROJECT_ROOT = Path(__file__).resolve().parent.parent + + +class RoleTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.counter = ReadingCounter() + + def sentences(self, *texts): + parts = [] + for text in texts: + found = self.counter.analyse_sentences(text) + self.assertIsNotNone(found, text) + parts.extend(found) + return parts + + def test_three_kinds_of_witness_show_a_verb_takes_an_object(self): + verbs = object_taking_verbs( + self.sentences("mia thia nila.", "shelu se theo.", "no noru kolua.") + ) + self.assertEqual({"nila", "theo", "kolua"}, set(verbs)) + + def test_manner_and_single_phrases_are_not_witnesses(self): + verbs = object_taking_verbs( + self.sentences("melu to kamo.", "shia welao thumela.", "no thia shua.") + ) + self.assertEqual(set(), set(verbs)) + + def test_one_bare_phrase_before_an_object_taking_verb_is_an_open_role(self): + verbs = {"nila", "nuola"} + (clause,) = self.sentences("lopia nuola.")[0].clauses + self.assertEqual("main", open_role(clause, verbs)) + (clause,) = self.sentences("lo phirae tupiwa so ma nila.")[0].clauses + self.assertEqual("main", open_role(clause, verbs)) + + def test_roles_are_settled_by_two_phrases_passive_command_or_verb(self): + verbs = {"nila", "nuola", "theo"} + for text in ("mia thia nila.", "shelu se theo.", "no shelu theo.", "melu to kamo."): + with self.subTest(text=text): + (clause,) = self.sentences(text)[0].clauses + self.assertIsNone(open_role(clause, verbs)) + + def test_a_relative_clause_with_one_phrase_leaves_its_head_open(self): + verbs = {"nila"} + clauses = self.sentences("whu mia nila miona shua.")[0].clauses + kinds = [open_role(clause, verbs) for clause in clauses] + self.assertIn("relative", kinds) + + def test_third_persons_become_contested_when_two_are_live(self): + tracker = ReferenceTracker() + first, second, third = self.sentences( + "ne samira to shua.", "lopia to wile.", "shia to hola." + ) + self.assertEqual(0, tracker.observe(first).contested_pronouns) + self.assertEqual(0, tracker.observe(second).contested_pronouns) + counts = tracker.observe(third) + self.assertEqual(1, counts.third_person_pronouns) + self.assertEqual(1, counts.contested_pronouns) + self.assertEqual(("lopia", "samira"), counts.live) + + def test_one_live_third_person_is_not_contested(self): + tracker = ReferenceTracker() + first, second = self.sentences("lopia to wile.", "shia to hola.") + tracker.observe(first) + self.assertEqual(0, tracker.observe(second).contested_pronouns) + + def test_two_separate_shia_in_one_clause_are_counted(self): + tracker = ReferenceTracker() + (sentence,) = self.sentences("shia roa shia to pa rato.") + self.assertEqual(1, tracker.observe(sentence).doubled_clauses) + + def test_an_unsaid_subject_is_counted(self): + tracker = ReferenceTracker() + first, second, third = self.sentences( + "ne samira to shua.", "lopia to wile.", "mua womu to therilu." + ) + tracker.observe(first) + tracker.observe(second) + counts = tracker.observe(third) + self.assertEqual((1, 1), (counts.unsaid_subjects, counts.contested_unsaid)) + + def test_committed_ledger_is_current(self): + completed = subprocess.run( + [sys.executable, str(PROJECT_ROOT / "scripts" / "audit_phrase_readings.py"), "--check"], + cwd=PROJECT_ROOT, + capture_output=True, + text=True, + check=False, + ) + self.assertEqual(0, completed.returncode, completed.stdout + completed.stderr) + + def test_ledger_refuses_the_what_if(self): + with tempfile.TemporaryDirectory() as directory: + completed = subprocess.run( + [ + sys.executable, + str(PROJECT_ROOT / "scripts" / "audit_phrase_readings.py"), + "--openers", + "ha", + "--output", + str(Path(directory) / "ledger.txt"), + ], + cwd=PROJECT_ROOT, + capture_output=True, + text=True, + check=False, + ) + self.assertEqual(2, completed.returncode) + + +if __name__ == "__main__": + unittest.main() From b01b53ea172adeb0c945a3bc56415c78dd842b57 Mon Sep 17 00:00:00 2001 From: Daniel Ellison Date: Tue, 24 Nov 2026 15:42:52 -0500 Subject: [PATCH 3/3] Add ku, an optional particle that opens the object `phao lopia shelu theo` is the parent reading the child's book or the parent's child reading a book, and nothing in the grammar chose. Measured on the texts, 43 percent of sentences divide into phrases in more than one way, and four in five of those turn on where the object begins. Fresh readers split such sentences by plausibility and were about 63 percent sure of their own reading. The maintainer ruled for one optional Slot 2 particle. `ku` opens the direct object phrase and everything from it to the verb's particles is the object: `phao ku lopia shelu theo`, `phao lopia ku shelu theo`. Before a lone phrase it settles the role, and it works the same in a relative clause. It is never required. This is the first amendment to the closed particle inventory, which now holds thirty-nine. Canon, the entry, the particle reference and finder, and the manual carry the rule. The parser checks its place and its limits, and the reading and role counts treat a marked object as settled. No text changes. The primer and pamphlets wait for the teaching pass and are listed in the deferred ledger. D134 records the decision. --- archive/README.md | 1 + archive/seams_study.md | 199 ++++++++++++++++++ canon.md | 5 +- documents/README.md | 2 +- documents/grammar/particle_reference.md | 28 ++- documents/reference/language_guide.md | 2 +- documents/reference/particle_finder.md | 10 +- .../phonetic_neighbors_baseline.txt | 66 +++--- .../validation/phrase_readings_baseline.txt | 8 +- documents/validation/sentence_validator.md | 3 +- .../validation/vocabulary_prose_coverage.json | 18 +- manual/appendices/appendix_a_glossary.md | 1 + .../02_syllable_structure.md | 2 +- .../ch09_particle_system/01_introduction.md | 4 +- .../05_slot_2_word_level.md | 10 +- .../04_building_sentences.md | 14 ++ .../06_why_evidentiality_matters.md | 2 +- .../04_headless_relative_clauses.md | 2 +- .../part7_reference/lexicon/alphabetical.md | 3 +- manual/part7_reference/lexicon/by_pos.md | 3 +- project/content_vocabulary_coverage.md | 2 +- project/deferred_questions.md | 16 ++ project/development_log.md | 1 + project/handoff/README.md | 2 +- project/handoff/current_state.md | 8 +- scripts/phi_readings.py | 22 ++ scripts/phi_roles.py | 5 +- scripts/phi_sentence_validator.py | 99 ++++++++- scripts/test_phi_readings.py | 18 ++ scripts/test_phi_roles.py | 7 + scripts/test_sentence_validator.py | 31 +++ site/manual_editorial.json | 6 +- vocabulary/function/particle/obj.json | 39 ++++ 33 files changed, 565 insertions(+), 74 deletions(-) create mode 100644 archive/seams_study.md create mode 100644 vocabulary/function/particle/obj.json diff --git a/archive/README.md b/archive/README.md index 43286465..77e264ba 100644 --- a/archive/README.md +++ b/archive/README.md @@ -28,6 +28,7 @@ For the authority order of current documentation, see `/canon.md`. | `quality_noun_adjudication.md` | The word-by-word audit behind the quality-noun rule (adjective+noun dual listings pruned, 2026-07-06); the rule lives in `/canon.md` | | `adjective_verb_adjudication.md` | The word-by-word audit behind the qualities-do-not-act ruling (adjective+verb dual listings pruned, 2026-07-06); the rule lives in `/canon.md` | | `manner_placement_study.md` | The attestation study behind the manner-descriptor placement ruling (2026-07-06); the rule lives in `/canon.md` | +| `seams_study.md` | The measurement of unmarked phrase boundaries and the source-blind reading test behind the object particle `ku` (2026-11-24), with the unruled comparison of subject and verb particles; the rule lives in `/canon.md` | | `small_words_study.md` | The text survey and source-blind reading test behind the small-word and clause-relation rulings and the `ture` coinage (2026-11-24); the rules live in `/canon.md` and the registry in `documents/reference/small_words.md` | | `function_word_shape_audit.md` | The 113-word audit behind the function-word shape charter (2026-07-06); the ruling lives in `/canon.md` | | `digraph_merger_audit.md` | Every digraph word measured against its plain-consonant twin (2026-07-26); the `wh` against `w` ruling lives in `/canon.md` | diff --git a/archive/seams_study.md b/archive/seams_study.md new file mode 100644 index 00000000..09a1a4eb --- /dev/null +++ b/archive/seams_study.md @@ -0,0 +1,199 @@ +# The unmarked seams: study and rulings sheet + +Date: 2026-11-24. Measured with `scripts/phi_readings.py` and `scripts/phi_roles.py` on the lexicon at 1,306 entries, before the ruling was implemented. This is the sheet the maintainer ruled from, kept as he read it, with the addendum written in answer to his follow-up question. His ruling on the six points in section 4, given the same day: "I agree with all of your recommendations." That is option B with the form `ku`. The addendum's question about subject and verb particles was not ruled on. Decision D134 records the result, and `canon.md` carries the rule. + +Scope: the November assessment's central finding, section 4.3, and its recommendations 11, 13, and 31. Phi closes every embedded statement, question, and quotation with a word. It marks nothing where the subject ends and the object begins, where a prepositional phrase ends, or where a manner word could be an object. Reference (`shia`) is a separate sheet. + +Any option that adds a word reopens the closed particle inventory. That decision is the maintainer's, and canon's Grammar Amendment Boundary sets the test: a repeatable defect shown in connected use, which existing grammar cannot resolve without structural ambiguity. Sections 1 and 2 are the showing. + +## 1. The size of it + +Counts are of the texts shelf (translations and originals together, about 3,250 sentences). A "division" is one way of cutting the words before the verb into subject, adjuncts, object, and manner. All figures are upper bounds on what the grammar leaves open; none is a rate of misreading. + +| | Sentences | Share | +|---|---:|---:| +| More than one division, counting only nouns, pronouns, and names as phrase ends | 1,388 | 43% | +| The same, also letting an event or quality noun head a phrase | about 2,170 | 67% | +| A noun or name directly beside a noun, edge open | about 650 | 20% | + +The ambiguous clauses (1,684) sort by what is uncertain: + +| What is uncertain | Clauses | +|---|---:| +| Where the object begins: after the subject, after a possessor, or after a prepositional phrase | 1,328 | +| Where the subject ends before a time word or an adjunct, with no object in play | 198 | +| How the words before a fixed object divide | 157 | + +Two smaller kinds sit beside these. In 197 clauses of the translations one bare phrase stands before a verb that takes an object, so the phrase is subject or object. And across the whole corpus about one adverbial clause in five (66 of 316) and one relative clause in five (53 of 268) has more than one grammatical end. + +## 2. What readers do with an unmarked seam + +Fourteen short sentences were written so that both readings make sense. Two fresh readers saw them unmarked, with only the Phi, a gloss, and the entries. Each gave a first reading, the other readings, and a confidence that the first was meant. + +| Phi | First reading | Confidence | +|---|---|---| +| `ne samira tuleno haoni to hea.` | both: Samira heard the frog's voice | 80%, 80% | +| `phao lopia shelu theo.` | both: the parent reads the child's book | 50%, 45% | +| `melu lohau nuora to nuola.` | both: the friend's dog ate the food | 60%, 60% | +| `lohau mua thepalu to nai. lopia to nila.` | both: the child saw it | 65%, 60% | +| `tupiwa tha lo phirae tupiwa so ma nila tho to soliru.` | one: it would not see the other rabbits; the other: the other rabbits would not see it | 60%, 55% | +| `whu mia nila miona to shua.` | both: the person I see came | 70%, 75% | +| `lopia roe phao kiru wolea to kati.` | both: cut the wood with the parent's chisel | 85%, 88% | +| `shia welao thumela.` | both: they teach well | 60%, 70% | +| `mia nohero to helui.` | both: my belief changed | 50%, 50% | +| `wheo lopia nophi to shane.` | both: the elder told the child's story | 45%, 40% | +| `phao lopia shelu ka theo.` | both: the parent has the child read the book | 75%, 70% | +| `melu lopia to naphe.` | both: the friend helped the child | 65%, 65% | + +Three things stand out. + +- The readers mostly agree with each other, and neither is sure. Mean confidence on these twelve is 63%. +- The split is not consistent. The same three-noun shape is cut after the first noun in two sentences and after the second in a third, by plausibility alone. +- The fifth sentence is the certified *Velveteen Rabbit* line the assessment found misread. Given a neutral subject, two readers took opposite roles for `lo phirae tupiwa`. + +## 3. The options + +### A. Teach the repairs that exist, and add nothing + +The assessment's step 2. Move a possessor into a relative clause (`whu phao phelu shelu`, the book the parent holds); keep the subject explicit; put a Slot 1 particle in so that manner and object separate; say that a careful speaker breaks slightly between phrases. + +- Costs no inventory and can be written today. +- The possessor repair adds two words (`whu ... phelu`) at each use. The Slot 1 repair is not available in the plain present. Pauses do not survive on the page, and canon says they cannot change meaning. +- It does not help the 197 open roles: a lone phrase before `nila` stays subject or object. + +### B. One optional word that opens the object phrase (recommended) + +A Slot 2 particle, said only when the edge or the role needs saying. Everything from the particle to the Slot 1 stack or the verb is the object; whatever stands before it is subject or adjunct. The unmarked clause stays the resting state, as the unmarked sentence does for evidence. + +With the placeholder form `ku`: + +| Phi | Reading | +|---|---| +| `phao ku lopia shelu theo.` | the parent reads the child's book | +| `phao lopia ku shelu theo.` | the parent's child reads the book | +| `ku lopia to nila.` | (it) saw the child | +| `whu ku mia nila miona` | the person who sees me | +| `shia ku welao thumela.` | they teach goodness | +| `mia ku nohero to helui.` | I changed the belief | + +**Simulated reach.** In 1,328 of the 1,684 ambiguous clauses (79%) every reading has its object beginning at a different word, so the particle alone tells them apart. 1,006 of the 1,388 ambiguous sentences (72%) would be settled completely. It also settles every open role and every open relative head, which no boundary marker can. + +**Reading test.** The same fourteen sentences went to two other fresh readers with `ku` placed to select one reading, usually the one the unmarked readers had not chosen. Its entry was six sentences long. + +| Phi | Both readers | +|---|---| +| `ne samira tuleno ku haoni to hea.` | Samira's frog heard a voice | +| `phao lopia ku shelu theo.` | the parent's child reads the book | +| `melu ku lohau nuora to nuola.` | the friend ate the dog's food | +| `... ku lopia to nila.` | it saw the child | +| `tupiwa tha ku lo phirae tupiwa so ma nila tho to soliru.` | it would not see the other rabbits | +| `whu ku mia nila miona to shua.` | the person who sees me came | +| `lopia roe phao kiru ku wolea to kati.` | cut the wood with the parent's chisel | +| `shia ku welao thumela.` | they teach goodness | +| `mia ku nohero to helui.` | I changed the belief | +| `wheo ku lopia nophi to shane.` | the elder told the child's story | +| `ku melu lopia to naphe.` | (someone) helped the friend's child | + +All eleven were read as marked by both readers, and each reader ruled the other reading out in so many words ("not available as written", "not licensed"). In eight of them the marker turned the reading away from what the unmarked readers had chosen. Mean confidence rose from 63% to 78%. What doubt remained was of other kinds: whether a noun before a noun owns it or names its kind (dog's food, dog food), and who an unsaid subject is. + +One sentence exposed a gap in the rule. In the causative `phao lopia ku shelu ka theo.` both readers chose "the parent has the child read the book" and both noted that, read strictly, everything before `ku` would be one subject (the parent's child). A ruling has to say where the person made to act stands. See point 3. + +**Why an object word and not a bare boundary word.** Languages that mark objects only when it matters are common: Spanish *a*, Hebrew *et*, Persian *-râ*, Turkish, and the object particle Japanese speakers drop in conversation. The pattern exists because subject and object are the pair most worth keeping apart. It also fits the organizing principle: the relation is announced before the phrase it governs. + +**Costs.** + +- A thirty-ninth particle, in the slot that is already the fullest. +- Phi has had no marking of roles at all. This is the first, even though optional. +- If a writer marked every clause where it could matter, about one clause in three on the texts shelf would carry it, close to one word in twenty-three. `to` is one word in fourteen. Optional use will be far lower, and how much lower is a matter of habit that the ledger will show. +- It does nothing for 355 clauses where the uncertainty is before the object or without one, mostly a time word after the subject (`ne lopia ta howai kau nuwera to wepu`, whose other reading is "Lopia's one evening went to bed"), nor for the open clause ends. + +### C. One optional word that opens any phrase + +The assessment's recommendation 31. The same particle, without a role: it may stand before the object, before a bare time phrase, or before the subject of a main clause after a dependent one. + +- Reaches further than B on boundaries: with enough markers every division is distinct, including the 355 clauses B leaves and the open clause ends. +- Says nothing about roles. `X lopia to nila` would open a phrase and leave it subject or object. +- A sentence may need two or three, where B needs one. +- A word that means only "a phrase starts here" has no parallel elsewhere in Phi, whose particles all say what they are opening. + +### D. An optional possessive linker + +A word between possessor and possessed, so that an unmarked pair of nouns is two phrases. It marks the inside of a phrase where B marks its edge. + +- Settles the noun chains as well as C does. +- Nothing for roles, for manner or object, or for the end of a prepositional phrase without a second marker. +- It lands on Phi's most characteristic habit, the noun before a noun, and on every entry in the compound registry. Each compound would become a choice between two forms. + +### E. `ha` as a phrase opener + +Closed already. The maintainer ruled on 2026-11-19 that Phi has no articles. For the record, treating `ha`, `ra`, and `lo` as always opening a phrase would lower the share of ambiguous sentences in the translations from 42% to 35%. + +## 4. Points to rule on + +**Point 1. Which option.** Recommended: **B**, with the repairs in A taught beside it, since they cost nothing and cover cases where a speaker prefers to restructure. + +**Point 2. The form, if B or C.** Eight plain one-syllable forms are free. The word will stand where `ha`, `ra`, `lo`, `ko`, and the numerals stand, so those are its nearest rivals. + +| Form | Nearest words in the same position | English echo | Note | +|---|---|---|---| +| `ku` | `ko` (focus), `nu`, `ru` | "coo" | Recommended. Its other `k` neighbours (`ka`, `ke`, `ki`) are all Slot 1 and stand before verbs. | +| `hu` | `ha` (this), `nu`, `ru` | "who" | `ha` is very frequent before nouns. Canon kept `who` out for how it reads in English. | +| `re` | `ra` (that), `ne`, `we`, `pe`, `le` | "ray" | Five Slot 2 words already end in `e`. | +| `tu` | `ta` (one), `nu`, `ru` | "two" | Sounds like English "two" while Phi's two is `wi`, and stands where `ta` stands. | +| `ri` | `li` (only) | | `l` against `r` is the contrast most learners lose. | +| `mi` | `mia` (I) | "me" | One vowel short of the first person; also the retired superlative. | +| `me` | `ne`, `we`, `pe`, `mo` | "meh" | Crowded. | +| `pu` | `pe` | "poo" | | + +The form is for the maintainer's ear. `ku` was used in the test only as a placeholder. + +**Point 3. What it marks, if B.** Recommended: + +- The direct object phrase, and nothing else. A complement of `nai` or `kelu` is not an object and never takes it. +- It works the same inside a relative clause. +- In a causative, it marks the thing the caused act falls on. The person made to act stands bare between the subject and the particle: `phao lopia ku shelu ka theo`. If that person and the subject could run together, the subject is the one that needs repair, by a relative clause or a name. +- It is never required. A clause without it is complete and ordinary. + +**Point 4. Where it stands in its phrase, if B.** Recommended: at the outer edge, before `we` and `li` and before any possessor: `ku we lopia shelu` (also the child's book, as object). That keeps one rule: the object starts at the particle. + +**Point 5. What B leaves.** The time word after a subject and the open clause ends. Recommended: add nothing for these. The time-word reading ("Lopia's one evening") is grammatical nonsense that readers set aside without help; both unmarked readers did. Teach the existing repair for a clause end, which is to begin the main clause with something that cannot be owned: a pronoun or a name. Watch both on the ledger. + +**Point 6. Whether the texts must use it.** Recommended: no rule. The word is optional by design. Once it exists, a translation's certification can ask the source-blind reader's doubts to decide where it is needed, which is the test that matters. + +## 5. What follows the rulings + +If B: one pull request under the amendment checklist in the development protocol. Canon bullet, the particle's entry with its slot and its place in the Slot 2 order, the particle and preposition references, the finder pages, the parser (the word, its position, and the reading counter's treatment of it), tests, the decision record, and a section in the manual's chapter on the sentence. The primer and the pamphlets wait, as agreed. No text changes. The reading ledger will not move until a text uses the word. + +If A alone: a manual section, "Where one phrase ends", and nothing else. + +## Appendix: limits of the evidence + +- The simulation asks whether an object word could tell a clause's readings apart. It does not know which reading a writer meant, or whether the writer would have bothered. +- The reading test is four model readers, two per condition, on fourteen invented sentences built to be reversible. Real text is less evenly balanced, and context settles much of it. The test shows that an unmarked seam is read on plausibility with middling confidence, and that a six-sentence entry was enough for the marker to be read correctly every time. +- The unmarked readers' entry for `nila` and the grammar notes were the ones in the repository. Both unmarked readers and both marked readers flagged the bare time phrase `ta howai` as possibly unlicensed, which is a gap in the packet's notes and not in the grammar. + +## Addendum: optional subject and verb particles + +Asked by the maintainer after reading the sheet: Phi began with optional markers for subject, object, and verb, so should the object word be joined by the other two? The 2021 and 2022 particle pages list `si` (subject, optional, always sentence-initial), `na` (object), and `te` (verb). All three forms now do other work (`si` imperfective, `na` necessity, `te` cessative). + +What each would settle, simulated on the 1,388 ambiguous sentences of the texts shelf: + +| Markers available | Ambiguous sentences settled | Left ambiguous, share of all text sentences | +|---|---:|---:| +| object | 72% | 11.8% | +| subject alone | 1% | 42% | +| verb alone | 2% | 42% | +| object and subject | 75% | 11% | +| object and verb | 75% | 11% | +| object, subject, and verb | 78% | 10% | +| object, plus an existing preposition on a bare time phrase | 89% | 4.8% | +| that, and subject | 92% | 3.5% | +| that, subject, and verb | 95% | 2.2% | + +What each is for: + +- A subject particle shows where a main clause begins after a dependent clause (50 open adverbial ends in the texts) and lets a lone phrase be asserted as subject (214 open roles). An object particle already separates the two roles from the other side. +- A verb particle separates manner from object where no Slot 1 particle stands (62 clauses in the texts) and shows where a relative clause ends (53). In two clauses of every three a Slot 1 particle already marks the verb; 34% of clauses in the texts have none. +- Neither touches the largest remainder after the object word, which is a bare time phrase after the subject. Existing grammar settles that: `mua` or `sui` before the time phrase. + +A verb particle would be, in effect, an optional present-tense particle, the unfilled place beside `to` and `so`. diff --git a/canon.md b/canon.md index 8268073f..b5621a4b 100644 --- a/canon.md +++ b/canon.md @@ -80,7 +80,7 @@ These were explicitly decided and should not silently fork again: - **Qualities do not name their acts** (settled 2026-07-06): the adjective→verb direction is refused, completing one-word-one-class — no content entry lists two parts of speech, and the validator enforces it. Entering a state is `kelu` (become) with the quality before it (`lureko seroli kelu`, the fruit ripens — the Velveteen text's own `thia shewo kelu`); causing one is ordinary Slot 1 voice on the verbs of being and becoming (`mia noru hiso ka kelu`, I clean the bowl; `mia lopia shena ka nai`, I keep the child calm). The 12 dual listings were pruned to adjective-only — except `phae` (open), which like `kulo` was verb-primary all along: the primer teaches it beside verb-only `tapu` (close), so it keeps the verb and sheds the adjective. Word-by-word audit in `archive/adjective_verb_adjudication.md`. - **Manner is a descriptor before the verb** (settled 2026-07-06): Phi has no adverb class and needs none — the same descriptors that modify nouns modify verbs, standing immediately before the verb, inside the Slot 1 block: `to shena haolu` (said calmly), `to reshi wepu` (moved fast), both from the complementizers pamphlet. The verb phrase thus mirrors the noun phrase — function words, then descriptors, then the head: `ha mioru thepalu` / `to reshi kolua`. Depictives share the position (`thia ma mioru nila`, see you as unbeautiful — Velveteen). Two early texts had the descriptor outside the Slot 1 block; both were realigned (Schleicher fable, Velveteen). Evidence in `archive/manner_placement_study.md`; taught in ch10 §4. - **`we` and `li` stand outside the Slot 1 block** (settled 2026-11-24): when additive `we` or restrictive `li` applies to the verb, it stands at the outer edge of the verb phrase, before any Slot 1 particle: `shia we to pa nulae` (they also fell asleep), `ne kalora li to seniku` (Kalora only smiled). Neither stands between the Slot 1 stack and the verb. That position belongs to manner and depictive words with their degree particles. The texts already used the outer order in all but one line. -- **The function-word shape charter** (extended 2026-07-10): every function class has a chartered shape with conformance validator-enforced. CV monosyllables are the grammar's atoms — the 38 particles (plain CV, never a digraph onset, for instant recognition) and the base numerals `mu ta wi` — and nothing else may take that shape. Hiatus disyllables ((C)V.V) are relators: all 27 prepositions and the core pronouns `mia thia shia`; the reflexive/reciprocal pair `miso wiso` is the designed -so extension of the pronoun set. Fricative monosyllables are the bracketing words: one digraph per frame, with `-a` opening and `-o` closing (`tha tho` declarative, `pha pho` interrogative, `sha sho` quotative), and the unpaired relativizer `whu`, whose vowel is neither because nothing it opens is ever closed by a word. Plain disyllables are the remaining frames: the vocative `kona`, the four classifiers, and the frame conjunctions — while the clause-relators `lao pheo phoe shai whau` carry the relator shape instead, prepositions over clauses. Quantifiers, discourse markers, and interrogatives are content-shaped (two or three syllables, patterns free): they ride in descriptor and adverbial positions where content words live. Audit and two unruled observations in `archive/function_word_shape_audit.md`. +- **The function-word shape charter** (extended 2026-07-10): every function class has a chartered shape with conformance validator-enforced. CV monosyllables are the grammar's atoms — the 39 particles (plain CV, never a digraph onset, for instant recognition) and the base numerals `mu ta wi` — and nothing else may take that shape. Hiatus disyllables ((C)V.V) are relators: all 27 prepositions and the core pronouns `mia thia shia`; the reflexive/reciprocal pair `miso wiso` is the designed -so extension of the pronoun set. Fricative monosyllables are the bracketing words: one digraph per frame, with `-a` opening and `-o` closing (`tha tho` declarative, `pha pho` interrogative, `sha sho` quotative), and the unpaired relativizer `whu`, whose vowel is neither because nothing it opens is ever closed by a word. Plain disyllables are the remaining frames: the vocative `kona`, the four classifiers, and the frame conjunctions — while the clause-relators `lao pheo phoe shai whau` carry the relator shape instead, prepositions over clauses. Quantifiers, discourse markers, and interrogatives are content-shaped (two or three syllables, patterns free): they ride in descriptor and adverbial positions where content words live. Audit and two unruled observations in `archive/function_word_shape_audit.md`. - **The bracketing words are fricative monosyllables** (settled 2026-07-26): the seven complementizers moved out of the plain disyllables into the fricative-digraph monosyllable space, which held twenty legal forms and no occupants: `tha tho` (declarative), `pha pho` (interrogative), `sha sho` (quotative), and `whu` (relative). The `-a` opener against `-o` closer contrast is unchanged and now carries the pair distinction alone. One digraph serves each frame, so the onset says which frame and the vowel says which end. The relativizer takes the fourth digraph and neither pair vowel: `whu` opens what only a head noun can close, and its vowel says so before a learner can invent a closer for it. `wu` is reserved and must stay empty, because a speaker who collapses `/ʍ/` into `/w/` says "wu", and that pronunciation has to land on nothing. The same test retired `wha`, whose merged form lands on `wa` (Q). Every other unassigned fricative monosyllable stays free, `who` among them, an English word that would read badly in a Phi passage. This reverses the two-syllable frame-word settlement of PR #78, which several earlier reviews had upheld. - **No word may rest on `wh` against `w` alone** (settled 2026-07-26): no two Phi words may differ only by `wh` against `w`, in any position and across every word class, and the validator errors on any such pair. Most English speakers merge `/ʍ/` into `/w/`, so a pair like that is not a contrast for them at all but one word with two spellings. This line is absolute and takes no grandfathered baseline, because the lexicon had been honoring it without a rule: an audit of all 1,287 entries found `whenola` (wander) against `wenola` (collaborate) as the single live pair, and `whenola` was renamed `nurima` with the vacated form retired. The other three digraphs keep their plain counterparts as ordinary neighbours, since `/ɸ/` against `/p/` and `/θ/` against `/t/` separate a fricative from a stop and `/ʃ/` against `/s/` separates two sibilants; twenty-nine such pairs are live, including `tho` against `to` and `sho` against `so`, and they are judged by ear under the collision rule below rather than barred. Full survey in `archive/digraph_merger_audit.md`. - **The collision rule governs content words** (settled 2026-07-25): the edit-distance-1 rejection and the minimal-pair ratchet in `documents/validation/minimal_pairs_baseline.txt` apply to content words, where the form space is large and nothing but the form distinguishes two words. Function words are exempt, and particles most of all: the inventory has always been built on minimal pairs, with 161 particle pairs at edit distance 1 and 55 of those in the same slot (`ha`/`ra`, `hi`/`ho`, `ka`/`ke`, `ho`/`so`), because a particle is identified by its slot and its position as much as by its shape. Fifty CV forms is too small a space to hold a growing inventory under a distance rule, and the validator has only ever enforced the ratchet on content words. A new particle is still judged by ear against its slot-mates and against any content word it could be mistaken for in running speech. @@ -110,7 +110,8 @@ These were explicitly decided and should not silently fork again: - **`ka` is voice** (settled 2026-07-05): the causative restructures arguments, exactly as the passive does, and claims nothing about certainty or obligation; it sits in the Voice rank beside `se`. Within the rank the order is fixed `se ka` (`lopia se ka nulae`, the child is made to sleep). With modals, voice precedes modality: `ka na` (must make), `ka po` (can make), the modal scoping the whole caused event. `ka ma` denies the causation itself (`mia lopia to ka ma nulae`, I did not make the child sleep); caused refraining is said with its own verb or two clauses. - **Aspect under `ka` describes the causing** (settled 2026-07-09): Slot 1 particles describe their own clause's event, and in a causative clause that event is the act of causing — `to ro ka wepu` can only mean that the making-go recurs. An aspect that belongs to what the caused ones themselves do moves out of the cluster, into its own clause (`punoa roe nurako lo miona to ka wepu. ha wepu keno to kelu.` — society made people go by railway; this going became a custom) or into a word that carries the repetition. Ruled from the News from Nowhere railway line: civilization does nothing habitually. - **`li` is a fence, not a sigh** (settled 2026-07-05): `li` restricts identity — `li shia sano` (only they know), `li nosa` (only now) — and is refused on quantities: exact counts and `henoi` carry quantity-honesty. "Only three eggs" is a count plus a feeling, and Phi states the count. -- **Slot 2 nests** (settled 2026-07-05; clarified 2026-07-21 and 2026-07-26): within a phrase, wider relations stand earlier — `we`/`li` > `ha`/`ra` > `lo`/numerals > `ko` > degree (`ru`, `la`, `pe`, `wo`, `mo`) > the word — modifier-first applied inside the phrase (attested: `ha lo ru mioru peloru`). The word at the end of that order is any word, so a degree particle measures a quality, an action, or a noun that has degrees: `ru nuhe` is much sadness and `wo tupeka` too much burden, and the states whose nouns carry no adjective at all (`nuhe`, `sukima`, `wiloru`, `tupeka`) reach their degrees this way or not at all. Sense refuses an ungradable host, so nothing licenses `ru womu`, very house. `mo` before a countable noun compares amount rather than degree (`mo thena`, more things). `we` and `li` do not stack with each other; the pair micro-orders stand (`mo ko`, `ne` before any honorific, `nu` before its numeral). Before a bare deictic with no following noun, `lo` builds a plural pronoun exactly as it does with `mia`: `lo ha` (these) and `lo ra` (those) stand alone as noun phrases (`su lo mia lo ha ru thape.`, let us burn these thoroughly); before a noun the deictic stands first (`ha lo thena`, these things). +- **Slot 2 nests** (settled 2026-07-05; clarified 2026-07-21 and 2026-07-26): within a phrase, wider relations stand earlier — `ku` > `we`/`li` > `ha`/`ra` > `lo`/numerals > `ko` > degree (`ru`, `la`, `pe`, `wo`, `mo`) > the word — modifier-first applied inside the phrase (attested: `ha lo ru mioru peloru`). The word at the end of that order is any word, so a degree particle measures a quality, an action, or a noun that has degrees: `ru nuhe` is much sadness and `wo tupeka` too much burden, and the states whose nouns carry no adjective at all (`nuhe`, `sukima`, `wiloru`, `tupeka`) reach their degrees this way or not at all. Sense refuses an ungradable host, so nothing licenses `ru womu`, very house. `mo` before a countable noun compares amount rather than degree (`mo thena`, more things). `we` and `li` do not stack with each other; the pair micro-orders stand (`mo ko`, `ne` before any honorific, `nu` before its numeral). Before a bare deictic with no following noun, `lo` builds a plural pronoun exactly as it does with `mia`: `lo ha` (these) and `lo ra` (those) stand alone as noun phrases (`su lo mia lo ha ru thape.`, let us burn these thoroughly); before a noun the deictic stands first (`ha lo thena`, these things). +- **`ku` opens the object** (settled 2026-11-24): the Slot 2 particle `ku` (OBJ) opens the direct object phrase when its edge or its role needs saying. Everything from `ku` to the Slot 1 stack, or to the verb when there is no stack, is the object, and whatever stands before it is the subject, an adjunct, or in a causative the one made to act: `phao ku lopia shelu theo` (the parent reads the child's book), `phao lopia ku shelu theo` (the parent's child reads the book), `ku lopia to nila` (it saw the child, with the subject unsaid), `phao lopia ku shelu ka theo` (the parent has the child read the book). It is never required: the unmarked clause is the resting state, as the unmarked sentence is for evidence. It stands at the outer edge of its phrase, before `we` or `li` and before any possessor, once in a clause, and works the same inside a relative clause (`whu ku mia nila miona`, the person who sees me). A complement of `nai` or `kelu` is not an object and never takes it, a passive clause has none to mark, and it never opens the object of a preposition. With no Slot 1 particle after it, a word directly before the verb belongs to the object, so a manner word beside a marked object needs a Slot 1 particle in front of it. This is the first amendment to the particle inventory under the Grammar Amendment Boundary, and it makes thirty-nine particles. The defect was measured before the ruling. In the texts 43 percent of sentences divide into phrases in more than one way, and four in five of the ambiguous clauses turn on where the object begins. Source-blind readers split unmarked seams by plausibility at about 63 percent confidence, and took opposite roles on a certified line; with the particle they read every marked sentence as marked. The existing repairs stay and are taught beside it: a relative clause with `phelu` for a possessor (`whu phao phelu shelu`), `mua` or `sui` before a bare time phrase, and a pronoun or a name to begin a main clause after a dependent one. The study is preserved in `archive/seams_study.md`. ## Validation diff --git a/documents/README.md b/documents/README.md index 52a104ad..c8f7a0f1 100644 --- a/documents/README.md +++ b/documents/README.md @@ -14,7 +14,7 @@ The [grammar index](grammar/) leads to the authoritative machinery references an | [Phonology rules](reference/phonology_rules.md) and [phonetics](reference/phonetics.md) | Word-form rules, pronunciation, stress, and boundary behaviour. | | [Compound registry](reference/compounds.md) | Established compositions and their documented interpretations. | | [Taught patterns](reference/taught_patterns.md) | Indexed inventory of constructions taught across the learning materials. | -| [Finding the particle](reference/particle_finder.md) | The thirty-eight particles indexed by what a speaker wants to say rather than by slot. | +| [Finding the particle](reference/particle_finder.md) | The thirty-nine particles indexed by what a speaker wants to say rather than by slot. | | [Finding the small word](reference/small_words.md) | The registry for again, still, already, even, except, when, until, and their kin, indexed by what a speaker wants to say. | | [The voice, for models](reference/voice_for_models.md) | Writing reference for Phi's register, mechanics, Humanizer pass, and final audit. | | [What certified means](reference/translation_certification.md) | Public explanation of the mark on completed translations, what the process checks, and why a certified text may still contain errors. | diff --git a/documents/grammar/particle_reference.md b/documents/grammar/particle_reference.md index ba5c55cc..27e2b3e8 100644 --- a/documents/grammar/particle_reference.md +++ b/documents/grammar/particle_reference.md @@ -290,7 +290,31 @@ Order: Tense (`to`) > Aspect (`si`) > Voice (`se`) > Evidentiality (`hi`/`ke`/`t ## Slot 2: Word-Level Particles -These particles appear **immediately before** the specific word they modify (noun, verb, or adjective). When several modify the same word, wider relations stand earlier — `we`/`li` > `ha`/`ra` > `lo`/numerals > `ko` > `ru`/`la`/`pe`/`wo`/`mo` > word — modifier-first inside the phrase (canon, *Slot 2 nests*). +These particles appear **immediately before** the specific word they modify (noun, verb, or adjective). When several modify the same word, wider relations stand earlier — `ku` > `we`/`li` > `ha`/`ra` > `lo`/numerals > `ko` > `ru`/`la`/`pe`/`wo`/`mo` > word — modifier-first inside the phrase (canon, *Slot 2 nests*). + +### Object + +#### `ku` - Object Opener (OBJ) +**Function**: Announces that the direct object begins here +**Usage**: Optional. `ku` stands at the outer edge of the object phrase, before `we` or `li` and before any possessor. Everything from `ku` to the Slot 1 stack, or to the verb when there is no stack, is the object; the subject, every adjunct, and in a causative the one made to act stand before it. One per clause. +**Example**: +``` +phao lopia ku shelu theo. +parent child OBJ book read. +(The parent's child reads the book.) +``` +``` +phao ku lopia shelu theo. +parent OBJ child book read. +(The parent reads the child's book.) +``` +Before a clause's only phrase it marks an object whose subject is unsaid, and it works the same inside a relative clause: +``` +ku lopia to nila. +OBJ child PST see. +(It saw the child.) +``` +**Note**: a complement of `nai` or `kelu` never takes `ku`, a passive clause has no object to mark, and `ku` never opens the object of a preposition. With no Slot 1 particle after it, a word directly before the verb belongs to the object (canon: *`ku` opens the object*). ### Number @@ -633,7 +657,7 @@ PL 1SG RECP love. |------|----------|----------| | **0** | Sentence frame | `wa`, `no`, `lu`, `lu he`, `su`, `pi` | | **1** | Verb phrase (Tense > Aspect > Voice > Evid > Modal > Neg) | `to`, `so`, `ki`, `si`, `pa`, `te`, `ro`, `se`, `hi`, `ke`, `ti`, `ho`, `po`, `na`, `ka`, `ma` | -| **2** | Word-level | `lo`, `nu`, `ko`, `mo`, `ha`, `ra`, `ne`, `sa`, `ni`, `le`, `ru`, `la`, `pe`, `wo`, `we`, `li` | +| **2** | Word-level | `ku`, `lo`, `nu`, `ko`, `mo`, `ha`, `ra`, `ne`, `sa`, `ni`, `le`, `ru`, `la`, `pe`, `wo`, `we`, `li` | **Note**: Complementizers (`whu`, `sha`/`sho`, `tha`/`tho`, `pha`/`pho`) and vocative (`kona`) are not particles—see `complementizer_reference.md`. diff --git a/documents/reference/language_guide.md b/documents/reference/language_guide.md index 32658f76..ba1c0ca3 100644 --- a/documents/reference/language_guide.md +++ b/documents/reference/language_guide.md @@ -43,7 +43,7 @@ Phi's lexicon uses recurring sound-symbolic associations: liquids often suggest The Subject-Object-Verb order places arguments before the action, while the three-slot particle system announces many grammatical relationships early. Evidential particles let a speaker name the claimed source of a statement when it matters. These structures can become occasions for deliberate composition, but they do not force reflection, and verb-final order also requires listeners to retain material until the predicate arrives. ### 2.3. Accessibility by design -Phi uses a small sound inventory and consistent analytic patterns, but several contrasts, dense function words, thirty-eight particles, clause frames, and ternary numerals still require study. No claim about universal ease or speed is justified until people with differing first languages have learned it. +Phi uses a small sound inventory and consistent analytic patterns, but several contrasts, dense function words, thirty-nine particles, clause frames, and ternary numerals still require study. No claim about universal ease or speed is justified until people with differing first languages have learned it. ### 2.4. Holistic concepts Phi's vocabulary is designed to reflect an interconnected worldview. Rather than separating concepts like "house" and "belonging," or "mind" and "spirit," Phi often uses a single, holistic word to encompass a broader meaning. diff --git a/documents/reference/particle_finder.md b/documents/reference/particle_finder.md index cda49970..94f4a70d 100644 --- a/documents/reference/particle_finder.md +++ b/documents/reference/particle_finder.md @@ -4,7 +4,7 @@ The particle reference and manual chapter 9 are organized by slot, which is the This page runs the other way. The left column is what you want to say; the middle column is the word for it. Cross-references at the end lead to the rules. -Every particle appears here exactly once, under the job it does. Thirty-eight of them, and the whole page is one sitting. +Every particle appears here exactly once, under the job it does. Thirty-nine of them, and the whole page is one sitting. ## Putting an event in time @@ -37,6 +37,14 @@ One of these at a time. Ending and finishing are different claims: `te` says the These two are the only same-rank pair in the language, and their order is fixed: `se ka`. +## Saying what is acted on + +| You want to say | Reach for | Example | +|---|---|---| +| the object starts here | `ku` | `phao lopia ku shelu theo.` | + +Without `ku` that sentence is the parent's child reading a book or the parent reading the child's book, and the listener chooses. With it, the object is `shelu` and the two nouns before it are one subject. It is optional, like the four source particles below: said when the edge matters. + ## Naming where your claim comes from | You want to say | Reach for | Example | diff --git a/documents/validation/phonetic_neighbors_baseline.txt b/documents/validation/phonetic_neighbors_baseline.txt index 34518a86..4ef6f1cf 100644 --- a/documents/validation/phonetic_neighbors_baseline.txt +++ b/documents/validation/phonetic_neighbors_baseline.txt @@ -1,22 +1,23 @@ # Generated by scripts/audit_phonetic_neighbors.py; do not hand-edit. # score unit_edits left left_gloss left_kind right right_gloss right_kind corpus_attestations 0.47 1 lu COND function lo PL function 2638 -0.47 1 mia 1SG function mea thanks interjection 2603 -0.47 1 shea peace content shia 3SG function 2245 -0.47 1 nila see content nela COORD function 1082 -0.47 1 ni HON.INTIM function ne NAME function 721 +0.47 1 mia 1SG function mea thanks interjection 2604 +0.47 1 shea peace content shia 3SG function 2247 +0.47 1 nila see content nela COORD function 1086 +0.47 1 ni HON.INTIM function ne NAME function 722 0.47 1 so FUT function su OPT function 575 0.47 1 ro HAB function ru INTS function 530 0.47 1 si IPFV function se PASS function 413 -0.47 1 wi two content we ALSO function 406 +0.47 1 wi two content we ALSO function 407 0.47 1 ke INFER function ki PFV function 352 0.47 1 mu zero content mo CMPR function 285 0.47 1 no IMP function nu ORD function 236 0.47 1 nia ON function nea aha interjection 145 0.47 1 te CESS function ti REP function 145 -0.47 1 le HON.ROLE function li RESTR function 141 +0.47 1 le HON.ROLE function li RESTR function 142 0.47 1 wia how many function wea TOWARD function 129 0.47 1 lau twenty-seven-group content lao BECAUSE function 124 +0.47 1 ko FOC function ku OBJ function 112 0.47 1 nophi story content nophe ABST.CLF function 109 0.47 1 hi DIR function he IRR function 107 0.47 1 pi POL function pe SUFF function 107 @@ -27,15 +28,15 @@ 0.47 1 thua fair content thoa AMONG function 58 0.47 1 sua who function soa sorry interjection 33 0.47 1 wenu tonic content weno when function 9 -0.47 1 phelu hold content phelo light content 395 -0.47 1 philu candle content phelu hold content 393 +0.47 1 phelu hold content phelo light content 396 +0.47 1 philu candle content phelu hold content 394 0.47 1 kelu become content kelo frame content 238 0.47 1 loa give content lua lovely interjection 238 0.47 1 phaelo feel content phaelu peaceful content 210 -0.47 1 welao good content wilao long-for content 175 +0.47 1 welao good content wilao long-for content 177 +0.47 1 shilu blue content shelu book content 174 +0.47 1 shelu book content shelo signify content 173 0.47 1 shero night content shiro tree content 168 -0.47 1 shilu blue content shelu book content 167 -0.47 1 shelu book content shelo signify content 166 0.47 1 solae explain content sulae warm content 129 0.47 1 kolo equal content kulo guide content 127 0.47 1 ruela path content roela scroll content 122 @@ -93,10 +94,10 @@ 0.47 1 tesu iron content tisu needle content 2 0.47 1 thorai bless content thorae facilitator content 2 0.47 1 thiru exit content thiro serene content 1 -0.50 1 po POT function to PST function 3894 -0.50 1 ko FOC function to PST function 3547 -0.50 1 thia 2SG function shia 3SG function 3208 -0.50 1 nia ON function mia 1SG function 2730 +0.50 1 po POT function to PST function 3897 +0.50 1 ko FOC function to PST function 3550 +0.50 1 thia 2SG function shia 3SG function 3210 +0.50 1 nia ON function mia 1SG function 2731 0.50 1 tha DECL.COMP function ha PROX function 1954 0.50 1 sha QUOT.COMP function ha PROX function 1772 0.50 1 pha INT.COMP function ha PROX function 1518 @@ -105,19 +106,19 @@ 0.50 1 tho DECL.COMP.CLOSE function sho QUOT.COMP.CLOSE function 1027 0.50 1 tha DECL.COMP function sha QUOT.COMP function 1026 0.50 1 na NEC function ma NEG function 1011 +0.50 1 nua COM function mua LOC function 851 0.50 1 sho QUOT.COMP.CLOSE function so FUT function 851 -0.50 1 nua COM function mua LOC function 849 0.50 1 tho DECL.COMP.CLOSE function pho INT.COMP.CLOSE function 773 0.50 1 tha DECL.COMP function pha INT.COMP function 772 -0.50 1 ta one content ka CAUS function 700 -0.50 1 whu REL function su OPT function 668 +0.50 1 ta one content ka CAUS function 701 +0.50 1 whu REL function su OPT function 670 0.50 1 tho DECL.COMP.CLOSE function ho ASSUM function 660 0.50 1 tha DECL.COMP function sa HON.RESPECT function 618 0.50 1 pho INT.COMP.CLOSE function so FUT function 597 0.50 1 pho INT.COMP.CLOSE function sho QUOT.COMP.CLOSE function 592 0.50 1 pha INT.COMP function sha QUOT.COMP function 590 0.50 1 ko FOC function po POT function 545 -0.50 1 ta one content pa INCH function 535 +0.50 1 ta one content pa INCH function 536 0.50 1 ho ASSUM function so FUT function 484 0.50 1 sho QUOT.COMP.CLOSE function ho ASSUM function 479 0.50 1 sha QUOT.COMP function sa HON.RESPECT function 436 @@ -127,12 +128,12 @@ 0.50 1 ki PFV function ti REP function 307 0.50 1 he IRR function se PASS function 298 0.50 1 shua come content sua who function 298 -0.50 1 theo read content pheo POST function 289 +0.50 1 theo read content pheo POST function 295 0.50 1 shea peace content phea AS function 259 0.50 1 hea hear content phea AS function 238 0.50 1 pho INT.COMP.CLOSE function ho ASSUM function 225 +0.50 1 theo read content sheo THAN function 225 0.50 1 hi DIR function si IPFV function 222 -0.50 1 theo read content sheo THAN function 219 0.50 1 te CESS function ke INFER function 190 0.50 1 phoa do content thoa AMONG function 185 0.50 1 pheo POST function sheo THAN function 184 @@ -151,7 +152,7 @@ 0.50 1 thola bring content sola DISJ function 105 0.50 1 te CESS function pe SUFF function 96 0.50 1 muo INTO function nuo um interjection 86 -0.50 1 phui flute content sui DUR function 83 +0.50 1 phui flute content sui DUR function 84 0.50 1 whola invite content sola DISJ function 81 0.50 1 phue wise content thue THROUGH function 79 0.50 1 pheno full content sheno ADD function 68 @@ -172,28 +173,28 @@ 0.50 1 sheli impatient content theli EACH function 14 0.50 1 sheli impatient content wheli ANY function 13 0.50 1 wemo plain content weno when function 13 -0.50 1 shelu book content phelu hold content 551 -0.50 1 selu flow content phelu hold content 421 +0.50 1 shelu book content phelu hold content 559 +0.50 1 selu flow content phelu hold content 422 0.50 1 sano know content whano stand content 404 -0.50 1 phelu hold content helu smooth content 395 -0.50 1 thelu dialogue content phelu hold content 391 +0.50 1 phelu hold content helu smooth content 396 +0.50 1 thelu dialogue content phelu hold content 392 0.50 1 phena kind content thena thing content 324 0.50 1 shena calm content thena thing content 295 0.50 1 sena pattern content thena thing content 286 0.50 1 thema guardian content thena thing content 284 0.50 1 shua come content thua fair content 280 -0.50 1 phao parent content shao three-group content 258 +0.50 1 phao parent content shao three-group content 265 0.50 1 thinu put content thimu time content 225 -0.50 1 wheo elder content theo read content 218 +0.50 1 wheo elder content theo read content 224 0.50 1 melu friend content nelu revere content 212 0.50 1 whalo large content thalo walk content 212 0.50 1 shaelo brave content phaelo feel content 209 -0.50 1 shelu book content selu flow content 190 -0.50 1 shelu book content helu smooth content 164 -0.50 1 shelu book content thelu dialogue content 160 +0.50 1 shelu book content selu flow content 197 +0.50 1 shelu book content helu smooth content 171 +0.50 1 shelu book content thelu dialogue content 167 +0.50 1 phao parent content hao pardon interjection 146 0.50 1 phoa do content soa sorry interjection 142 0.50 1 phoa do content whoa whole content 142 -0.50 1 phao parent content hao pardon interjection 139 0.50 1 siora joy content phiora spirit content 137 0.50 1 phewo sage content shewo true content 135 0.50 1 phiro elegant content shiro tree content 130 @@ -249,4 +250,3 @@ 0.50 1 seru commit content theru thick content 28 0.50 1 thola bring content whola invite content 28 0.50 1 sorui circle content shorui weary content 27 -0.50 1 poru productive content toru roof content 25 diff --git a/documents/validation/phrase_readings_baseline.txt b/documents/validation/phrase_readings_baseline.txt index 837b407d..c4b2ff0b 100644 --- a/documents/validation/phrase_readings_baseline.txt +++ b/documents/validation/phrase_readings_baseline.txt @@ -36,7 +36,7 @@ documents/evaluation/philosophical_capability_matrix.md 19 8 16 1 0 0 0 0 documents/evaluation/philosophical_test_corpus.md 279 125 207 20 0 6 0 0 documents/grammar/complementizer_reference.md 21 1 4 1 0 7 0 0 documents/grammar/numeral_reference.md 14 0 0 1 0 0 0 0 -documents/grammar/particle_reference.md 57 8 17 22 0 5 0 0 +documents/grammar/particle_reference.md 60 8 17 22 0 5 0 0 documents/grammar/philosophical_conversation.md 14 2 2 6 0 0 0 0 documents/modules/household_and_daily_life.md 5 2 3 0 0 0 0 0 documents/modules/work_craft_and_repair.md 2 2 2 0 0 0 0 0 @@ -52,11 +52,11 @@ manual/part4_grammar/ch09_particle_system/01_introduction.md 2 0 0 2 0 0 0 0 manual/part4_grammar/ch09_particle_system/02_three_slots_explained.md 2 1 1 0 0 0 0 0 manual/part4_grammar/ch09_particle_system/03_slot_0_framing.md 14 0 2 1 0 1 1 0 manual/part4_grammar/ch09_particle_system/04_slot_1_verb_phrase.md 27 4 5 9 0 4 0 0 -manual/part4_grammar/ch09_particle_system/05_slot_2_word_level.md 17 3 10 1 0 3 2 0 +manual/part4_grammar/ch09_particle_system/05_slot_2_word_level.md 18 3 10 1 0 3 2 0 manual/part4_grammar/ch09_particle_system/06_combining_particles.md 17 6 6 8 0 0 0 0 manual/part4_grammar/ch10_mindful_sentence/01_introduction.md 1 1 1 0 0 0 0 0 manual/part4_grammar/ch10_mindful_sentence/02_sov_worldview.md 1 1 1 0 0 0 0 0 -manual/part4_grammar/ch10_mindful_sentence/04_building_sentences.md 4 3 3 0 0 0 0 0 +manual/part4_grammar/ch10_mindful_sentence/04_building_sentences.md 7 4 4 0 0 0 0 0 manual/part4_grammar/ch10_mindful_sentence/05_questions_requests_conditions.md 18 6 7 3 0 0 0 0 manual/part4_grammar/ch10_mindful_sentence/06_exercises.md 34 24 25 5 0 0 0 0 manual/part4_grammar/ch11_nouns/02_zero_article_system.md 2 2 2 0 0 0 0 0 @@ -274,4 +274,4 @@ texts/the_mended_wall.md 57 25 45 2 0 1 1 0 texts/the_report_at_dusk.md 56 30 47 2 0 2 2 0 texts/the_worth_of_a_fallen_branch.md 56 26 42 0 0 1 1 0 texts/velveteen_rabbit.md 530 223 323 25 4 376 158 25 -vocabulary/ 1464 613 944 44 2 0 0 0 +vocabulary/ 1469 614 945 44 2 0 0 0 diff --git a/documents/validation/sentence_validator.md b/documents/validation/sentence_validator.md index 952ad814..408c4290 100644 --- a/documents/validation/sentence_validator.md +++ b/documents/validation/sentence_validator.md @@ -50,6 +50,7 @@ The default command parses every structured sentence under `vocabulary/` and eve | Questions | `wa` asks about the whole proposition and stays out of a content question; each content-question clause has one gap-word; `misa` follows an explicit subject and precedes the remaining clause material | | Predicate | A complete assertion ends in a lexical verb; interjections, vocatives, and recognized nominal fragments have their own trees | | Slot 1 | Tense, aspect, voice, evidentiality, modality, and negation keep their fixed order and one-per-rank limit, with `se ka` as the single paired voice | +| Object particle | `ku` stands once in a clause, at the outer edge of the object phrase and before the Slot 1 stack; an adjunct after it, or a preposition before it, is an error (`PHS118`); it has no place before `nai` or `kelu` or in a passive clause (`PHS119`) | | Slot 2 | Wider scope comes first, a noun phrase uses one quantity strategy, `lo` cannot double, `mo ko` keeps its fixed order, and `lo ha` or `lo ra` is licensed only as a bare plural pronoun; `we` and `li` on a verb stand before the Slot 1 stack, never between it and the verb (`PHS106`) | | Complements | `tha ... tho`, `pha ... pho`, and `sha ... sho` balance and nest; every embedded question takes `pha ... pho`; `wa` stays out of that frame; quotations close on one of the four canonical speech or hearing verbs | | Dependent material | Relative, adverbial, purpose, and conditional material precedes what it modifies; a `lu` condition is a complete sentence before its consequence; `pheo` and `phoe` stand over a clause or a time phrase and over no other noun or bare `ha` or `ra` (`PHS062`); the preposition `tei` may open a clause before the main clause, and after a subject it takes a noun phrase only | @@ -97,7 +98,7 @@ The parser answers whether a sentence has a canonical parse. `scripts/phi_readin A reading is one way of dividing a clause into phrases. For each core clause the counter takes the words before the Slot 1 stack, or before the verb when there is no stack, and enumerates every division that canon's order allows: subject, adjuncts, object or complement, then manner. It adds every place a dependent clause could end, using the parser to decide which ends are grammatical and its own phrase rules to discard the ones that leave an undividable clause. Readings multiply across the clauses of a sentence. Each sentence inside a quotation is counted as a sentence of its own. -`phao lopia shelu theo.` has three: the parent reads the child's book, the parent's child reads the book, and the single phrase in which nobody is named as reader. `mia shia wiru ma nila.` has one, because a pronoun begins its phrase. +`phao lopia shelu theo.` has three: the parent reads the child's book, the parent's child reads the book, and the single phrase in which nobody is named as reader. `mia shia wiru ma nila.` has one, because a pronoun begins its phrase. `phao lopia ku shelu theo.` has one, because `ku` fixes where the object begins; a clause with `ku` also has no open role, and it counts as a witness that its verb takes an object. Two counts are reported. The conservative count lets a noun, pronoun, or name end a phrase anywhere and lets an adjective or verb stand as a phrase only by itself and only where nothing else can end the phrase. The full count also lets an adjective (quality noun) or a verb (event noun) head a phrase with modifiers of its own, so `mia nohero to helui.` gains "my belief changed" beside "I changed the belief". diff --git a/documents/validation/vocabulary_prose_coverage.json b/documents/validation/vocabulary_prose_coverage.json index ea8aaf5d..d8b39413 100644 --- a/documents/validation/vocabulary_prose_coverage.json +++ b/documents/validation/vocabulary_prose_coverage.json @@ -1,11 +1,11 @@ { "contract": "lexicon-prose-v1", - "total": 1306, + "total": 1307, "states": { "legacy": 0, "partial": 0, "dual": 0, - "target": 1306 + "target": 1307 }, "by_kind": { "content": { @@ -18,12 +18,12 @@ } }, "function": { - "total": 114, + "total": 115, "states": { "legacy": 0, "partial": 0, "dual": 0, - "target": 114 + "target": 115 } }, "interjection": { @@ -37,12 +37,12 @@ } }, "fields": { - "articulatory_notes": 1306, - "examples": 1306, - "search_terms": 1180, - "usage_notes": 1133, + "articulatory_notes": 1307, + "examples": 1307, + "search_terms": 1181, + "usage_notes": 1134, "sound_symbolism": 760, - "pillars": 828, + "pillars": 829, "concept": 0, "grammatical_notes": 0 } diff --git a/manual/appendices/appendix_a_glossary.md b/manual/appendices/appendix_a_glossary.md index 714eb1d6..2b13658b 100644 --- a/manual/appendices/appendix_a_glossary.md +++ b/manual/appendices/appendix_a_glossary.md @@ -109,6 +109,7 @@ Click or hover on a row for a longer explanation of that gloss. | NAME | ne | proper-name token | Announces that the following Phi token is a proper designation. The token may be a content word or a productive Phi-form onym of two, three, or four syllables with no lexicon meaning. | | NEC | na | necessity | Marks that an action is necessary or obligatory: `mia na naphe` is I must help. | | NEG | ma | negation | Negation. It always comes last in a stack of Slot 1 particles, after tense, aspect, voice, evidentiality, and modality. | +| OBJ | ku | object opener | Optional. Opens the direct object phrase where its edge or its role needs saying: `phao lopia ku shelu theo` is the parent's child reads the book, and `phao ku lopia shelu theo` is the parent reads the child's book. | | OPT | su | optative | Announces a wish, hope, or prayer: `su sila towe nai` is may the community be well. | | ORD | nu | ordinal | Marks that the numeral before a noun gives its position, not its quantity: `nu ta lopia` is the first child, not one child. | | PASS | se | passive | The passive voice, promoting the object of an action to subject: `mia nophi kealo` (I create the story) becomes `nophi se kealo` (the story is created). | diff --git a/manual/part3_phonology/ch08_music_of_phi/02_syllable_structure.md b/manual/part3_phonology/ch08_music_of_phi/02_syllable_structure.md index e18a3b2e..a3984b64 100644 --- a/manual/part3_phonology/ch08_music_of_phi/02_syllable_structure.md +++ b/manual/part3_phonology/ch08_music_of_phi/02_syllable_structure.md @@ -21,7 +21,7 @@ Counting syllables is unusually kind to the learner: count the vowels. `phelona` A lexicon word cannot repeat a syllable. `kala` has two different syllables and is structurally possible; *kaka* repeats `ka` and cannot enter the vocabulary. Productive names use the related rule that no syllable with its own onset may repeat. -Phi also reserves every one-syllable form for grammar, and the word's first sound says which kind of grammar. A plain consonant and a vowel gives one of the thirty-eight particles or the base numerals `mu`, `ta`, and `wi`. A fricative digraph and a vowel gives one of the seven complementizers, the words that bracket an embedded clause. A content word or productive name therefore cannot be one syllable at all. These two shapes announce their broad grammatical role before a learner knows the word, and the ear separates them at the first sound: a particle begins on a closure, a bracket on a breath. +Phi also reserves every one-syllable form for grammar, and the word's first sound says which kind of grammar. A plain consonant and a vowel gives one of the thirty-nine particles or the base numerals `mu`, `ta`, and `wi`. A fricative digraph and a vowel gives one of the seven complementizers, the words that bracket an embedded clause. A content word or productive name therefore cannot be one syllable at all. These two shapes announce their broad grammatical role before a learner knows the word, and the ear separates them at the first sound: a particle begins on a closure, a bracket on a breath. ## What other shapes can tell you diff --git a/manual/part4_grammar/ch09_particle_system/01_introduction.md b/manual/part4_grammar/ch09_particle_system/01_introduction.md index 4de9d685..bfdfdb7d 100644 --- a/manual/part4_grammar/ch09_particle_system/01_introduction.md +++ b/manual/part4_grammar/ch09_particle_system/01_introduction.md @@ -10,7 +10,7 @@ Two Phi sentences show the difference: The content word **nila** does not change. Two short words placed before it locate the seeing in the past and identify inference as the speaker's source. Remove them and the sentence returns to an unmarked present assertion. -Words such as **to** and **ke** are particles. Phi has thirty-eight of them, all plain consonant-vowel syllables. Their brief, regular shape makes them easy to distinguish from content words, and their position shows what they affect. A particle does not hide inside a verb ending or ask the verb to change form. +Words such as **to** and **ke** are particles. Phi has thirty-nine of them, all plain consonant-vowel syllables. Their brief, regular shape makes them easy to distinguish from content words, and their position shows what they affect. A particle does not hide inside a verb ending or ask the verb to change form. Particles are only one part of Phi grammar. Word order distinguishes subject from object, prepositions relate phrases, complementizers frame embedded clauses, and other function words do work of their own. The particle system handles three kinds of scope: a whole utterance, a verb phrase, or one constituent. @@ -20,4 +20,4 @@ Separate words make grammatical choices audible. **wa** declares a yes/no questi Audibility is not the same as virtue. A source particle can be used carelessly, a polite particle can cover pressure, and an unmarked statement can be entirely responsible. Phi supplies explicit forms. Attention, truthfulness, and care still belong to the people using them. -The system also has a learning cost. Particle meanings and ordering must be remembered, especially when several gather before a verb. Two facts keep the cost finite. The inventory is closed: thirty-eight particles, the same thirty-eight in every text on the shelf, and no module or chapter adds to them. The list you learn is the list there is. And the three-slot model sorts them by scope: Slot 0 frames the utterance, Slot 1 shapes the verb phrase, and Slot 2 attaches to a particular word or phrase. The next five sections take those scopes in order. +The system also has a learning cost. Particle meanings and ordering must be remembered, especially when several gather before a verb. Two facts keep the cost finite. The inventory is closed: thirty-nine particles, the same thirty-nine in every text on the shelf, and no module or chapter adds to them. The list you learn is the list there is. And the three-slot model sorts them by scope: Slot 0 frames the utterance, Slot 1 shapes the verb phrase, and Slot 2 attaches to a particular word or phrase. The next five sections take those scopes in order. diff --git a/manual/part4_grammar/ch09_particle_system/05_slot_2_word_level.md b/manual/part4_grammar/ch09_particle_system/05_slot_2_word_level.md index 92e984a0..f0e239ef 100644 --- a/manual/part4_grammar/ch09_particle_system/05_slot_2_word_level.md +++ b/manual/part4_grammar/ch09_particle_system/05_slot_2_word_level.md @@ -138,10 +138,18 @@ The three honorifics follow **ne** and state the speaker's relationship to the n **ne sa sulae**, **ne ni moli**, and **ne le siora** name three different relations. None assigns universal rank to the bearer; each records how the speaker holds the relation. +## ku: the object + +**ku** opens the direct object phrase when its edge or its role needs saying: + +**phao lopia ku shelu theo.** — The parent's child reads the book. + +It stands before everything else in its phrase, **we** and **li** included, and it is always optional. Chapter 10 shows what it settles. + ## Nesting Slot 2 Wider scope comes first: -**we / li > ha / ra > lo / numeral > ko > degree > word** +**ku > we / li > ha / ra > lo / numeral > ko > degree > word** This gives **ha lo melu** (these friends), **ra nu wi shiro** (that second tree), **ha mo ko mioru peloru** (this most beautiful flower), and **li ha lo melu** (only these friends). The sequence is learned once, but a crowded phrase still takes effort to hear. When a stack begins to obscure its noun, another sentence is available. diff --git a/manual/part4_grammar/ch10_mindful_sentence/04_building_sentences.md b/manual/part4_grammar/ch10_mindful_sentence/04_building_sentences.md index 3b73f357..532ed5fd 100644 --- a/manual/part4_grammar/ch10_mindful_sentence/04_building_sentences.md +++ b/manual/part4_grammar/ch10_mindful_sentence/04_building_sentences.md @@ -47,4 +47,18 @@ Slot 1 particles remain before the descriptor, so noun and verb phrases share a The same position can describe how the object is perceived rather than how the action proceeds: **thia ma mioru nila** means "see you as unbeautiful." The surrounding meaning decides whether the descriptor is manner or a depictive quality. +## Where one phrase ends + +**phao lopia shelu theo.** has three nouns before its verb and two honest readings. A noun before a noun may own it, so the parent may be reading the child's book, or the parent's child may be reading a book. Nothing in the word order marks the last word of the subject. Most of the time the situation says it for you, and the sentence can stay as it is. + +When the edge matters, the particle **ku** opens the object: + +**phao ku lopia shelu theo.** — The parent reads the child's book. + +**phao lopia ku shelu theo.** — The parent's child reads the book. + +Everything from **ku** to the verb's own particles is the object, and everything before it is not. That one rule does more than split a row of nouns. It separates an object from the manner word it could be mistaken for: **shia welao thumela** is "they teach well" or "they teach goodness," and **shia ku welao thumela** is only the second. It gives a role to a phrase standing alone: **ku lopia to nila** is "it saw the child," where **lopia to nila** leaves the child free to be the one who saw. And inside a relative clause, **whu ku mia nila miona** is the person who sees me, not the person I see. + +**ku** is never required. A speaker chooses it as a source particle is chosen, on judging that this edge is part of what needs saying. Three other tools do neighboring work and cost no particle. A possessor can move into a clause of its own: **whu phao phelu shelu**, the book the parent holds. A bare time phrase after a subject can take **mua** or **sui**, so that **ne lopia mua ta howai** cannot be heard as Lopia's evening. A main clause that follows a dependent one can begin with a pronoun or a name, which nothing before it can own. + Word order supplies the ordinary roles, particles mark a departure, and the final verb completes the relation. When those cues are still not enough, a second sentence is better than pretending the first one could never be misunderstood. diff --git a/manual/part4_grammar/ch16_evidentiality/06_why_evidentiality_matters.md b/manual/part4_grammar/ch16_evidentiality/06_why_evidentiality_matters.md index d46a23d3..b0dda5a2 100644 --- a/manual/part4_grammar/ch16_evidentiality/06_why_evidentiality_matters.md +++ b/manual/part4_grammar/ch16_evidentiality/06_why_evidentiality_matters.md @@ -51,4 +51,4 @@ Regular use can become a practice of noticing how a claim arrived. No speech evi When provenance matters, it receives a particle; when it does not, it stays unmarked. In either case, the next person remains free to ask how you know. -That closes the particle system, and with it the grammar of the single clause. Chapter 9 called the inventory finite; you have now met all thirty-eight, each in its slot. What remains is what clauses do in company. Part V joins them, frames them, and sets them inside one another, and every sentence it teaches stands on the clause you can now build. +That closes the particle system, and with it the grammar of the single clause. Chapter 9 called the inventory finite; you have now met all thirty-nine, each in its slot. What remains is what clauses do in company. Part V joins them, frames them, and sets them inside one another, and every sentence it teaches stands on the clause you can now build. diff --git a/manual/part5_complex/ch20_relative_clauses/04_headless_relative_clauses.md b/manual/part5_complex/ch20_relative_clauses/04_headless_relative_clauses.md index 99370115..5b90917a 100644 --- a/manual/part5_complex/ch20_relative_clauses/04_headless_relative_clauses.md +++ b/manual/part5_complex/ch20_relative_clauses/04_headless_relative_clauses.md @@ -62,4 +62,4 @@ The headless phrase **whu ha kealo** is the subject, and **thia** is the identit A headed relative ends by naming its category. A headless relative declines to do so. Both keep **whu**, and both leave one role inside the description for the referent to fill. -And that is the last grammar lesson in the book. The sounds, the word shapes, the thirty-eight particles, the clause, and now the ways clauses join, turn, carry, and describe one another: all of it is behind you. Part VI is not more grammar. It is what speakers do with it: courtesy and consent, daily practice, faithful translation, a life lived partly in the language. Part I promised that this book would teach the instrument. You are holding it now; the rest is music. +And that is the last grammar lesson in the book. The sounds, the word shapes, the thirty-nine particles, the clause, and now the ways clauses join, turn, carry, and describe one another: all of it is behind you. Part VI is not more grammar. It is what speakers do with it: courtesy and consent, daily practice, faithful translation, a life lived partly in the language. Part I promised that this book would teach the instrument. You are holding it now; the rest is music. diff --git a/manual/part7_reference/lexicon/alphabetical.md b/manual/part7_reference/lexicon/alphabetical.md index 123fc75c..c571690e 100644 --- a/manual/part7_reference/lexicon/alphabetical.md +++ b/manual/part7_reference/lexicon/alphabetical.md @@ -5,7 +5,7 @@ # The Phi Lexicon: Alphabetical -*1306 words.* +*1307 words.* | Word | Gloss | IPA | Part of speech | |---|---|---|---| @@ -197,6 +197,7 @@ | `koshira` | grove | /ko̞.ˈʃi.rä/ | noun | | `kowanu` | governance | /ko̞.ˈwä.n̪u/ | noun | | `kowela` | council | /ko̞.ˈwe̞.lä/ | noun | +| `ku` | OBJ | /ˈku/ | particle | | `kua` | where | /ˈku.ä/ | interrogative | | `kuelo` | curious | /ku.ˈe̞.lo̞/ | adjective | | `kuewa` | strange | /ku.ˈe̞.wä/ | adjective | diff --git a/manual/part7_reference/lexicon/by_pos.md b/manual/part7_reference/lexicon/by_pos.md index 9c8171e8..af4df51e 100644 --- a/manual/part7_reference/lexicon/by_pos.md +++ b/manual/part7_reference/lexicon/by_pos.md @@ -912,7 +912,7 @@ | `ta` | one | | `wi` | two | -## particle (38) +## particle (39) | Word | Gloss | |---|---| @@ -924,6 +924,7 @@ | `ke` | INFER | | `ki` | PFV | | `ko` | FOC | +| `ku` | OBJ | | `la` | ATTEN | | `le` | HON.ROLE | | `li` | RESTR | diff --git a/project/content_vocabulary_coverage.md b/project/content_vocabulary_coverage.md index acbfb41e..25bb3989 100644 --- a/project/content_vocabulary_coverage.md +++ b/project/content_vocabulary_coverage.md @@ -1998,4 +1998,4 @@ The gate applies only to content vocabulary. Phi's closed grammar remains closed ## Resume point -The decision queue is closed. The register holds 76 implemented decisions and 131 compositional decisions. It also preserves 32 deferrals with return conditions, 44 source boundaries, and 4 deliberate refusals; no candidate is open or accepted but unfinished. All eight module paths and all 1,306 lexicon entries follow the target prose contract. Eighteen post-migration literary retrofits complete the shelf, including the cross-chapter arch repair, the manure correction in *News from Nowhere* chapter 5, and the grain-work additions for Gibran's *On Love*. All seven manual parts, the primer, and all nine pamphlets have completed their teaching-corpus passes. Continue the D102 text certification queue, then translate *News from Nowhere* chapter 7. A passage changes only when expanded vocabulary genuinely improves it; changing English lexicon prose alone is not a reason to reopen Phi text. +The decision queue is closed. The register holds 76 implemented decisions and 131 compositional decisions. It also preserves 32 deferrals with return conditions, 44 source boundaries, and 4 deliberate refusals; no candidate is open or accepted but unfinished. All eight module paths and all 1,307 lexicon entries follow the target prose contract. Eighteen post-migration literary retrofits complete the shelf, including the cross-chapter arch repair, the manure correction in *News from Nowhere* chapter 5, and the grain-work additions for Gibran's *On Love*. All seven manual parts, the primer, and all nine pamphlets have completed their teaching-corpus passes. Continue the D102 text certification queue, then translate *News from Nowhere* chapter 7. A passage changes only when expanded vocabulary genuinely improves it; changing English lexicon prose alone is not a reason to reopen Phi text. diff --git a/project/deferred_questions.md b/project/deferred_questions.md index 8b520e49..802cd146 100644 --- a/project/deferred_questions.md +++ b/project/deferred_questions.md @@ -20,6 +20,16 @@ Phi needs ordinary, respectful language for sexual and reproductive anatomy. Con The effort will inventory existing body, birth, consent, and Medical vocabulary, then decide which distinctions belong in base vocabulary, an optional module, a registered compound, or separately preserved source terminology. Anatomy cannot be assigned to gender by default, and one common body cannot become the standard against which others are treated as deviations. +### Optional subject and verb particles + +Status: Open design question, raised by the maintainer on 2026-11-24 after the object particle was proposed. Measured, not ruled. + +Phi's 2021 design had optional markers for subject, object, and verb (`si`, `na`, `te`, forms that now do other work). D134 restores an optional object marker as `ku`. The question is whether a subject particle and a verb particle should join it. + +The addendum to `archive/seams_study.md` holds the measurement. On the ambiguous sentences of the texts shelf, `ku` can settle 72 percent; a subject particle or a verb particle adds about three points each; `ku` with `mua` or `sui` before a bare time phrase reaches 89 percent, and all four devices 95 percent. A subject particle would show where a main clause begins after a dependent clause and let a lone phrase be asserted as subject. A verb particle would separate manner from object where no Slot 1 particle stands and show where a relative clause ends; it would amount to an optional present-tense particle beside `to` and `so`. + +What brings this back: the maintainer's ruling, or evidence from the phrase-reading ledger once `ku` is in use. + ### Adjacent repeated words Status: Open design question, raised by the maintainer on 2026-11-24 and deliberately left for a later discussion. @@ -32,6 +42,12 @@ Since this entry was written, D128 has licensed `miso` and `wiso` as possessors, ## Parked corpus and tooling work +### Teaching pages that do not yet know `ku` + +Status: Parked with the rest of the teaching pass, by the maintainer's instruction of 2026-11-24 that the structural questions come first. + +D134 added a thirty-ninth particle. Canon, the references, and the manual teach it. These pages still say thirty-eight or give a particle inventory without it: `short_road.md` (the section heading "Thirty-eight particles keep their places", which `scripts/build_site.py` also pins), `primer/30_this_one_only_this_one.md` and `primer/README.md`, the Three Slots pamphlet (`00_title.md`, the Slot 2 pages, and `12_appendix.md`), `pamphlets/README.md`, and `pamphlets/catalogue.json`. The primer teaches no lesson on `ku`, and the Pronouns and Relative Clauses pamphlets do not mention it. + ### Text lines awaiting the small-words sweep Status: Parked by the maintainer's instruction of 2026-11-24 that the language is settled first and the texts are swept once afterwards. diff --git a/project/development_log.md b/project/development_log.md index 9846bea5..91bb5e34 100644 --- a/project/development_log.md +++ b/project/development_log.md @@ -149,6 +149,7 @@ Implementation status, dependencies, optional evaluation work, and the next deve | D131 | Accepted | Coin base `ture` for again. | The reading test in D130 tried four existing devices for again (`we` before the verb, `newu` as manner, an ordinal with `shemu`, and `phirae shemu`) and none was read as again above about seventy percent; in the one source-blind chapter all three `we` lines came back as also. `ture` is an adjective: directly before the verb, inside the Slot 1 block, it is again, and before a noun it is one more of the same kind, which leaves `phirae` to mean different. The maintainer chose the form from three cleared candidates. It has no neighbour at edit distance 1 and none in the phonetic audit, is no English word, and shares its opening with `turema` (return) as audible kinship without a productive affix. Two syllables rest on the protocol's daily-round test. The gloss is `again` although the class is adjective, because a gloss line reading `repeated` would suggest many repetitions; this is a judgement call open to correction. `CV-SMALL-01` records the decision, and `CV-SMALL-07` defers other and else to the ordinary-vocabulary step. | | D132 | Accepted | Count the structural readings of Phi sentences. | Step 1 of the November assessment's answer to its central finding (section 4.3, recommendations 3 and 6): measure the unmarked phrase boundaries before deciding whether to mark them. `scripts/phi_readings.py` extends the sentence parser to count, for every clause, the ways the words before the verb divide into subject, adjuncts, object or complement, and manner, and the places each adverbial or relative clause could end; readings multiply across a sentence's clauses, and quoted sentences count separately. It reports a conservative count, in which only nouns, pronouns, and names end a phrase freely, and a full count that also lets an event or quality noun head a phrase with its own modifiers. `scripts/audit_phrase_readings.py` runs it over the lexicon's examples and the active Markdown and can show one sentence's divisions; `--openers` is a what-if that treats the listed Slot 2 words as always opening a phrase. The counter has no verb valency or meanings, so the figure is an upper bound on structural choice and not a comprehension rate, and it does not see the role of a single bare phrase or pronoun reference, which is where the two verified misreadings in certified text fall. First measurement on 2026-11-24: 42 percent of sentences in the translations have more than one division on the conservative count and 66 percent on the full count; the primer has 22 and 34 percent. Treating `ha`, `ra`, and `lo` as phrase openers lowers the translations' conservative figure to 35 percent. About one adverbial clause in five and one relative clause in five has more than one grammatical end. No language rule changes. | | D133 | Accepted | Count open roles and contested third persons, and track all three figures. | Two maintainer rulings on 2026-11-24 after the first reading count: measure roles and reference next, and track the figure. The reading count does not see the two kinds of misreading verified in certified text, a single bare phrase taken as object where subject was meant and a `shia` assigned to the wrong referent. `scripts/phi_roles.py` counts both exposures. An open role is a clause, or a relative clause, with one bare phrase and a verb that takes an object elsewhere; the lexicon has no valency field, so a verb counts as taking an object when the corpus shows it in the passive, with two bare phrases that cannot be read as one, or in a command over a noun phrase, in a clause with a single structural reading (154 verbs on first measurement). A contested third person is a `shia` or an unsaid subject while two or more third persons are live, a third person being the noun or name heading a clause-initial bare phrase within the last three sentences; clauses with two separate `shia` are counted too. First measurement: in the translations 5 percent of clauses have an open role (197, of which 124 are not `mia` or `thia`), a third of the 1,102 uses of `shia` are contested, and 38 clauses hold two `shia`, 25 of them in *The Velveteen Rabbit*; both verified misreadings fall in clauses the counts flag. `documents/validation/phrase_readings_baseline.txt` records one row per file for all three measures, CI checks it, and the working rules name the regeneration command. The figures use no meanings and are upper bounds on exposure; a corpus-derived valency is a stopgap for the valency field the assessment recommends. No language rule changes. | +| D134 | Accepted | Add the optional object particle `ku`, the first amendment to the closed particle inventory. | The maintainer chose seams as the first structural question and ruled on six points on 2026-11-24, agreeing with every recommendation in `archive/seams_study.md`. Under the Grammar Amendment Boundary the defect is recorded as follows. Minimal example: `phao lopia shelu theo` is the parent reads the child's book and the parent's child reads the book, and nothing in the grammar chooses. Measured extent: 43 percent of sentences on the texts shelf divide into phrases in more than one way, and 1,328 of the 1,684 ambiguous clauses turn on where the object begins. Connected use: two source-blind readers given twelve reversible sentences agreed on eleven first readings at a mean confidence of 63 percent, cut the same three-noun shape in different places by plausibility, and took opposite roles on a line of the certified *Velveteen Rabbit*. Existing constructions tested: a possessor moved into a `whu ... phelu` clause, an explicit subject, a Slot 1 particle, and phrasing; none settles a lone phrase's role, the Slot 1 repair is absent from the plain present, and pauses cannot carry meaning. Rulings: one optional Slot 2 particle opens the direct object phrase (option B, over a roleless phrase opener, a possessive linker, and `ha`); its form is `ku`, chosen over the seven other free plain forms for having the fewest rivals in its position; it marks the direct object only, never a complement of `nai` or `kelu`, never in a passive, never a preposition's object, and in a causative the one made to act stands bare before it; it stands at the outer edge of its phrase, before `we` and `li`, once per clause; nothing is added for a bare time phrase after a subject or for open clause ends, where `mua` or `sui` and a pronoun or name are the taught repairs; and no text is required to use it. With `ku` two further readers read all eleven marked sentences as marked, eight of them against the unmarked default, at 78 percent confidence. Simulation: the particle can settle 72 percent of the ambiguous sentences completely and every open role. Interaction with the inventory: Slot 2, widest position, so the nest is `ku` > `we`/`li` > `ha`/`ra` > quantity > `ko` > degree; plain CV as the charter requires; `ko` is its nearest same-position neighbour. One consequence is flagged for review: with no Slot 1 particle after it, a word directly before the verb belongs to the marked object, so manner beside a marked object needs a Slot 1 particle. Implemented in canon (thirty-nine particles), the entry, the particle reference and finder, the manual's sentence and Slot 2 pages with the count corrected in five manual pages, the parser (`PHS118`, `PHS119`, and the Slot 2 order), the reading and role counters, and regression tests. No text or example was migrated, because no existing construction is replaced. The primer, the pamphlets, and the Short Road still count thirty-eight particles and do not teach `ku`; they are listed in `project/deferred_questions.md` for the teaching pass the maintainer has deferred. He also asked whether optional subject and verb particles should return, as in the 2021 design (`si`, `na`, `te`); the measured answer, about three points each beyond `ku`, is in the study's addendum, and the question is not ruled. | ## Completed discretionary lexical migrations diff --git a/project/handoff/README.md b/project/handoff/README.md index 8d6e25cf..1e121b65 100644 --- a/project/handoff/README.md +++ b/project/handoff/README.md @@ -20,7 +20,7 @@ Do not use `archive/` as current evidence. It preserves history, including appro ## Where the work stopped -The vocabulary migration is complete. All 1,306 lexicon entries are target-shaped, all eight optional modules have complete learning paths, SEM-09D is closed, and the decision register has no open or accepted-but-unimplemented item. The book is complete, the manual and primer are current, the fourteen-pamphlet shelf has complete practice coverage, the renderer-led identities for the principal shelves are complete, and Kia, the Short Road, and the Phi Book contents page have their finished entrance treatments. Translation certification is now visible on the texts shelf: ten of twenty translation documents carry the register-driven mark, while pending work remains unmarked. Tengwar is Phi's sole alternative writing system; the retired native-glyph studies remain under `archive/writing_systems/`. +The vocabulary migration is complete. All 1,307 lexicon entries are target-shaped, all eight optional modules have complete learning paths, SEM-09D is closed, and the decision register has no open or accepted-but-unimplemented item. The book is complete, the manual and primer are current, the fourteen-pamphlet shelf has complete practice coverage, the renderer-led identities for the principal shelves are complete, and Kia, the Short Road, and the Phi Book contents page have their finished entrance treatments. Translation certification is now visible on the texts shelf: ten of twenty translation documents carry the register-driven mark, while pending work remains unmarked. Tengwar is Phi's sole alternative writing system; the retired native-glyph studies remain under `archive/writing_systems/`. The full-sentence parser is established as a strict grammar gate beside the main example validator. Its adopted repairs include universal modifier-first structure, one content gap per clause, the fixed reason position of `misa`, the required `pha ... pho` boundary around every embedded content question, and rejection of doubled quantity-tier marking such as `lo` plus a numeral or quantifier. The parser's default asserted-document set passes 3,313 complete examples with no error. A full `--docs` run parses 5,532 examples and retains two pre-existing diagnostics in `documents/evaluation/narrative_test_corpus.md`: PHS103 at line 46 and PHS115 at line 212. Treat those as separate parser-versus-corpus triage; do not rewrite the evaluation corpus merely to silence them. diff --git a/project/handoff/current_state.md b/project/handoff/current_state.md index 881d63ae..2d2a1861 100644 --- a/project/handoff/current_state.md +++ b/project/handoff/current_state.md @@ -52,16 +52,16 @@ Kia opens the separate entrance-page sequence. Its first greeting sits in an ope | Inventory | Total | Target | Legacy | |---|---:|---:|---:| -| Entire lexicon | 1,306 | 1,306 | 0 | +| Entire lexicon | 1,307 | 1,307 | 0 | | Content vocabulary | 1,172 | 1,172 | 0 | | Base content vocabulary | 895 | 895 | 0 | | Optional-module content vocabulary | 277 | 277 | 0 | -| Function vocabulary | 114 | 114 | 0 | +| Function vocabulary | 115 | 115 | 0 | | Interjections | 20 | 20 | 0 | There are no partial or dual entries. A target entry has both `articulatory_notes` and structured `examples` and has neither legacy `concept` nor `grammatical_notes`. The committed evidence is [`documents/validation/vocabulary_prose_coverage.json`](../../documents/validation/vocabulary_prose_coverage.json). -The latest base addition is D131's `ture` again, coined on the maintainer's ruling after the November 2026 assessment found no word for it; D130 records the small-word and clause-relation rulings it belongs to, including `tei` over a clause. The latest source-led vocabulary addition is D100's Ecological `lomathu` manure, prompted by chapter 5's use of animal faeces for material gathered for the soil. The same decision moves `tomewu` urine and `mokathi` faeces from base study into Medical and Bodily Care. D099's Work `toreku` arch remains the previous source-led addition, and D077's `ratenu` steep and `salenu` unclothed remain the latest base additions. D078 through D084 changed literary method and completed two post-conversion sweeps without adding vocabulary. D085 through D096 translated and fidelity-swept the first six *News from Nowhere* chapters without adding a root, module membership, registered compound, or grammar. D052 remains the last legacy-prose batch and brought the eighth learning path to zero legacy prose. D044 remains the base-first boundary. Do not reopen completed entries merely to make their English prose different; reopen one only for a real semantic, factual, voice, or corpus problem. +D134 adds the optional object particle `ku`, the first amendment to the closed particle inventory, which now holds thirty-nine. The latest base addition is D131's `ture` again, coined on the maintainer's ruling after the November 2026 assessment found no word for it; D130 records the small-word and clause-relation rulings it belongs to, including `tei` over a clause. The latest source-led vocabulary addition is D100's Ecological `lomathu` manure, prompted by chapter 5's use of animal faeces for material gathered for the soil. The same decision moves `tomewu` urine and `mokathi` faeces from base study into Medical and Bodily Care. D099's Work `toreku` arch remains the previous source-led addition, and D077's `ratenu` steep and `salenu` unclothed remain the latest base additions. D078 through D084 changed literary method and completed two post-conversion sweeps without adding vocabulary. D085 through D096 translated and fidelity-swept the first six *News from Nowhere* chapters without adding a root, module membership, registered compound, or grammar. D052 remains the last legacy-prose batch and brought the eighth learning path to zero legacy prose. D044 remains the base-first boundary. Do not reopen completed entries merely to make their English prose different; reopen one only for a real semantic, factual, voice, or corpus problem. ## Decision register @@ -233,7 +233,7 @@ The live entries are: | Entrance and index pages | Complete | Kia, the Short Road, and the Phi Book contents page are finished without source decoration. Kia has its doorway masthead, two Tengwar greetings, six numbered encounters, and seven broad destination links. The Short Road has a twelve-stop map, joined waypoints, thirteen interlinear figures, and a final invitation in both hands. The book contents page maps the argument from boatman to door. Four movements hold its fourteen chapters, and the bibliography stays apart. Strict shape checks guard all three renderings, including exact agreement between the README's reading order and the published files. | | Legacy vocabulary prose audit | Complete | D044 completed the base queue, D045 through D052 completed all eight module learning paths, and SEM-09D completed the literary shelf, the drafted book, the manual, the primer, the nine pamphlets then current, and the current documents. Reopen a passage only for a real semantic, factual, voice, or corpus problem. | | Lexical relations between content words | Parked | The explorer or project needs curated related-word navigation strongly enough to add and maintain a schema field. | -| Tengwar renderer verification | Parked, with a live review surface | The lexicon explorer now renders all 1,306 headwords in Tengwar, and the first finding is recorded and deferred: the a tehta sits slightly low over the h tengwa, to be adjusted through the placement tweaks in `tengwar/glyphs.json` when the maintainer reopens glyph tuning. | +| Tengwar renderer verification | Parked, with a live review surface | The lexicon explorer now renders all 1,307 headwords in Tengwar, and the first finding is recorded and deferred: the a tehta sits slightly low over the h tengwa, to be adjusted through the placement tweaks in `tengwar/glyphs.json` when the maintainer reopens glyph tuning. | | Solarpunk community engagement | Open strategic question | Daniel is ready to offer Phi outside its repository and decide what a healthy invitation looks like. | Speech evidence, outside learner evidence, community governance, and a maintained print publication pipeline remain evidence-gated or deferred in the roadmap. The one-off book PDF does not close PUB-03 or create PUB-04 review evidence. Do not mark an evidence item complete because tools or materials exist, and do not invent participants, observations, or adoption. diff --git a/scripts/phi_readings.py b/scripts/phi_readings.py index cb38e956..2581df7b 100644 --- a/scripts/phi_readings.py +++ b/scripts/phi_readings.py @@ -54,6 +54,7 @@ PREDICATIVE_VERBS, PhiParser, SLOT2_DEGREE, + SLOT2_OBJECT, SLOT2_OUTER, SLOT2_WORDS, SyntaxNode, @@ -117,6 +118,8 @@ class ClauseReadings: bare_heads: tuple[tuple[str, str], ...] = () # Third-person pronouns standing as separate words in the clause. third_persons: int = 0 + # Whether the object particle opens the object, which settles its role. + object_marked: bool = False @dataclass @@ -408,6 +411,7 @@ def _count_core( bare_heads: tuple[tuple[str, str], ...] | None = None slot1: tuple[str, ...] = () third_persons = 0 + object_marked = False mark = self._mark() for units, inner_c, inner_w in self._unit_sequences(start, predicate_index): if inner_w == 0: @@ -444,6 +448,9 @@ def _count_core( if len(shown) < MAX_SHOWN: shown.append(self._render(pre, division)) slot1 = tuple(u.word for u in units if u.cls == "S1") + object_marked = object_marked or any( + u.cls == "S2" and u.word in SLOT2_OBJECT for u in pre + ) third_persons = max( third_persons, sum(1 for u in pre if u.cls == "PRON" and u.word == "shia"), @@ -483,6 +490,7 @@ def _count_core( first_bare=first_bare, bare_heads=bare_heads or (), third_persons=third_persons, + object_marked=object_marked, ) ) return cons_total, wide_total @@ -686,9 +694,23 @@ def _divisions( ): position -= 1 tails.append(position) + # The object particle settles where the object begins: the phrase it + # opens is the last one, it is the object, and it runs to the verb + # group, so no manner tail is split off after it. + marks = [ + position + for position, unit in enumerate(pre) + if unit.cls == "S2" and unit.word in SLOT2_OBJECT + ] for tail in sorted(set(tails)): + if marks and tail != len(pre): + continue body = pre[:tail] for boundaries, types in self._segmentations(body, allow_gap, full): + if marks: + start_of_last = boundaries[-2] if len(boundaries) > 1 else 0 + if start_of_last != marks[0] or types[-1] != "BARE": + continue if self._template_ok(body, types, has_ka, predicative, relaxed): results.append((boundaries, tail, types)) return results diff --git a/scripts/phi_roles.py b/scripts/phi_roles.py index 9b764ef5..f0dcad55 100644 --- a/scripts/phi_roles.py +++ b/scripts/phi_roles.py @@ -19,6 +19,7 @@ A verb counts as taking an object when the corpus shows it at least once +* with its object opened by ``ku`` (``phao ku shelu theo``), * in the passive (``shelu se theo``), * with two bare phrases that cannot be read as one, each headed by a noun, pronoun, name, or complement frame (``mia thia nila``, @@ -60,7 +61,7 @@ def object_taking_verbs(sentences: Iterable[SentenceReadings]) -> Counter[str]: verb = clause.verb if not verb or verb in PREDICATIVE_VERBS or "ka" in clause.slot1: continue - if "se" in clause.slot1: + if "se" in clause.slot1 or clause.object_marked: seen[verb] += 1 continue if clause.gapped or clause.full != 1: @@ -89,6 +90,8 @@ def open_role(clause: ClauseReadings, object_verbs: Counter[str] | set[str]) -> return None if "se" in clause.slot1 or "ka" in clause.slot1: return None + if clause.object_marked: + return None if clause.bare_counts != (1,): return None if not clause.bare_heads or clause.bare_heads[0][0] not in ARGUMENT_HEADS: diff --git a/scripts/phi_sentence_validator.py b/scripts/phi_sentence_validator.py index df846e0c..f7167944 100644 --- a/scripts/phi_sentence_validator.py +++ b/scripts/phi_sentence_validator.py @@ -60,8 +60,12 @@ SLOT2_FOCUS = frozenset({"ko"}) SLOT2_DEGREE = frozenset({"ru", "la", "pe", "wo", "mo"}) SLOT2_NAME = frozenset({"ne", "sa", "ni", "le"}) +# The optional object particle opens the direct object phrase and stands at +# its outermost edge, before we or li and before any possessor. +SLOT2_OBJECT = frozenset({"ku"}) SLOT2_WORDS = ( - SLOT2_OUTER + SLOT2_OBJECT + | SLOT2_OUTER | SLOT2_DEIXIS | SLOT2_QUANTITY | SLOT2_FOCUS @@ -70,6 +74,7 @@ | {"nu"} ) SLOT2_RANK = { + **{word: -1 for word in SLOT2_OBJECT}, **{word: 0 for word in SLOT2_OUTER}, **{word: 1 for word in SLOT2_DEIXIS}, "lo": 2, @@ -799,6 +804,7 @@ def _parse_core_clause( nested, ) self._validate_slot2_and_quantity(start, end, nested) + self._validate_object_particle(start, predicate_index, slot1_indices, nested) self._validate_prepositions(start, end, predicate_index, slot1_indices, nested, allow_gap) self._validate_predicative_order(start, predicate_index, slot1_indices, nested) @@ -1241,6 +1247,89 @@ def _validate_predicate_suffix( adjective_after[0], ) + def _validate_object_particle( + self, + start: int, + predicate_index: int, + slot1_indices: Sequence[int], + nested: set[int], + ) -> None: + """ku opens the direct object, and the object runs to the verb group.""" + marks = [ + index + for index in range(start, predicate_index) + if index not in nested + and index not in self.name_atoms + and self._word(index) in SLOT2_OBJECT + ] + if not marks: + return + if len(marks) > 1: + self._error( + "PHS118", + "a clause has one direct object, so ku stands once", + marks[1], + ) + mark = marks[0] + boundary = slot1_indices[0] if slot1_indices else predicate_index + predicate = self._word(predicate_index) + if predicate in PREDICATIVE_VERBS: + self._error( + "PHS119", + f"'{predicate}' takes a complement, not an object; ku does not stand before it", + mark, + ) + return + if any(self._word(index) == "se" for index in slot1_indices): + self._error( + "PHS119", + "a passive clause has no direct object for ku to open", + mark, + ) + return + if mark >= boundary: + self._error( + "PHS118", + "ku opens the object phrase, which stands before the Slot 1 stack", + mark, + ) + return + previous = mark - 1 + while previous >= start and previous in nested: + previous -= 1 + if previous >= start and self._word(previous) in self.lexicon.prepositions: + self._error( + "PHS118", + "ku opens the direct object, never the object of a preposition", + mark, + ) + object_words = [ + index + for index in range(mark + 1, boundary) + if index not in nested and self._word(index) != "." + ] + if not any( + index in self.name_atoms or self.lexicon.is_nominal(self._word(index)) + for index in object_words + ) and not any(mark < opener < boundary for opener in self.frame_close): + self._error("PHS118", "ku needs an object phrase after it", mark) + for index in object_words: + word = self._word(index) + if index in self.name_atoms: + continue + if ( + word in self.lexicon.prepositions + or word in TEMPORAL_NP_RELATORS + or word in {"misa", "weno", "kua", "thela"} + ): + self._error( + "PHS118", + f"everything from ku to the verb is the object; the adjunct opened by " + f"'{word}' stands before ku", + index, + ) + break + def _validate_predicative_order( self, start: int, @@ -1349,7 +1438,7 @@ def _validate_slot2_run(self, run: Sequence[int], target: int | None) -> None: if current[0] < previous[0]: self._error( "PHS111", - "Slot 2 nesting is we/li > ha/ra > quantity > ko > degree > target", + "Slot 2 nesting is ku > we/li > ha/ra > quantity > ko > degree > target", current[2], ) @@ -1669,6 +1758,12 @@ def _advise_manner( # A word that marks a noun phrase settles the reading: the adjective is # a quality noun, so there is nothing to review. + if any( + self._word(earlier) in SLOT2_OBJECT + for earlier in range(start, index) + if earlier not in nested and earlier not in self.name_atoms + ): + return None marker_index = index - 1 while ( marker_index >= start diff --git a/scripts/test_phi_readings.py b/scripts/test_phi_readings.py index 01f2966b..b8bd4c4f 100644 --- a/scripts/test_phi_readings.py +++ b/scripts/test_phi_readings.py @@ -94,6 +94,24 @@ def test_opener_what_if_closes_the_seam_before_a_slot_two_word(self): strict = ReadingCounter(openers=frozenset({"ha", "ra", "lo"})) self.assertEqual(1, strict.analyse("phao ha shelu theo.").conservative) + def test_the_object_particle_settles_where_the_object_begins(self): + for text in ( + "phao ku lopia shelu theo.", + "phao lopia ku shelu theo.", + "shia ku welao thumela.", + "mia mua womu ku shelu theo.", + "mia ku nohero to helui.", + ): + with self.subTest(text=text): + self.assertEqual((1, 1), self.counts(text)) + + def test_a_causee_before_a_marked_object_may_still_join_the_subject(self): + result = self.counter.analyse("phao lopia ku shelu ka theo.") + self.assertEqual( + ["[phao] [lopia] [ku shelu]", "[phao lopia] [ku shelu]"], + result.clauses[0].divisions, + ) + def test_a_sentence_that_does_not_parse_has_no_count(self): self.assertIsNone(self.counter.analyse("mia shua mia.")) diff --git a/scripts/test_phi_roles.py b/scripts/test_phi_roles.py index 70263ac0..1250b4a6 100644 --- a/scripts/test_phi_roles.py +++ b/scripts/test_phi_roles.py @@ -53,6 +53,13 @@ def test_roles_are_settled_by_two_phrases_passive_command_or_verb(self): (clause,) = self.sentences(text)[0].clauses self.assertIsNone(open_role(clause, verbs)) + def test_the_object_particle_settles_a_role_and_witnesses_the_verb(self): + (clause,) = self.sentences("ku lopia to nila.")[0].clauses + self.assertIsNone(open_role(clause, {"nila"})) + clauses = self.sentences("whu ku mia nila miona shua.")[0].clauses + self.assertNotIn("relative", [open_role(clause, {"nila"}) for clause in clauses]) + self.assertEqual({"somela"}, set(object_taking_verbs(self.sentences("ku lopia somela.")))) + def test_a_relative_clause_with_one_phrase_leaves_its_head_open(self): verbs = {"nila"} clauses = self.sentences("whu mia nila miona shua.")[0].clauses diff --git a/scripts/test_sentence_validator.py b/scripts/test_sentence_validator.py index 68007bdd..9d487115 100644 --- a/scripts/test_sentence_validator.py +++ b/scripts/test_sentence_validator.py @@ -589,6 +589,37 @@ def test_past_condition_advisory(self): with self.subTest(text=text): self.assertAdvisories(text, []) + def test_object_particle_opens_the_object_phrase(self): + for text in ( + "phao ku lopia shelu theo.", + "phao lopia ku shelu theo.", + "ku lopia to nila.", + "whu ku mia nila miona shua.", + "phao lopia ku shelu ka theo.", + "mia ku we lopia shelu to theo.", + "shia ku welao thumela.", + "mia wei melu ku shelu to loa.", + "mia ku tha shia shua tho sano.", + ): + with self.subTest(text=text): + self.assertValid(text) + for text, code in ( + ("mia we ku shelu theo.", "PHS111"), + ("mia ku shelu wei melu to loa.", "PHS118"), + ("mia mua ku womu nulae.", "PHS118"), + ("mia ku shelu ku noru phelu.", "PHS118"), + ("mia ku to nila.", "PHS118"), + ("mia to ku shelu theo.", "PHS118"), + ("mia ku lohau nai.", "PHS119"), + ("ku shelu se theo.", "PHS119"), + ): + with self.subTest(text=text): + self.assertInvalid(text, code) + + def test_a_marked_object_is_not_a_manner_candidate(self): + self.assertAdvisories("shia welao to thumela.", [("PHL001", "welao")]) + self.assertAdvisories("shia ku welao to thumela.", []) + def test_also_and_only_stand_outside_the_slot_one_block(self): for text in ( "shia we to pa nulae.", diff --git a/site/manual_editorial.json b/site/manual_editorial.json index c0efb2d4..7bbf0df3 100644 --- a/site/manual_editorial.json +++ b/site/manual_editorial.json @@ -256,7 +256,7 @@ "variant": "standard" }, "manual/part4_grammar/ch09_particle_system/05_slot_2_word_level.md": { - "shape": "h1,2,2,2,2,2,2,2,2,2,2;t-;f-;q-;u3;o-;r0", + "shape": "h1,2,2,2,2,2,2,2,2,2,2,2;t-;f-;q-;u3;o-;r0", "variant": "standard" }, "manual/part4_grammar/ch09_particle_system/06_combining_particles.md": { @@ -276,7 +276,7 @@ "variant": "standard" }, "manual/part4_grammar/ch10_mindful_sentence/04_building_sentences.md": { - "shape": "h1,2,2,2,2,2;t4x2;f-;q-;u-;o-;r0", + "shape": "h1,2,2,2,2,2,2;t4x2;f-;q-;u-;o-;r0", "variant": "standard" }, "manual/part4_grammar/ch10_mindful_sentence/05_questions_requests_conditions.md": { @@ -630,7 +630,7 @@ "variant": "module_guide" }, "manual/appendices/appendix_a_glossary.md": { - "shape": "h1,2;t4x70;f-;q-;u-;o-;r0", + "shape": "h1,2;t4x71;f-;q-;u-;o-;r0", "variant": "glossary", "definition_count": 27 }, diff --git a/vocabulary/function/particle/obj.json b/vocabulary/function/particle/obj.json new file mode 100644 index 00000000..af682b3d --- /dev/null +++ b/vocabulary/function/particle/obj.json @@ -0,0 +1,39 @@ +{ + "word": "ku", + "gloss": "OBJ", + "ipa": "/ˈku/", + "syllables": [ + "ku" + ], + "slot": 2, + "pos": "particle", + "search_terms": [ + "object marker", + "direct object", + "accusative" + ], + "description": "In 'phao lopia shelu theo' three nouns stand in a row, and nothing says where the reader ends and the thing read begins. Object 'ku' says it: the direct object starts at 'ku' and runs to the verb's own particles. It is optional and a clause without it is complete, so a speaker reaches for it when the edge or the role would otherwise be a guess. 'ko' (FOC) points at a word for contrast and leaves its role alone.", + "articulatory_notes": "Raise the back of the tongue to the soft palate for voiceless 'k', release it, and round the lips closely for high back 'u'. As a single syllable it takes full stress.", + "usage_notes": "'ku' stands at the outer edge of the object phrase, before 'we' (ALSO) or 'li' (RESTR) and before any possessor. Everything between it and the Slot 1 particles, or the verb when there are none, is the object, so adjuncts stand before 'ku' and a manner word after it needs a Slot 1 particle in front. Before a clause's only phrase it marks an object whose subject is unsaid, and inside a relative clause it works the same way. In a causative the one made to act stands bare before it: 'phao lopia ku shelu ka theo'. A complement of 'nai' (be) or 'kelu' (become) is not an object and never takes it, and a passive clause has no object to mark.", + "examples": [ + { + "phi": "phao ku lopia shelu theo.", + "translation": "The parent reads the child's book." + }, + { + "phi": "phao lopia ku shelu theo.", + "translation": "The parent's child reads the book." + }, + { + "phi": "lohau mua thepalu to nai. ku lopia to nila.", + "translation": "The dog was in the garden. It saw the child." + }, + { + "phi": "whu ku mia nila miona shua.", + "translation": "The person who sees me is coming." + } + ], + "pillars": { + "peace-linguistics-practices": "When an account of who acted on whom will be relied on, 'ku' lets the speaker fix the roles in the sentence itself instead of leaving them to a hearer's guess." + } +}