Corrections
Make corrections to your data.
fix_annotations(example, corrections, case_sensitive=False)
¶
Show source code in recon/corrections.py
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 69 70 71 72 73 74 75 76 |
|
Fix annotations in a copy of List[Example] data.
This function will NOT add annotations to your data. It will only remove erroneous annotations and fix the labels for specific spans.
Parameters
Name | Type | Description | Default |
---|---|---|---|
example |
Example |
Input Example | required |
corrections |
Dict[str, str] |
Dictionary of corrections mapping entity text to a new label. If the value is set to None, the annotation will be removed | required |
case_sensitive |
bool |
Consider case of text for each correction | False |
Returns
Type | Description |
---|---|
Example |
Example: Example with fixed annotations |
rename_labels(example, label_map)
¶
Show source code in recon/corrections.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
Rename labels in a copy of List[Example] data
Parameters
Name | Type | Description | Default |
---|---|---|---|
example |
Example |
Input Example | required |
label_map |
Dict[str, str] |
One-to-one mapping of label names | required |
Returns
Type | Description |
---|---|
Example |
Example: Copy of Example with renamed labels |
strip_annotations(example, strip_chars=['.', '!', '?', '-', ':', ' '])
¶
Show source code in recon/corrections.py
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 |
|
Strip punctuation and spaces from start and end of annotations. These characters are almost always a mistake and will confuse a model
Parameters
Name | Type | Description | Default |
---|---|---|---|
example |
Example |
Input Example | required |
strip_chars |
List[str] |
Characters to strip. | ['.', '!', '?', '-', ':', ' '] |
Returns
Type | Description |
---|---|
Example |
Example: Example with stripped spans |