diff --git a/src/pipelines/oscardoc/types/rebuild.rs b/src/pipelines/oscardoc/types/rebuild.rs index 4ff8912..7776aa8 100644 --- a/src/pipelines/oscardoc/types/rebuild.rs +++ b/src/pipelines/oscardoc/types/rebuild.rs @@ -50,7 +50,7 @@ lazy_static! { "fields":[ {"name":"identification", "type":"identification"}, {"name":"harmful_pp", "type":["null", "float"]}, - {"name":"annotation", "type":["null", {"type": "array", "items":"string"}]}, + {"name":"quality_warnings", "type":["null", {"type": "array", "items":"string"}]}, {"name":"categories", "type":["null", {"type": "array", "items":"string"}]}, {"name": "sentence_identifications", "type":"array", "items":[ "null", diff --git a/src/transformers/annotate.rs b/src/transformers/annotate.rs index 28a5047..8bd1eed 100644 --- a/src/transformers/annotate.rs +++ b/src/transformers/annotate.rs @@ -31,6 +31,10 @@ impl Default for Annotator { #[cfg(test)] mod tests { + use std::collections::HashMap; + + use oscar_io::v3::Metadata; + use crate::{pipelines::oscardoc::types::Document, transformers::Annotate}; use super::Annotator; @@ -45,12 +49,19 @@ mod tests { fn test_add() { struct MockAnnotate {} impl Annotate for MockAnnotate { - fn annotate(&self, _: &mut Document) {} + fn annotate(&self, doc: &mut Document) { + doc.metadata_mut().add_annotation("foo".to_string()); + } } let mut a = Annotator::default(); a.add(Box::new(MockAnnotate {})); assert_eq!(a.0.len(), 1); + + let mut d = Document::new(String::new(), HashMap::new(), Metadata::default()); + a.annotate(&mut d); + + assert_eq!(d.metadata().annotation(), Some(&vec!["foo".to_string()])); } }