Describe the bug
Some users have encountered offset out of range problem when adding annotations.
It is clear that 4294967295 = 2^32 -1, which means this is likely that some part of the system uses Max Int as the start offset, waiting for the user input and probably exit unexpectedly.
Upon close investigation, this can be triggered by having an Annotation with -1 as the start (or end). The following JSON can be used to reproduce this error:
{ "py/object":"forte.data.data_pack.DataPack", "py/state":{ "links":[], "groups":[], "meta":{ "py/object":"forte.data.data_pack.Meta", "py/state":{ "pack_name":"71284", "_pack_id":1035, "language":"eng", "span_unit":"character" } }, "_text": "some text", "annotations":[ { "py/object":"ft.onto.base_ontology.Token", "py/state":{ "_span":{ "begin":-1, "end":-1, "py/object":"forte.data.span.Span" }, "_tid":268 } } ], "generics":[], "orig_text_len":9, "serialization":{ "next_id":269 } } }
To Reproduce
Steps to reproduce the behavior:
- Copy the content above in to a JSON file.
- Upload this file into the example project
- Open this file and you will see the error.
It is unclear which annotation steps result in a broken annotation like this.
Expected behavior
- The program should safeguard the annotation adding process and exit gracefully when it is interrupted. For example, before adding, perform checking to make sure 0 <= start < end <= text.length.
- In case of errors in the annotation offsets (this can happen if users upload files created by 3rd party programs), the interface should probably report the error (with a bubble), but do not raise an exception that crash this page.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
- OS: [e.g. iOS]
- Version [e.g. 22]
- Node Versions or other
Additional context
Add any other context about the problem here.