aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam Janovsky2023-10-20 10:29:18 +0200
committerAdam Janovsky2023-10-20 10:29:18 +0200
commitc7ad8444996bcbf639ef4fec0af7297374cfbfd1 (patch)
treea833a61a5e19f87642fce44fb4dd4f8d34266573
parentd21539ea3b6e06d3e0ba4705c740c6ef5d85e895 (diff)
downloadsec-certs-c7ad8444996bcbf639ef4fec0af7297374cfbfd1.tar.gz
sec-certs-c7ad8444996bcbf639ef4fec0af7297374cfbfd1.tar.zst
sec-certs-c7ad8444996bcbf639ef4fec0af7297374cfbfd1.zip
recertification -> reevaluation in code
-rw-r--r--notebooks/cc/reference_annotations/prediction.ipynb2
-rw-r--r--src/sec_certs/model/references/annotator.py8
2 files changed, 5 insertions, 5 deletions
diff --git a/notebooks/cc/reference_annotations/prediction.ipynb b/notebooks/cc/reference_annotations/prediction.ipynb
index 628f3204..fe51f611 100644
--- a/notebooks/cc/reference_annotations/prediction.ipynb
+++ b/notebooks/cc/reference_annotations/prediction.ipynb
@@ -101,7 +101,7 @@
"df = df.merge(all_annotations.loc[:, [\"dgst\", \"referenced_cert_id\", \"name_similarity_stripped_version\", \"name_len_diff\", \"cert_name\", \"referenced_cert_name\"]], on=[\"dgst\", \"referenced_cert_id\"])\n",
"\n",
"# Simplified binary labels\n",
- "# label_mapping = {\"COMPONENT_USED\": \"COMPONENT_SHARED\", \"RECERTIFICATION\": \"PREVIOUS_VERSION\"}\n",
+ "# label_mapping = {\"COMPONENT_USED\": \"COMPONENT_SHARED\", \"REEVALUATION\": \"PREVIOUS_VERSION\"}\n",
"# df.label = df.label.map(lambda x: label_mapping[x] if x in label_mapping else x)\n"
]
},
diff --git a/src/sec_certs/model/references/annotator.py b/src/sec_certs/model/references/annotator.py
index b7666f34..76676895 100644
--- a/src/sec_certs/model/references/annotator.py
+++ b/src/sec_certs/model/references/annotator.py
@@ -96,7 +96,7 @@ class ReferenceAnnotator:
WIll read df.segments and populate the dataframe with predictions.
"""
- def matches_recertification(segments: list[str]) -> bool:
+ def matches_reevaluation(segments: list[str]) -> bool:
regex_a = r"This is a re-?\s?certification based on (the\s){1,2}referenced product"
regex_b = r"Re-?\s?Zertifizierung basierend auf (the\s){1,2}referenced product"
return any(
@@ -113,12 +113,12 @@ class ReferenceAnnotator:
df_new.loc[
(df_new.name_similarity == 100)
& (df_new.name_len_diff < 5)
- & ((df_new.y_pred != "RECERTIFICATION") & (df_new.y_pred != "PREVIOUS_VERSION")),
+ & ((df_new.y_pred != "RE-EVALUATION") & (df_new.y_pred != "PREVIOUS_VERSION")),
["y_pred"],
] = "PREVIOUS_VERSION"
- df_new["matches_recertification"] = df_new.segments.map(matches_recertification)
- df_new.loc[df_new.matches_recertification, ["y_pred"]] = "RECERTIFICATION"
+ df_new["maches_reevaluation"] = df_new.segments.map(matches_reevaluation)
+ df_new.loc[df_new.maches_reevaluation, ["y_pred"]] = "RE-EVALUATION"
df_new["correct"] = df_new.apply(
lambda row: row["y_pred"] == row["label"] if not pd.isnull(row["label"]) else np.NaN, axis=1