Pipelines¶
pipeline ¶
Expose the three independent project execution pipelines.
The full workflow is deliberately implemented as composition of the typo- generation-only and AutoCorrect2-only workflows. Neither subsystem depends on the other, which keeps generation policy separate from AutoHotkey source inspection and conflict detection.
GENERATED_CANDIDATE_OPTIONS
module-attribute
¶
GENERATED_CANDIDATE_OPTIONS: Final[HotstringOptions] = (
HotstringOptions("B0X")
)
Options assigned when the full pipeline converts typo mappings to hotstrings.
FullPipelineResult
dataclass
¶
Represent the two results produced by the composed full pipeline.
Attributes:
| Name | Type | Description |
|---|---|---|
typo_generation |
TypoGenerationResult
|
Result of typo generation and internal ambiguity filtering. |
autocorrect2 |
AutoCorrect2CheckResult
|
Result of checking the surviving candidates against AutoCorrect2. |
Source code in hotstring\pipeline.py
37 38 39 40 41 42 43 44 45 46 47 48 49 | |
run_typo_generation ¶
run_typo_generation(
word_list: Sequence[str],
tasks: Sequence[TypoGenerationTask],
config: TypoGenerationConfig,
*,
n_workers: int | None = None,
report_path: Path | None = None,
logger: Logger | None = None,
) -> TypoGenerationResult
Run typo generation and internal ambiguity filtering only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
word_list
|
Sequence[str]
|
Source words to corrupt. |
required |
tasks
|
Sequence[TypoGenerationTask]
|
Ordered typo-generation tasks to execute. |
required |
config
|
TypoGenerationConfig
|
Shared MULTYPO generator configuration. |
required |
n_workers
|
int | None
|
Optional process-pool size. |
None
|
report_path
|
Path | None
|
Optional destination for a typo-generation-only report. |
None
|
logger
|
Logger | None
|
Optional orchestration logger forwarded to the execution layer. |
None
|
Returns:
| Type | Description |
|---|---|
TypoGenerationResult
|
Aggregated typo-generation result containing valid mappings and |
TypoGenerationResult
|
internally ambiguous noisy forms. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If task/execution inputs have invalid types. |
ValueError
|
If no generation tasks are supplied or a generation setting is invalid. |
RuntimeError
|
If a parallel generation task fails. |
OSError
|
If a requested report cannot be written. |
Source code in hotstring\pipeline.py
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 | |
run_autocorrect2_check ¶
run_autocorrect2_check(
candidates: Sequence[AutoCorrect2CandidateHotstring],
*,
project_dir: Path,
report_path: Path | None = None,
write_accepted: bool = False,
) -> AutoCorrect2CheckResult
Check manually supplied candidates against active AutoCorrect2 hotstrings.
Trigger conflict detection supports every combination of the recognition
options currently modeled by the project: ending-character-free matching
(*), inside-word matching (?), and case-sensitive matching (C). No
candidate is rejected merely for using one of those semantics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidates
|
Sequence[AutoCorrect2CandidateHotstring]
|
AutoCorrect2 candidates supplied directly by the caller. |
required |
project_dir
|
Path
|
AutoCorrect2 project directory containing the configured source files. |
required |
report_path
|
Path | None
|
Optional destination for an AutoCorrect2-only report. |
None
|
write_accepted
|
bool
|
Append accepted candidates to the generated include file when
|
False
|
Returns:
| Type | Description |
|---|---|
AutoCorrect2CheckResult
|
Conflict-check result partitioning candidates into accepted and |
AutoCorrect2CheckResult
|
rejected groups. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If a required AutoCorrect2 source file is missing. |
UnicodeDecodeError
|
If a source requiring parsing is not valid UTF-8 text. |
ValueError
|
If source data is invalid or writing is requested for a candidate
that violates the writer's explicit |
OSError
|
If authoritative sources, reports, or generated files cannot be read or written. |
Source code in hotstring\pipeline.py
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 177 178 179 180 181 182 183 184 185 186 187 188 | |
run_full_pipeline ¶
run_full_pipeline(
word_list: Sequence[str],
tasks: Sequence[TypoGenerationTask],
config: TypoGenerationConfig,
*,
project_dir: Path,
n_workers: int | None = None,
report_path: Path | None = None,
write_accepted: bool = False,
logger: Logger | None = None,
) -> FullPipelineResult
Run typo generation followed by AutoCorrect2 conflict checking.
The function composes the two independent stage pipelines without asking
either stage to emit its own report. Surviving typo mappings are converted
to AutoCorrect2CandidateHotstring objects with
the project's fixed generated B0X option set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
word_list
|
Sequence[str]
|
Source words to corrupt. |
required |
tasks
|
Sequence[TypoGenerationTask]
|
Ordered typo-generation tasks to execute. |
required |
config
|
TypoGenerationConfig
|
Shared MULTYPO generator configuration. |
required |
project_dir
|
Path
|
AutoCorrect2 project directory. |
required |
n_workers
|
int | None
|
Optional process-pool size. |
None
|
report_path
|
Path | None
|
Optional destination for the combined report. |
None
|
write_accepted
|
bool
|
Append final accepted candidates to the generated include file. |
False
|
logger
|
Logger | None
|
Optional typo-generation orchestration logger. |
None
|
Returns:
| Type | Description |
|---|---|
FullPipelineResult
|
Combined result containing both stage results. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If generation or source-loading inputs have invalid types. |
ValueError
|
If generation/source data is invalid or a writable candidate violates the generated-file contract. |
FileNotFoundError
|
If a required AutoCorrect2 source file is missing. |
UnicodeDecodeError
|
If an authoritative source requiring parsing is not valid UTF-8. |
RuntimeError
|
If a parallel generation task fails. |
OSError
|
If source, report, or generated files cannot be read or written. |
Source code in hotstring\pipeline.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
_write_report ¶
Build and write one complete report document.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Destination report file. |
required |
title
|
str
|
Top-level report title. |
required |
body_lines
|
Sequence[str]
|
Pipeline-specific report body lines. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the report title is empty. |
OSError
|
If the report cannot be written. |
Source code in hotstring\pipeline.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |