Repository navigation
accommodating mmif-python 1.6.0 #314
Copy link
Copy link
Closed
Description
Because
mmif-python 1.6.0 is being released (clamsproject/mmif-python#410) with the following changes that are relevant to clams-python;
appTagsis now a declared field ofViewMetadataMmifObject.set_additional_property()now stores a key that matches a declared attribute in that attribute, with aUserWarning, instead of keeping the same key in two placesView.has_content()is added (true when the view has at least one annotation), andViewsList.get_last_contentful_view()now returns the last view with content; empty views are skipped as well as error and warnings viewsMmif.generate_capital_annotations()has a fixed duplicate check; it used to read the document ID of the firstAnnotationin a view and reuse it for all the others, so properties were written twice as soon as two or more documents got propertiesMmif.get_annotations_of_labels()andvideo_document_helper.iter_timeframe_images()are promoted from theutl-tfapp template
Done when
Proposal
-
ClamsApp.sign_view()writesappTagswithview.metadata['appTags'] = ...instead ofset_additional_property('appTags', ...)(). With 1.6.0, the current call triggers the newclams-python/clams/app/__init__.py
Lines 393 to 394 in 085770e
if self.metadata.app_tags: view.metadata.set_additional_property('appTags', list(self.metadata.app_tags)) UserWarning(2. above), and sinceannotate()records every warning raised during_annotate(), every app that declaresapp_tagswould get an extra warnings view in its output. Item assignment goes to the declared field, so the tags are stored correctly either way; only the warning has to go. -
ClamsApp.annotate()converts pending document properties intoAnnotations before deciding which views are empty, i.e.,annotated.generate_capital_annotations()right after_annotate()returns. This fixes a bug introduced in adding consistent handling of "empty" views returned from apps #307; see "wrong attachment of capitalAnnotations" below. It relies on the fixed duplicate check (4. above), sinceserialize()converts the same pending properties once more. - the emptiness check in
ClamsApp.annotate()() is written with mmif-python's definitions;clams-python/clams/app/__init__.py
Line 244 in 085770e
is_empty = lambda v: len(v.annotations) == 0 and not v.has_error() and not v.has_warnings() not (v.has_content() or v.has_error() or v.has_warnings()), so the rule from handling of "empty" views #305 doesn't keep its own copy of what a "contentful" view is. Note that the error and warnings terms have to stay; an app can set an error or warnings on its own view, and such a view has no annotations but must not be deleted. - deprecate the
utl-tfrecipe ofclams develop(https://github.com/clamsproject/clams-python/tree/085770e71d25bf2ed366447b5c9c55fb500ca8b1/clams/develop/templates/utl-tf) , since its functions now live in mmif-python (5. above); namely, - tests that call
get_last_contentful_view()are checked against the new semantics (3. above); at the moment that's onlytest_error_handling()clams-python/tests/test_clamsapp.py
Lines 440 to 441 in 085770e
out_mmif_from_mmif.views.get_last_contentful_view(), out_mmif_from_str.views.get_last_contentful_view())
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fieldsDone
Activity