Results Processor
find_average_len(burst_results)
Finds the average length of bursts of a concept.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
burst_results
|
DataFrame
|
DataFrame with columns [keyword, level, start, end]. |
required |
Returns:
Type | Description |
---|---|
dict
|
Dictionary with concepts associated to the average length of their bursts. |
Examples:
Example of the returned dictionary format: { "concept1": 5.0, "concept2": 3.5, ... }
Source code in apps/annotator/code/burst/results_processor.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
find_first_longest(burst_results, avg)
Finds the first burst having a length that is higher than the average length of all bursts of that concept.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
burst_results
|
DataFrame
|
DataFrame with columns [keyword, level, start, end]. |
required |
avg
|
dict
|
Dictionary with concepts associated to the average length of their bursts. |
required |
Returns:
Type | Description |
---|---|
dict
|
Dictionary with concepts associated with the id of the first longest burst. |
Examples:
Example of the returned dictionary format: { "concept1": 0, "concept2": 3, ... }
Source code in apps/annotator/code/burst/results_processor.py
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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
get_json_with_bursts(burst_results, sents_idx)
Gets a list of bursts with first/last/ongoing/unique tags that can be used for the Gantt interface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
burst_results
|
DataFrame
|
DataFrame with columns [keyword, level, start, end]. |
required |
sents_idx
|
DataFrame
|
DataFrame containing the indexes of sentences where every concept occurs. It must have the following columns: "Lemma", "idFrase", "idParolaStart". |
required |
Returns:
Type | Description |
---|---|
list of dict
|
List of bursts with their details including start sentence, end sentence, concept, ID, frequency of term, and status. |
Examples:
Example of the returned list format: [ {"startSent": 0, "endSent": 9, "concept": "computer", "ID": 1, "freqOfTerm": 7, "status": "FIRST"}, {"startSent": 10, "endSent": 19, "concept": "network", "ID": 2, "freqOfTerm": 5, "status": "ONGOING"}, ... ]
Source code in apps/annotator/code/burst/results_processor.py
102 103 104 105 106 107 108 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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
give_direction_using_first_burst(undirected_matrix, bursts_results, indexes, level=1, preserve_relations=False)
Give direction to an undirected matrix using the first burst of each concept.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
undirected_matrix
|
DataFrame
|
DataFrame representing the undirected adjacency matrix. |
required |
bursts_results
|
DataFrame
|
DataFrame with columns [keyword, level, start, end]. |
required |
indexes
|
DataFrame
|
DataFrame containing the indexes of sentences where every concept occurs. It must have the following columns: "Lemma", "idFrase", "idParolaStart". |
required |
level
|
int
|
The level of bursts to consider (default is 1). |
1
|
preserve_relations
|
bool
|
If False, the weight in the "wrong" direction is killed and the weight in the right direction remains the same (potentially zero). If True, before the weight in the "wrong" direction is killed, the weight in the "right" direction is checked: if this is zero, it will be replaced with the weight of the wrong direction (and then the wrong is killed). |
False
|
Returns:
Type | Description |
---|---|
DataFrame
|
DataFrame representing the directed adjacency matrix. |
Examples:
Example of the returned DataFrame format: source target weight concept1 concept2 0.5 concept2 concept3 0.7 ...
Source code in apps/annotator/code/burst/results_processor.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 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 |
|