forte
forte copied to clipboard
Payload data setter
This PR fixes https://github.com/asyml/forte/issues/890
Description of changes
- support datapack.set_text("text", -1) which is equivalent to append text payload
- support datapack.set_text("text") which the text payload index is by default 0. When there is no text payloads in the datapack, it will add a new payload.
Possible influences of this PR.
- user can set/add data of modality in the DataPack easily
Test Conducted
- it's backward compatible with past tests
Codecov Report
Merging #892 (d48b1a9) into master (d5e69a4) will decrease coverage by
0.00%. The diff coverage is100.00%.
@@ Coverage Diff @@
## master #892 +/- ##
==========================================
- Coverage 80.95% 80.95% -0.01%
==========================================
Files 254 254
Lines 19569 19566 -3
==========================================
- Hits 15843 15840 -3
Misses 3726 3726
| Impacted Files | Coverage Δ | |
|---|---|---|
| forte/data/data_pack.py | 85.90% <ø> (ø) |
|
| tests/forte/grid_test.py | 100.00% <100.00%> (ø) |
|
| tests/forte/image_annotation_test.py | 100.00% <100.00%> (ø) |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more