API Reference
compare
normpare
normpare — compare two editions of a technical standard.
Public facade of the package: compare() builds a configuration and runs the full
pipeline in one call.
compare(old, new, out_dir, *, provider='anthropic', model=None, language='de', use_llm=True, batch=False, embed_fallback=False, embed_model=None, config=None)
Compare two versions of a standard and write all outputs to out_dir.
One-call facade: builds a :class:~normpare.config.Config and runs the
:class:~normpare.pipeline.Pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old
|
str | Path
|
Path to the old version of the standard (PDF or DOCX). |
required |
new
|
str | Path
|
Path to the new version of the standard (PDF or DOCX). |
required |
out_dir
|
str | Path
|
Target directory for all output. |
required |
provider
|
str
|
LLM provider ( |
'anthropic'
|
model
|
str | None
|
Model name at the provider (provider default if omitted). |
None
|
language
|
str
|
Language of the compared standard (default |
'de'
|
use_llm
|
bool
|
If |
True
|
batch
|
bool
|
If |
False
|
embed_fallback
|
bool
|
If |
False
|
embed_model
|
str | None
|
Embedding model for the rescue pass (default if omitted). |
None
|
config
|
str | Path | None
|
Optional configuration file (JSON or TOML); when given it supplies the document metadata. |
None
|
Returns:
| Type | Description |
|---|---|
|
A |
Source code in src/normpare/__init__.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
Configuration
normpare.config
Configuration model for a comparison run.
Built either from explicit arguments (:meth:Config.for_compare, used by compare()
and the CLI) or loaded from a JSON/TOML configuration file (:meth:Config.from_file).
Config
dataclass
Everything a single comparison run needs.
Source code in src/normpare/config.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
for_compare(old, new, out_dir, *, provider='anthropic', model=None, language='de', run_name=None, pair_label=None, embed_fallback=False, embed_model=None, tau_embed=0.82, batch=False)
classmethod
Build a config from explicit paths, deriving document metadata from the filenames.
Source code in src/normpare/config.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
from_file(path, out_dir)
classmethod
Load a config from a JSON or TOML file (see the documentation for the layout).
Source code in src/normpare/config.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
SourceSpec
dataclass
One source document (old or new) with its metadata.
Source code in src/normpare/config.py
15 16 17 18 19 20 21 22 | |
LlmConfig
dataclass
LLM backend settings for the interpretation stage.
Source code in src/normpare/config.py
25 26 27 28 29 30 31 32 33 34 35 | |
Pipeline
normpare.pipeline
Pipeline orchestrator: runs the stages of a comparison and writes the JSON artifacts.
Orchestrates the stages in order, operating on
the norm_doc.json dicts that the migrated stage functions expect. Heavy dependencies
(lxml/PyMuPDF for ingest, numpy/scipy for alignment, python-docx/
python-pptx for reports) are imported lazily inside each stage, so importing this
module stays cheap and dependency-free.
Pipeline
Runs the comparison stages for a :class:Config and writes artifacts to out_dir.
Source code in src/normpare/pipeline.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
run(stages='all', use_llm=True)
Run the given stage(s) in order. use_llm=False skips the interpretation stage.
Source code in src/normpare/pipeline.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
RunResult
dataclass
Paths of the artifacts produced by a run.
Source code in src/normpare/pipeline.py
21 22 23 24 25 26 27 28 29 30 31 32 33 | |