errormarkup
Classes and functions to convert errormarkup to xml.
ErrorMarkupError
Bases: Exception
This is raised for errors in this module.
Source code in /home/anders/projects/CorpusTools/corpustools/errormarkup.py
240 241 |
|
add_error_markup(element)
Convert error markup to xml in this element and its children.
This is the starting point for doing markup.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
element |
etree._Element
|
The element where error markup should be converted to xml. |
required |
Source code in /home/anders/projects/CorpusTools/corpustools/errormarkup.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
|
convert_to_errormarkupxml(element)
Convert errormarkup found in the element to xml.
Source code in /home/anders/projects/CorpusTools/corpustools/errormarkup.py
198 199 200 201 202 203 204 205 206 207 |
|
errormarkup_to_xml(text, last_correction)
Turn the errormarkup into error xml.
Source code in /home/anders/projects/CorpusTools/corpustools/errormarkup.py
168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
fix_tail(element)
Replace error markup with error xml.
Source code in /home/anders/projects/CorpusTools/corpustools/errormarkup.py
183 184 185 186 187 188 189 190 191 192 193 194 195 |
|
fix_text(element)
Replace error markup with error xml.
Source code in /home/anders/projects/CorpusTools/corpustools/errormarkup.py
156 157 158 159 160 161 162 163 164 165 |
|
has_not_valid_pairs(text)
Check if the text has valid pairs.
Source code in /home/anders/projects/CorpusTools/corpustools/errormarkup.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
invalid_corrections(text)
Check if all corrections are valid.
Source code in /home/anders/projects/CorpusTools/corpustools/errormarkup.py
45 46 47 48 49 50 51 52 |
|
look_for_extended_attributes(correction)
Extract attributes and correction from a correctionstring.
Source code in /home/anders/projects/CorpusTools/corpustools/errormarkup.py
126 127 128 129 130 131 132 133 |
|
make_correction_element(correction_content)
Make correction elements.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
correction_content |
str
|
string containing the correction(s) |
required |
Yields:
Type | Description |
---|---|
lxml.etree.Element
|
A correction element for each correction |
Source code in /home/anders/projects/CorpusTools/corpustools/errormarkup.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
make_error_element(error_text, error_name, correction)
Make an error xml element.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
error_text |
str
|
the text of the error element |
required |
error_name |
str
|
the tag of the error element |
required |
correction |
str
|
the correction(s) for the error |
required |
Returns:
Type | Description |
---|---|
lxml.etree.Element
|
An etree._Element |
Source code in /home/anders/projects/CorpusTools/corpustools/errormarkup.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
remove_simple_errors(text)
Remove non nested errors from the text.
Source code in /home/anders/projects/CorpusTools/corpustools/errormarkup.py
55 56 57 58 59 60 61 62 63 64 65 66 |
|
scan_for_error(text)
Scan for error markup in the given text.
Source code in /home/anders/projects/CorpusTools/corpustools/errormarkup.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
validate_markup(element)
Check if the markup is valid.
Source code in /home/anders/projects/CorpusTools/corpustools/errormarkup.py
210 211 212 213 214 215 216 217 218 219 |
|