error_types
Error type symbols and their corresponding error categories.
These symbols are used in the markup syntax to indicate different types of errors: - Basic syntax: {error}${correction} - Nested syntax: {{error1}${correction_of_error1}}£{correction_of_correction1}
ErrorMarkupError
Bases: Exception
This is raised for errors in this module.
Source code in corpustools/error_types.py
111 112 113 114 | |
ErrorType
Bases: Enum
Error type enumeration with associated symbols.
Each error type has: - An enum name (built-in .name attribute) - A symbol character used in markup - A string representation for serialization
Source code in corpustools/error_types.py
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 69 70 71 72 73 | |
error_name
property
Get the error type name as a string (e.g., 'errorort').
symbol
property
Get the symbol character for this error type.
__str__()
String representation returns the error name (e.g., 'errorort').
Source code in corpustools/error_types.py
71 72 73 | |
all_error_symbols()
Get all valid error type symbols.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of all symbol characters |
Example
all_error_symbols() ['$', '¢', '€', '£', '¥', '§', '∞', '‰']
Source code in corpustools/error_types.py
98 99 100 101 102 103 104 105 106 107 108 | |
error_type_from_symbol(symbol)
Parse an error type from a symbol character.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
The symbol character to look up |
required |
Returns:
| Type | Description |
|---|---|
ErrorType | None
|
The corresponding ErrorType, or None if symbol is invalid |
Example
error_type_from_symbol("$")
Source code in corpustools/error_types.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |