Skip to content

Commit ff7d0cd

Browse files
committed
added separate thresholds for news framing and news genre
1 parent 8949667 commit ff7d0cd

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/components/NavItems/Assistant/AssistantScrapeResults/AssistantTextClassification.jsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ export default function AssistantTextClassification({
5858
"likely_machine",
5959
"highly_likely_machine",
6060
],
61+
// news framing
62+
newsFramingConfidenceThreshold: 0.8,
63+
// news genre
64+
newsGenreConfidenceThresholdLow: 0.7,
6165
},
6266
textHtmlMap = null,
6367
credibilitySignal = "",
@@ -97,14 +101,13 @@ export default function AssistantTextClassification({
97101
const mgtOverallScoreLabel = "mgt_overall_score";
98102

99103
// define colours
104+
let newsFramingConfidenceThreshold, newsGenreConfidenceThreshold;
100105
let mgtColours, mgtColoursDark, orderedCategories;
101106
let subjectivityColours, subjectivityColoursDark;
102-
let confidenceThresholdLow;
103-
if (
104-
credibilitySignal === newsFramingTitle ||
105-
credibilitySignal === newsGenreTitle
106-
) {
107-
confidenceThresholdLow = configs.confidenceThresholdLow;
107+
if (credibilitySignal === newsFramingTitle) {
108+
newsFramingConfidenceThreshold = configs.newsFramingConfidenceThreshold;
109+
} else if (credibilitySignal === newsGenreTitle) {
110+
newsGenreConfidenceThreshold = configs.newsGenreConfidenceThreshold;
108111
} else if (credibilitySignal === machineGeneratedTextTitle) {
109112
[mgtColours, mgtColoursDark] = getMgtColours(configs);
110113
orderedCategories = configs.orderedCategories;
@@ -149,12 +152,14 @@ export default function AssistantTextClassification({
149152
// set default news genre value if category below threshold
150153
label === REPORTING_LABEL
151154
? (filteredCategories[label] = classification[label])
152-
: classification[label][0].score >= confidenceThresholdLow
155+
: classification[label][0].score >= newsGenreConfidenceThreshold
153156
? (filteredCategories[label] = classification[label])
154157
: (filteredCategories[REPORTING_LABEL] = [
155-
{ indices: [0, -1], score: confidenceThresholdLow },
158+
{ indices: [0, -1], score: newsGenreConfidenceThreshold },
156159
]);
157-
} else if (classification[label][0].score >= confidenceThresholdLow) {
160+
} else if (
161+
classification[label][0].score >= newsFramingConfidenceThreshold
162+
) {
158163
// filter news framing categories above threshold
159164
filteredCategories[label] = classification[label];
160165
}

0 commit comments

Comments
 (0)