1
0
mirror of https://github.com/Daichimarukana/uwuzu.git synced 2026-06-04 19:14:41 +00:00

uwuzu v1.4.12 Funium

This commit is contained in:
Daichimarukana
2025-01-12 20:01:08 +09:00
parent 79328e826c
commit a8b9ad0333
119 changed files with 1656 additions and 4598 deletions
+70
View File
@@ -39,3 +39,73 @@ function view_notify(notify){
$("#notify").hide();
}, 10000);
}
function isHarmfulContent(text, examples, keywords, similarityThreshold = 0.7) {
var total_score = 0;
// レーベンシュタイン距離を計算
function levenshteinDistance(a, b) {
const dp = Array(a.length + 1).fill().map(() => Array(b.length + 1).fill(0));
for (let i = 0; i <= a.length; i++) dp[i][0] = i;
for (let j = 0; j <= b.length; j++) dp[0][j] = j;
for (let i = 1; i <= a.length; i++) {
for (let j = 1; j <= b.length; j++) {
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
dp[i][j] = Math.min(dp[i - 1][j] + 1, dp[i][j - 1] + 1, dp[i - 1][j - 1] + cost);
}
}
return dp[a.length][b.length];
}
// 類似度スコアを計算
function similarityScore(a, b) {
const distance = levenshteinDistance(a, b);
const maxLength = Math.max(a.length, b.length);
return maxLength === 0 ? 0 : 1 - distance / maxLength;
}
// 文脈的な有害性を判定
function hasHarmfulContext(text, keywords, examples) {
const normalizedText = text.replace(/[!。!?、]/g, '');
let harmfulCharCount = 0;
let nonHarmfulCharCount = normalizedText.length;
const combinedPattern = new RegExp([...keywords, ...examples].join('|'), 'g');
const matches = normalizedText.match(combinedPattern);
if (matches) {
const harmfulText = matches.join('');
harmfulCharCount += harmfulText.length;
nonHarmfulCharCount -= harmfulText.length;
}
if (harmfulCharCount > nonHarmfulCharCount) {
return true;
} else {
return false;
}
}
if (hasHarmfulContext(text, keywords, examples)){
total_score += 1;
}
// 類似度スコアチェック
const textScore = examples.map(example => similarityScore(text, example));
const maxScore = Math.max(...textScore);
if (maxScore >= similarityThreshold) {
total_score += 1;
}
if(total_score >= 1){
return true;
}else{
return false;
}
}
function check_Harmful_ueuse(text){
const examples = ["お前なんかいらない", "死んでしまえ", "無能すぎる", "もう関わるな", "お前マジ死ね", "死ねばいいのに", "死んだほうがいいよ", "よく恥ずかしくないね", "社会の迷惑", "存在価値ないだろ", "死んでくれ", "ほんと馬鹿だから", "話しかけてくんな", "口聞かない", "許さないからな", "なんで生きてるの", "早く死ねよ", "凍結されろ", "BANされろ"];
const keywords = ["死ね", "バカ", "馬鹿", "嫌い", "クズ", "ゴミ", "低能", "無能", "関わるな", "いらない", "消えろ", "殺す", "来るな", "死んで", "死刑", "Fuck", "しね", "下手", "カス", "ますが", "ですが", "ですが何か", "かよ", "荒らし", "黙って", "黙れ", "凍結されろ", "BANされろ"];
return isHarmfulContent(text, examples, keywords)
}
+1 -1
View File
@@ -113,7 +113,7 @@ console.log('errorcode : '+errcode);
if (user_agent_access == 'bad') {
setTimeout(link(), 0);
function link() {
location.href = "../unsupported.php?errcode=" + errcode + "&browser=" + user_agent_browser + "&os=" + user_agent_os + "&cookie=" + user_agent_cookie + "&ssl=" + user_agent_ssl + ""
location.href = "../unsupported.php?errcode=" + errcode + "&browser=" + user_agent_browser + "&os=" + user_agent_os + "&cookie=" + user_agent_cookie + "&ssl=" + user_agent_ssl + "&block=null"
}
}