곰믹스 자막(3-10)(3-11) 자막텍스트로 ClipIndex 값 구하는 로직 추가

This commit is contained in:
2025-03-21 17:26:51 +09:00
parent 77906aff1d
commit 257df29eee
11 changed files with 56 additions and 1158 deletions

View File

@@ -1,5 +1,5 @@
const xpath = require("xpath");
const { DOMParser } = require("xmldom");
const { DOMParser } = require("xmldom");
const stringSimilarity = require("string-similarity");
/**
@@ -18,7 +18,7 @@ function findSimilarString(xmlDoc, targetString, threshold = 0.8) {
});
return stringList;
}
// XML에서 모든 텍스트 추출
const stringList = getTextNodes(xmlDoc);
@@ -32,13 +32,12 @@ function findSimilarString(xmlDoc, targetString, threshold = 0.8) {
// console.log("🚀 ~ findSimilarString ~ text:", text)
// console.log("🚀 ~ findSimilarString ~ targetString:", targetString)
// console.log("🚀 ~ findSimilarString ~ similarity:", similarity)
if (similarity > highestSimilarity && similarity >= threshold) {
highestSimilarity = similarity;
bestMatch = text;
}
});
return bestMatch;
}