Skip to content

Commit

Permalink
Merge pull request #53 from anzharip/feat/separate-stopwords
Browse files Browse the repository at this point in the history
feat: separate list of custom stopwords into it's own module
  • Loading branch information
anzharip authored Nov 30, 2020
2 parents 1a97fa7 + 4e67f37 commit 6fd0f76
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/utility/twitter/custom-stopwords.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export const customStopwords = [
"ga",
"gw",
"lu",
"yg",
"bgt",
"ya",
"tp",
"engga",
"gak",
"yah",
"tau",
"pas",
"udh",
];
2 changes: 2 additions & 0 deletions src/utility/twitter/tweet-utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { analyseSentiment } from "../gcp/sentiment";
import { translateText } from "../gcp/translate";
import { logger } from "../logger";
import { regexTwitterHandle, regexURL } from "../regex";
import { customStopwords } from "./custom-stopwords";

const token = process.env.TWITTER_BEARER_TOKEN || "";
const recentSearchURL = "https://api.twitter.com/2/tweets/search/recent";
Expand Down Expand Up @@ -85,6 +86,7 @@ export async function generateWordsArray(tweets: {
return sw.removeStopwords(recentTweetsConcatClean.split(" "), [
...sw.en,
...sw.id,
...customStopwords,
]);
}

Expand Down

0 comments on commit 6fd0f76

Please sign in to comment.