From e179b5ced48993587bec9e179ac695f94614946c Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Thu, 6 Apr 2023 19:47:03 +1200 Subject: [PATCH 1/4] =?UTF-8?q?Boost=20U.S.=20politics=20=F0=9F=87=BA?= =?UTF-8?q?=F0=9F=87=B8=F0=9F=87=BA=F0=9F=87=B8=F0=9F=87=BA=F0=9F=87=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/algorithm.ts | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/lib/algorithm.ts b/lib/algorithm.ts index 76bf93d..9bb2b4c 100644 --- a/lib/algorithm.ts +++ b/lib/algorithm.ts @@ -37,6 +37,7 @@ export function rank(tweet: string): RankResponse { lowercase(tweetData), uppercase(tweetData), hazing(tweetData), + usPolitics(tweetData), ] const scores = rules.map((item) => item.score) const validations: Array = compact( @@ -353,3 +354,46 @@ function hazing({ tweet, sentiment }: TweetData): Rank { score: 0, } } + +/** + * U.S. politics is so awesome, and everybody should love to read about it, + * no matter their background, interests, or country of residence. + * You WILL form an opinion on us! + */ +function usPolitics({ tweet, sentiment }: TweetData): Rank { + // List of hot topics, power posters, and coronavirus conspiracy + const topics = [ + "🇺🇸", "american?", "patriot", "president", "states", "psyop", + "conservatives?", "democrat", "demonrat", "republican", "crt", "woke\\w*", + "wokeness", "abortion", "pro-life", "authoritarian", "drag", "ideology", + "trump", "biden", "obama", "aoc", "cruz", "bernie", "sanders", "mtg", + "ilhan", "pelosi", "lindsey", "mcconnell", "warren", "mccarthy", "kamala", + "romney", "tulsi", "gabbard", "rubio", "bannon", "yang", "klobuchar", + "crenshaw", "desantis", "buttigieg", "fauci", "feinstein", "cheney", + "newsom", "smollett", "beto", "schumer", "hillary", "clinton", "walsh", + "capitol", "house bill", "chicago", + "vaccine", "vaccines", "pfizer", "wuhan", "mandate", "mandates", + "plandemic", "bill gates" + ] + const r = new RegExp("\\b(?:" + topics.join("|") + ")\\b", "gi") + const matches: boolean = !!tweet.match(r) + if (matches) { + console.log(sentiment) + if (sentiment.comparative <= -0.1) { + // Downhill U.S. politics is great, you love reading about it + return { + score: 60, + message: "Downhill U.S. politics." + } + } else { + // Normal U.S. politics is decent too + return { + score: 40, + message: "U.S. politics." + } + } + } + return { + score: 0, + } +} From dc0c3883ce87ce76c09ca810b85c615234ab6c4e Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Thu, 6 Apr 2023 19:53:55 +1200 Subject: [PATCH 2/4] clean up log --- lib/algorithm.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/algorithm.ts b/lib/algorithm.ts index 9bb2b4c..c617f76 100644 --- a/lib/algorithm.ts +++ b/lib/algorithm.ts @@ -378,7 +378,6 @@ function usPolitics({ tweet, sentiment }: TweetData): Rank { const r = new RegExp("\\b(?:" + topics.join("|") + ")\\b", "gi") const matches: boolean = !!tweet.match(r) if (matches) { - console.log(sentiment) if (sentiment.comparative <= -0.1) { // Downhill U.S. politics is great, you love reading about it return { From 84d1b32614cd1f6ceae0cdbcb39c3f78ed0e879e Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Fri, 7 Apr 2023 12:58:42 +1200 Subject: [PATCH 3/4] U.S. politics: add amendment, constitution --- lib/algorithm.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/algorithm.ts b/lib/algorithm.ts index c617f76..fba24d6 100644 --- a/lib/algorithm.ts +++ b/lib/algorithm.ts @@ -371,7 +371,7 @@ function usPolitics({ tweet, sentiment }: TweetData): Rank { "romney", "tulsi", "gabbard", "rubio", "bannon", "yang", "klobuchar", "crenshaw", "desantis", "buttigieg", "fauci", "feinstein", "cheney", "newsom", "smollett", "beto", "schumer", "hillary", "clinton", "walsh", - "capitol", "house bill", "chicago", + "capitol", "house bill", "chicago", "amendment", "constitution", "vaccine", "vaccines", "pfizer", "wuhan", "mandate", "mandates", "plandemic", "bill gates" ] From 49040b69dc87ae7dc9118a325078f4ada235d65b Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Fri, 7 Apr 2023 13:00:38 +1200 Subject: [PATCH 4/4] U.S. politics: clean up plurals --- lib/algorithm.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/algorithm.ts b/lib/algorithm.ts index fba24d6..4860b8d 100644 --- a/lib/algorithm.ts +++ b/lib/algorithm.ts @@ -363,16 +363,16 @@ function hazing({ tweet, sentiment }: TweetData): Rank { function usPolitics({ tweet, sentiment }: TweetData): Rank { // List of hot topics, power posters, and coronavirus conspiracy const topics = [ - "🇺🇸", "american?", "patriot", "president", "states", "psyop", - "conservatives?", "democrat", "demonrat", "republican", "crt", "woke\\w*", - "wokeness", "abortion", "pro-life", "authoritarian", "drag", "ideology", + "🇺🇸", "american?s?", "patriots?", "president", "states", "psyop", + "conservatives?", "democrats?", "demonrat", "republicans?", "crt", "woke\\w*", + "abortion", "pro-life", "authoritarian", "drag", "ideology", "trump", "biden", "obama", "aoc", "cruz", "bernie", "sanders", "mtg", "ilhan", "pelosi", "lindsey", "mcconnell", "warren", "mccarthy", "kamala", "romney", "tulsi", "gabbard", "rubio", "bannon", "yang", "klobuchar", "crenshaw", "desantis", "buttigieg", "fauci", "feinstein", "cheney", "newsom", "smollett", "beto", "schumer", "hillary", "clinton", "walsh", - "capitol", "house bill", "chicago", "amendment", "constitution", - "vaccine", "vaccines", "pfizer", "wuhan", "mandate", "mandates", + "capitol", "house bill", "chicago", "amendments?", "constitution", + "vaccines?", "pfizer", "wuhan", "mandates?", "plandemic", "bill gates" ] const r = new RegExp("\\b(?:" + topics.join("|") + ")\\b", "gi")