mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
Install some stuff.
This commit is contained in:
parent
f8879b307c
commit
004028d7b5
5 changed files with 13 additions and 35 deletions
|
@ -1,14 +1,14 @@
|
|||
// Trying out the ahocorasick algorithm
|
||||
// Recommended by: https://www.threads.com/@hsinspeng/post/DJ3yVGQxBg7
|
||||
import AhoCorasick from "ahocorasick";
|
||||
import { AhoCorasick } from "@monyone/aho-corasick";
|
||||
|
||||
async function checkUnsafeContent(title: string) {
|
||||
try {
|
||||
const req = await fetch("/api/contentcheck/kidunfriendlycontent");
|
||||
const res = await req.json();
|
||||
console.log(res.words);
|
||||
console.log(res);
|
||||
const ac = new AhoCorasick(res.words);
|
||||
const kidfriendly = ac.search(title);
|
||||
const kidfriendly = ac.hasKeywordInText(title);
|
||||
console.log(kidfriendly);
|
||||
return kidfriendly;
|
||||
} catch (e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue