ModerRAS commited on
Commit
219e9dd
·
1 Parent(s): 0df0bf9

Drop multi-title synthetic templates

Browse files
tools/schema_v2_synthetic_augment/src/main.rs CHANGED
@@ -697,6 +697,15 @@ fn build_numeric_record(recipe: &Recipe, title: &str, variant: usize) -> Option<
697
  if classes.len() != recipe.roles.len() {
698
  return None;
699
  }
 
 
 
 
 
 
 
 
 
700
  let mut builder = CharBuilder::default();
701
  let mut previous_role = "";
702
  for (class_name, role) in classes.iter().zip(recipe.roles.iter()) {
@@ -1412,6 +1421,24 @@ mod tests {
1412
  );
1413
  }
1414
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1415
  #[test]
1416
  fn path_title_season_episode_labels_are_projected() {
1417
  let base = char_record_from_spans(
 
697
  if classes.len() != recipe.roles.len() {
698
  return None;
699
  }
700
+ if recipe
701
+ .roles
702
+ .iter()
703
+ .filter(|role| role.as_str() == "TITLE")
704
+ .count()
705
+ != 1
706
+ {
707
+ return None;
708
+ }
709
  let mut builder = CharBuilder::default();
710
  let mut previous_role = "";
711
  for (class_name, role) in classes.iter().zip(recipe.roles.iter()) {
 
1421
  );
1422
  }
1423
 
1424
+ #[test]
1425
+ fn numeric_generation_drops_multi_title_templates() {
1426
+ let recipe = Recipe {
1427
+ template_id: "tpl_multi_title".to_string(),
1428
+ template: "TEXT SEP TEXT SEP EPISODE".to_string(),
1429
+ roles: vec![
1430
+ "TITLE".to_string(),
1431
+ "O".to_string(),
1432
+ "TITLE".to_string(),
1433
+ "O".to_string(),
1434
+ "EPISODE".to_string(),
1435
+ ],
1436
+ confidence: Some("high".to_string()),
1437
+ _count: Some(1),
1438
+ };
1439
+ assert!(build_numeric_record(&recipe, "91 Days", 0).is_none());
1440
+ }
1441
+
1442
  #[test]
1443
  fn path_title_season_episode_labels_are_projected() {
1444
  let base = char_record_from_spans(