error_annotated_sentence
CorrectionSegment
dataclass
Source code in corpustools/error_annotated_sentence.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
to_xml()
Convert the correction segment to its XML representation.
Returns:
| Type | Description |
|---|---|
Element
|
An lxml Element representing the correction segment in XML format. |
Source code in corpustools/error_annotated_sentence.py
16 17 18 19 20 21 22 23 24 25 26 | |
ErrorAnnotatedSentence
dataclass
Represents a sentence with zero or more error markups.
Source code in corpustools/error_annotated_sentence.py
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 | |
to_xml(parent=None)
Convert the error annotated sentence to its XML representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Element | None
|
The parent XML element to which the sentence will be appended. |
None
|
Returns:
| Type | Description |
|---|---|
Element
|
An lxml Element representing the error annotated sentence in XML format. |
Source code in corpustools/error_annotated_sentence.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
uncorrected_text()
Get the uncorrected text of the sentence.
Source code in corpustools/error_annotated_sentence.py
116 117 118 119 120 121 122 123 | |
ErrorMarkup
dataclass
Represents a marked up error in a sentence.
Attributes:
| Name | Type | Description |
|---|---|---|
error |
'ErrorAnnotatedSentence'
|
"ErrorAnnotatedSentence" representing the erroneous segment |
errortype |
ErrorType
|
Type of error |
correction |
CorrectionSegment
|
CorrectionSegment |
Source code in corpustools/error_annotated_sentence.py
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 | |
to_xml()
Convert the error markup to its XML representation.
Returns:
| Type | Description |
|---|---|
Element
|
An lxml Element representing the error markup in XML format. |
Source code in corpustools/error_annotated_sentence.py
75 76 77 78 79 80 81 82 83 84 85 86 | |
uncorrected_text()
Get the uncorrected text of the error markup.
Source code in corpustools/error_annotated_sentence.py
71 72 73 | |
ErrorMarkupSegment
dataclass
Source code in corpustools/error_annotated_sentence.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
to_xml()
Convert the error markup segment to its XML representation. Returns: An lxml Element representing the error markup segment in XML format.
Source code in corpustools/error_annotated_sentence.py
98 99 100 101 102 103 104 105 106 | |
uncorrected_text()
Get the uncorrected text of the error markup segment.
Source code in corpustools/error_annotated_sentence.py
94 95 96 | |
parse_markup_to_correction_segment(markup)
Parse correction segment from markup iterator. Args: markup: An iterator over strings representing the markup. Returns: A CorrectionSegment representing the parsed content.
Source code in corpustools/error_annotated_sentence.py
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 | |
parse_markup_to_error_markup_segment(markup)
Parse ErrorMarkupSegment from markup iterator. Args: markup: An iterator over strings representing the markup. Returns: An ErrorMarkupSegment representing the parsed content.
Source code in corpustools/error_annotated_sentence.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
parse_markup_to_sentence(markup)
Parse error annotated sentence from markup iterator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
markup
|
Iterator[str]
|
An iterator over strings representing the markup. |
required |
Returns: An ErrorAnnotatedSentence representing the parsed content.
Source code in corpustools/error_annotated_sentence.py
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 | |
parse_tail(markup)
Parse tail from markup iterator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
markup
|
Iterator[str]
|
An iterator over strings representing the markup. |
required |
Returns: A tuple of (tail string, next delimiter character or None). The delimiter is either '{', '}', or None if end of markup.
Source code in corpustools/error_annotated_sentence.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |