Marimo notebooks
marimo notebooks
greek_syntaxer_workflow.py and greek_syntaxer_ctsdata.py take different approaches to segmentation, matching how each notebook’s input arrives:
greek_syntaxer_workflow.py: enter a base URN, passage reference, and text to analyze as one form (nothing happens until you click Analyze, rather than on every keystroke). Submitting it callsanalyze_passage()directly, which segments the text into sentences internally and runs fullSyntaxAnalysis(viaanalyze_with_retry()) on each one in turn, then shows the discussion, Mermaid diagram, and highlighted/indented HTML for the whole passage. There’s no separate sentence-selection step here – the text you type is manually entered, so it’s up to you to submit it one sentence at a time if you want to control segmentation boundaries yourself. There’s acex/txtextension choice (defaultcex) plus a Download analysis button that hands the current analysis (built withserialize_analyses(), see “Saving and loading analyses” above) to the browser’s own download mechanism – no folder path to type, at the cost of the browser (not the notebook) deciding where the file actually lands. The filename defaults to the submitted citation (base URN + passage) with the chosen extension.greek_syntaxer_ctsdata.py: the input comes from a#!ctsdatasource file (see “Reading passages from a delimited-text source file” above) instead of being typed in by hand, so segmentation and analysis stay two distinct steps – segmentation is free (no LM call at all, seesegmentation.py), so you can see every sentence it finds, and choose which ones are actually worth the cost of a full analysis, before spending anything onSyntaxAnalysis. Browse for the file and pick one or more passages from the Passage(s) multiselect menu (labelled<citation>: <first few words>…), then click OK to segment the selection – every selected passage becomes its ownCitedTextsource and is segmented together viasegment_sources(), always in the file’s own order regardless of the order they were selected in, since consecutive sources can share a sentence across their boundary. A Sentence(s) to analyze menu then lists every sentence segmentation found across all the selected passages (labelled<n>. <citation>: <first eight words>…, since sentences here can come from different citations); pick some and click Analyze selected sentences to runSyntaxAnalysison just those. A Disable LM cache checkbox next to that button forces the click to bypass DSPy’s own LM response cache (analyze_with_retry()’sdisable_cacheparameter — see “Estimating and enforcing amax_tokensbudget” above), so re-clicking Analyze on the exact same sentence(s) after changing the configured model, the prompt, or the schema always reaches the LM again instead of silently replaying the previous response; leave it unchecked for ordinary browsing, where the cache saves real cost and latency. Everything downstream (Mermaid diagram, highlighted/indented HTML, save-to-file) covers only the analyzed subset. Both this notebook andgreek_syntaxer_workflow.pyalso have See list of tokens/See cost/See prompts checkboxes, each toggling a hidden display of the raw token list, the last LM call’s own reported cost, ordspy.inspect_history()’s prompt/response transcript.greek_syntaxer_review.py: no LM access at all – browse for a file previously written bywrite_analyses()(see “Saving and loading analyses” above), pick a sentence from the menu that appears (labelled<n>. <citation>: <first six words>…, viasplit_analysis_by_sentence()), and it displays that one sentence’s own Mermaid diagram, plain (uncolored) text, verbal-unit-colored HTML, and colored-and-indented-by-subordination-depth HTML – reconstructed entirely from the saved file, which is already complete, so there’s no separate segment-then-analyze step here the way there is in the other two notebooks. A slider above the indented view caps it to that sentence’s ownmax_subordination_depth()or shallower, the same depth-cap control the other two notebooks offer, except here it only appears once a sentence with at least one token has actually been picked. A Download Mermaid diagram (.mmd) button next to the diagram hands that sentence’s raw Mermaid source (the same textmo.mermaid()renders) to the browser’s own download mechanism. Useful for reviewing or presenting an already-completed analysis (e.g. one harvested intoGOLD_EXAMPLES) without spending an LM call, or working at all when the LM is unreachable.
All three notebooks default their sample text/URN to syntax_model.md’s own worked examples – most of which are drawn from Lysias 1, On the Murder of Eratosthenes (urn:cts:greekLit:tlg0540.tlg001.perseus-grc2:) – as a placeholder; point urnbase at your own corpus. Run any of them with marimo edit marimo/greek_syntaxer_workflow.py (requires pip install marimo --break-system-packages, or pip install -e ".[dev]", see TESTING.md) from the repo root, and a .env with API_BASE/MODEL/API_KEY set (see DEVELOPMENT.md), except greek_syntaxer_review.py, which needs no LM access at all.