Repository navigation
refactor(Parsing): one sentence at a time, terms, and exercise complex-det - #62
Merged
Merged
Conversation
The full stop is no longer a CONJ: the grammar parses one sentence at a time, and splitting a text into sentences is left to an outer segmentation step. `and` keeps CONJ and joins clauses within a sentence (#57). Categories are shown with PHON instead of ORTH, the name of the field phon, and "AVM" is used throughout instead of "matriz". The terms sentença, oração and sintagma replace "frase", recorded in the term list of STYLE-WRITING.md, and are introduced in a terse cue at the start of ParseTrees, citing Caseli and Nunes (2024). AI usage: Claude (Anthropic) drafted the changes; the author reviewed and approved them.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the sentence-level parsing and terminology updates.
No open issues 🎉
What changed in this PR
This PR clarifies sentence-level parsing in the Lean textbook and standardizes its linguistic terminology. It removes the full stop’s conjunction entry, leaving sentence segmentation to an external step as discussed in #57.
Changes:
- Restricts parsing input to one sentence while retaining
andas a clause conjunction. - Replaces
ORTHwithPHONin AVM displays and aligns Portuguese syntax terms. - Expands explanatory prose for features, the lexicon, and category parsers, and adds a parser example.
| File | Description |
|---|---|
| STYLE-WRITING.md | Records the preferred translations for sentence, clause, and phrase. |
| DEVIATIONS.md | Documents sentence-level scope and the PHON display convention. |
| CSwL/Parsing/Recognition.lean | Uses “sentenças” for grammar-generated sentences. |
| CSwL/Parsing/ParseTrees.lean | Introduces syntax terms and explains the reuse of S for clauses. |
| CSwL/Parsing/Lexicon.lean | Removes the full-stop entry and expands lexical-processing explanations. |
| CSwL/Parsing/Features.lean | Uses PHON in category displays and explains feature agreement. |
| CSwL/Parsing/Combinators.lean | Adds a parseAs noun-phrase example. |
| CSwL/Parsing/Categories.lean | Updates tree displays to PHON and expands parser explanations. |
| CSwL/ModelChecking.lean | Aligns sentence terminology in prose. |
| CSwL/Logic/FOL.lean | Uses “sentença” in the introductory example. |
| CSwL/Composition/Quantification.lean | Aligns sentence terminology in quantification prose. |
| Bib.lean | Adds the Caseli and Nunes reference for syntax terminology. |
Review effort: Balanced
The lexicon has CONJ, COND, THEN and REL entries, but the parser of Categories has only S → NP VP. The terse cues and the full text say so, and a prs example shows that a coordination of clauses has no parse. AI usage: Claude (Anthropic) drafted the changes; the author reviewed and approved them.
Explain the case of one piece in splitN. In Lexicon, explain once, next to lexer, that the input is a single sentence, and derive from preproc why the full stop has no lexicon entry; say that scan inserts a space only before punctuation. Merge the paragraph on the types of Parser into the one that presents StateT. AI usage: Claude (Anthropic) drafted the changes; the author reviewed and approved them.
The opening of the chapter summarizes its path, from parse trees and the palindrome grammar to parsers over categories with features and AVMs. In ParseTrees, the full text presents sentença, oração, sintagma and constituinte, and S as the label of both.
The plan repeated what DEVIATIONS.md records for 9.1–9.6, and what issue #49 tracks for 9.7–9.8. AI usage: Claude (Anthropic) drafted the change; the author approved it.
This was referenced Nov 19, 2026
prs is now parseWith lexicon parseSent: parseWith takes the lexicon and the parser, since the parsers of the rules never consult the lexicon. With it, exercise complex-det (CSwFP 9.10) extends the lexicon with the missing determiner functions and numerals and adds the rule DET → DF NUM, tested on noun phrases. AI usage: Claude (Anthropic) drafted the changes; the author reviewed and approved them.
AI usage: Claude (Anthropic) drafted the change; the author approved it.
…opening Name the section of the parser of categories instead of "the next section". In the further reading, GF is described as a functional language specialized in writing grammars: it is not a language like Haskell, only functional like it. In the opening, the lexical analysis prepares the input sentence for the lookup in the lexicon. AI usage: Claude (Anthropic) drafted the changes; the author reviewed and approved them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Terminology, scope and consistency fixes in Parsing, from a review of 9.1–9.6, plus exercise 9.10.
CONJand parses a text as a conjunction of sentences).lexertakes one sentence; splitting a text into sentences is left to an outer segmentation step that the book does not define, and the full stop has no entry becausepreprocdrops the only one.andkeepsCONJand joins clauses within a sentence. The rename ofTXTtoSfor 9.7 is recorded in Parsing: texts parsed as conjunctions of sentences (CSwFP/9.5, 9.7) #57 and Parsing: write the sections from CSwFP/9.7–9.8 #49.CONJ,COND,THENandRELentries, but the parser has onlyS → NP VP; the cues and the full text say so, and aprsexample shows that a coordination of clauses has no parse.phonofCat, and "AVM" throughout instead of the unexplained "matriz".STYLE-WRITING.md. They are introduced at the start ofParseTrees(terse cues and full text), citing Caseli and Nunes (2024), new inBib.lean.Sis the start symbol, for sentence, and is reused for clauses.parseWithand exercisecomplex-det(CSwFP 9.10).prsis nowparseWith lexicon parseSent: the parsers of the rules never consult the lexicon, so only this last step takes it. The exercise extends the lexicon with the missing determiner functions and with digit strings asNUM, addsDET → DF NUM, and is tested on noun phrases (Decide where the remaining CSwFP exercises go #53).splitN,scaninserting a space only before punctuation, the types ofParsermerged into the paragraph onStateT, sections named by{ref}instead of "the next section", and GF described as a functional language for writing grammars.DEVIATIONS.mdrecords 9.1–9.6, and Parsing: write the sections from CSwFP/9.7–9.8 #49 tracks 9.7–9.8.Closes #57; what is left of it for 9.7 is tracked in #49.
Related:
NP.IntroCSterse first; it still uses "frase".🤖 Generated with Claude Code