Commit 228aab9
authored
CU-869ahw0mw: Add argument to control data flow when saving results. (#144)
* CU-869ahw0mw: Add argument to control data flow when saving results.
When is provided, the user (probably) expects the data to be saved on disk upon method call.
But the current implementation forced the user to iterate over the results to force the annotation to actually happen.
So this change allows the method to materialise the list internally to force the annotation to happen and results to be saved on disk.
Additionally, it adds 2 other options:
1. The lazy iteration (what happens when no is provided) where the iteration of data is left to the user
2. The combined / saved and return option where the results are materialised, but also yielded. Notably, this will take up a lot of memory if/when used with large data sets
* CU-869ahw0mw: Make tests run without materialising the output for multiprocessing
* CU-869ahw0mw: Move DeID tests to non-deprecated method
* CU-869ahw0mw: Some whitespace fixes
* CU-869ahw0mw: Fix issue withe multiprocessing.
The previous implementation would always consider the method a generator. And as such, the work would never be done
at call time, regardless of whether or not the was provided. This commit fixes that by making the
wrapper method a regular method that (sometimes) returns the iterator and other times just a (potentially empty) list.
* CU-869ahw0mw: Add further tests to new functionality
* CU-869ahw0mw: Fix behaviour (so it remains the same) in old test
* CU-869ahw0mw: Fix test regarding generator issue
* CU-869ahw0mw: Move saving (and not returning data) to a separate method
* CU-869ahw0mw: Update tests accordingly as per last change1 parent a58da4b commit 228aab9
File tree
3 files changed
+93
-7
lines changed- medcat-v2
- medcat
- tests
- utils/ner
3 files changed
+93
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
318 | 319 | | |
319 | 320 | | |
320 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
321 | 373 | | |
322 | 374 | | |
323 | 375 | | |
| |||
376 | 428 | | |
377 | 429 | | |
378 | 430 | | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
379 | 440 | | |
380 | 441 | | |
381 | 442 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
537 | | - | |
| 537 | + | |
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
541 | 541 | | |
542 | 542 | | |
543 | | - | |
| 543 | + | |
| 544 | + | |
544 | 545 | | |
545 | 546 | | |
546 | 547 | | |
| |||
658 | 659 | | |
659 | 660 | | |
660 | 661 | | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
661 | 685 | | |
662 | 686 | | |
663 | 687 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
| 217 | + | |
217 | 218 | | |
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
221 | 222 | | |
222 | | - | |
223 | | - | |
| 223 | + | |
| 224 | + | |
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
| |||
229 | 230 | | |
230 | 231 | | |
231 | 232 | | |
232 | | - | |
| 233 | + | |
233 | 234 | | |
234 | 235 | | |
235 | 236 | | |
| |||
245 | 246 | | |
246 | 247 | | |
247 | 248 | | |
248 | | - | |
| 249 | + | |
249 | 250 | | |
250 | 251 | | |
251 | 252 | | |
| |||
0 commit comments