With this PR, we re-use the original document type when calling (Iterable)Dataset.map() if no result_document_type is provided. This clarifies the semantics because we do not change the document type except that it is explicitly provided. With this we also do not rely on (maybe wrong) return type annotations anymore and we can use generic functions in map that do not change the document type at all (e.g. trimming spans) which is a quite common case.
This is a breaking change for the case that map() is called with a function that has an annotated return type which is different than the original document type of the dataset.
With this PR, we re-use the original document type when calling
(Iterable)Dataset.map()
if noresult_document_type
is provided. This clarifies the semantics because we do not change the document type except that it is explicitly provided. With this we also do not rely on (maybe wrong) return type annotations anymore and we can use generic functions in map that do not change the document type at all (e.g. trimming spans) which is a quite common case.This is a breaking change for the case that
map()
is called with a function that has an annotated return type which is different than the original document type of the dataset.