곰픽 [4-3][4-4] 채점시 레이어 이름을 검색할 경우 유사도 옵션 추가

This commit is contained in:
2025-06-27 17:52:33 +09:00
parent afe8b02625
commit 9aa1425d81
8 changed files with 640 additions and 447 deletions

View File

@@ -498,8 +498,8 @@
}, },
"4": { "4": {
"type": "layer.Effects", "type": "layer.Effects",
"ele": "//Layer[Name[@value='{layer}']]/Effects/Item", "ele": "//Layer[Name[@value='{search}']]/Effects/Item",
"layer": "Flower", "search": "Flower",
"value": { "value": {
"name": "세피아", "name": "세피아",
"option": { "option": {
@@ -557,19 +557,21 @@
"point": 6 "point": 6
}, },
"11": { "11": {
"ele": "none", "type": "none",
"ele": "",
"point": 0, "point": 0,
"desc": "기본설정" "desc": "기본설정"
}, },
"12": { "12": {
"ele": "none", "type": "none",
"ele": "",
"point": 0, "point": 0,
"desc": "파일명 확인" "desc": "파일명 확인"
} }
}, },
"5": { "5": {
"1": { "1": {
"type": "multi", "type": "canvas.Size",
"ele": "//Document/Width/@value | //Document/Height/@value", "ele": "//Document/Width/@value | //Document/Height/@value",
"value": [ "value": [
"650", "650",
@@ -579,7 +581,8 @@
"desc": "캔버스 사이즈 650*450" "desc": "캔버스 사이즈 650*450"
}, },
"2": { "2": {
"ele": "none", "type": "none",
"ele": "",
"point": 5, "point": 5,
"desc": "배경색 문항은 채점 불가" "desc": "배경색 문항은 채점 불가"
}, },
@@ -587,10 +590,12 @@
"type": "exists", "type": "exists",
"ele": "//Layer/MaskOpType/@value", "ele": "//Layer/MaskOpType/@value",
"value": "Layering", "value": "Layering",
"point": 6 "point": 6,
"desc": "레이어 마스크 설정 확인"
}, },
"4": { "4": {
"ele": "none", "type": "none",
"ele": "",
"point": 6, "point": 6,
"desc": "가로방향 흐릿하게 문항은 채점 불가" "desc": "가로방향 흐릿하게 문항은 채점 불가"
}, },
@@ -601,7 +606,7 @@
"point": 3 "point": 3
}, },
"6": { "6": {
"type": "size", "type": "shape.size",
"ele": "//Layer//op_points", "ele": "//Layer//op_points",
"value": { "value": {
"width": 400, "width": 400,
@@ -611,13 +616,13 @@
"desc": "레이어 쉐이프 X, Y 좌표를 가지고 너비, 높이 계산하여 정답 채점" "desc": "레이어 쉐이프 X, Y 좌표를 가지고 너비, 높이 계산하여 정답 채점"
}, },
"7": { "7": {
"type": "gradient", "type": "gradient.color",
"ele": "//Layer/Shapes/Shape", "ele": "//Layer/Shapes/Shape",
"startColor": "gradient_start_color/@value", "startColor": "gradient_start_color/@value",
"endColor": "gradient_end_color/@value", "endColor": "gradient_end_color/@value",
"value": { "value": {
"startColor": "ffe000", "startColor": "ffe000",
"endColor": "34a159" "endColor": "34A159"
}, },
"point": 6 "point": 6
}, },
@@ -647,11 +652,10 @@
"point": 3 "point": 3
}, },
"12": { "12": {
"type": "color", "type": "text.color",
"ele": "//Layer//Shape[shape_type/@value='TEXT'][contains(draw_type/@value, 'Interior')]/secondary_color/@value", "ele": "//Layer//Shape[shape_type/@value='TEXT'][contains(draw_type/@value, 'Interior')]/secondary_color/@value",
"value": "b46ef8", "value": "b46Ef8",
"point": 3, "point": 3
"desc": "색상 코드 비교 시 소문자로 입력할 것"
}, },
"13": { "13": {
"type": "exists", "type": "exists",
@@ -660,14 +664,15 @@
"point": 3 "point": 3
}, },
"14": { "14": {
"type": "color", "type": "text.color",
"ele": "//Layer//Shape[shape_type/@value='TEXT'][contains(draw_type/@value, 'Outline')]/primary_color/@value", "ele": "//Layer//Shape[shape_type/@value='TEXT'][contains(draw_type/@value, 'Outline')]/primary_color/@value",
"value": "ffffff", "value": "ffffff",
"point": 3, "point": 3
"desc": "색상 코드 비교 시 소문자로 입력할 것"
}, },
"15": { "15": {
"ele": "//Layer[MaskOpType/@value='Clipping'][last()]", "type": "exists",
"ele": "//Layer/MaskOpType/@value",
"value": "Clipping",
"point": 6, "point": 6,
"desc": "클리핑 마스크 항목은 별도 레이어로 추가되고 해당 속성을 추가해놓은 레이어가 있는지 여부 체크 함" "desc": "클리핑 마스크 항목은 별도 레이어로 추가되고 해당 속성을 추가해놓은 레이어가 있는지 여부 체크 함"
}, },
@@ -675,11 +680,15 @@
"type": "exists", "type": "exists",
"ele": "//Layer/Shapes/Shape/shape_type/@value", "ele": "//Layer/Shapes/Shape/shape_type/@value",
"value": "RECTANGLE", "value": "RECTANGLE",
"point": 3 "point": 3,
"desc": {
"사각형": "RECTANGLE"
}
}, },
"17": { "17": {
"type": "size", "type": "clipping.size",
"ele": "//Layer//op_points", "ele": "//Layer//Shape[shape_type/@value='{option}']//op_points",
"option": "RECTANGLE",
"value": { "value": {
"width": 150, "width": 150,
"height": 150 "height": 150
@@ -689,27 +698,32 @@
}, },
"18": { "18": {
"type": "exists", "type": "exists",
"ele": "//Layer//outline_peninfo/Width/@value", "ele": "//Layer//Shape[shape_type/@value='{option}']/outline_peninfo/Width/@value",
"option": "RECTANGLE",
"value": "7", "value": "7",
"point": 3 "point": 3
}, },
"19": { "19": {
"type": "color", "type": "clipping.color",
"ele": "//Layer//Shape[contains(draw_type/@value, 'Outline')]/primary_color/@value", "ele": "//Layer//Shape[shape_type/@value='{option}' and contains(draw_type/@value, 'Outline')]/primary_color/@value",
"option": "RECTANGLE",
"value": "e8e88e", "value": "e8e88e",
"point": 3, "point": 3,
"desc": "색상 코드 비교 시 소문자로 입력할 것(채우기:secondary_color, 외곽선:primary_color)" "desc": "채우기:secondary_color, 외곽선:primary_color"
}, },
"20": { "20": {
"type": "shadow", "type": "shadow",
"ele": { "ele": "//Layer//Shape[shape_type/@value='{option}']",
"ele2": {
"shadow": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]", "shadow": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]",
"width": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_width/@value", "width": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_width/@value",
"distance": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_distance/@value", "distance": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_distance/@value",
"blur": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_blur/@value", "blur": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_blur/@value",
"angle": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_angle/@value" "angle": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_angle/@value"
}, },
"option": "RECTANGLE",
"value": { "value": {
"shadow": true,
"width": "3", "width": "3",
"distance": "5", "distance": "5",
"blur": "1", "blur": "1",
@@ -719,12 +733,14 @@
"desc": "그림자 속성이 있는 경우 그림자 속성의 너비, 거리, 흐림 정도, 각도를 비교하여 정답 채점" "desc": "그림자 속성이 있는 경우 그림자 속성의 너비, 거리, 흐림 정도, 각도를 비교하여 정답 채점"
}, },
"21": { "21": {
"ele": "none", "type": "none",
"ele": "",
"point": 0, "point": 0,
"desc": "기본설정" "desc": "기본설정"
}, },
"22": { "22": {
"ele": "none", "type": "none",
"ele": "",
"point": 0, "point": 0,
"desc": "파일명 확인" "desc": "파일명 확인"
} }

View File

@@ -11,16 +11,24 @@ const stringSimilarity = require("string-similarity");
*/ */
function findSimilarString(xmlDoc, targetString, threshold = 0.8) { function findSimilarString(xmlDoc, targetString, threshold = 0.8) {
// XML 내부의 비교 대상 텍스트 리스트 찾기 // XML 내부의 비교 대상 텍스트 리스트 찾기
function getTextNodes(xmlDoc, stringList = []) { function getTextNodes(xmlDoc, paths = ["//CRCUnitArr/@Name"]) {
const stringNodes = xpath.select("//CRCUnitArr/@Name", xmlDoc); const stringList = [];
stringNodes.forEach(stringNode => {
stringList.push(stringNode.value); paths.forEach(path => {
const nodes = xpath.select(path, xmlDoc);
nodes.forEach(node => {
stringList.push(node.value);
});
}); });
return stringList; return stringList;
} }
// XML에서 모든 텍스트 추출 // XML에서 모든 텍스트 추출
const stringList = getTextNodes(xmlDoc); const stringList = getTextNodes(xmlDoc, [
"//CRCUnitArr/@Name",
"//Layer/Name/@value",
]);
// 유사도 비교하여 가장 유사한 문자열 찾기 // 유사도 비교하여 가장 유사한 문자열 찾기
let bestMatch = null; let bestMatch = null;

File diff suppressed because it is too large Load Diff

8
package-lock.json generated
View File

@@ -10,6 +10,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"jsonpath": "^1.1.1", "jsonpath": "^1.1.1",
"loadsh": "^0.0.4",
"psd": "^3.4.0", "psd": "^3.4.0",
"string-similarity": "^4.0.4", "string-similarity": "^4.0.4",
"xlsx": "^0.18.5", "xlsx": "^0.18.5",
@@ -209,6 +210,13 @@
"node": ">= 0.8.0" "node": ">= 0.8.0"
} }
}, },
"node_modules/loadsh": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/loadsh/-/loadsh-0.0.4.tgz",
"integrity": "sha512-U+wLL8InpfRalWrr+0SuhWgGt10M4OyAk6G8xCYo2rwpiHtxZkWiFpjei0vO463ghW8LPCdhqQxXlMy2qicAEw==",
"deprecated": "This is a typosquat on the popular Lodash package. This is not maintained nor is the original Lodash package.",
"license": "MIT"
},
"node_modules/lodash": { "node_modules/lodash": {
"version": "4.17.21", "version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",

View File

@@ -12,6 +12,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"jsonpath": "^1.1.1", "jsonpath": "^1.1.1",
"loadsh": "^0.0.4",
"psd": "^3.4.0", "psd": "^3.4.0",
"string-similarity": "^4.0.4", "string-similarity": "^4.0.4",
"xlsx": "^0.18.5", "xlsx": "^0.18.5",

View File

@@ -9,8 +9,8 @@ const { DOMParser } = require('xmldom');
const findSimilarString = require('./findSimilarString'); const findSimilarString = require('./findSimilarString');
const getGpdpScore = require('./gpdpScoring.js'); const getGpdpScore = require('./gpdpScoring.js');
const getToday = require('./getToday.js'); const getToday = require('./getToday.js');
const { userInfo } = require('os'); // const { userInfo } = require('os');
const { get } = require('http'); // const { get } = require('http');
const todayDate = getToday(); const todayDate = getToday();
const examRound = '2504'; const examRound = '2504';

View File

@@ -1 +1 @@
[{"kind":2,"language":"xpath","value":"//Layer[Name[@value='Tracking']]/Effects/Item/Name/@value"},{"kind":2,"language":"xpath","value":"sum(//CRTrackList[@Name='텍스트' or @Name='비디오2']/CRTrackClip[@ClipIndex=0]/preceding-sibling::CRTrackClip/@Length)"},{"kind":2,"language":"xpath","value":"//CROwneUnit/CRCUnitArr[@Name=\"아름다운 꽃 축제 (Happy Flower Festival)\"]/@Name"},{"kind":2,"language":"xpath","value":"//Layer[Name[@value='{layer}']]/Effects/Item[EffectData/{option}]/Name/@value | //Layer[Name[@value='{layer}']]/Effects/Item/EffectData/{option}/@value"},{"kind":2,"language":"xpath","value":"//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex='3']/@Length"},{"kind":2,"language":"xpath","value":"//CRTransFilter[@ClipIndex=count(//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex=count(//CRClip[@Path='이미지3.jpg']/preceding-sibling::CRClip | //CRClip[@Type='11']/CRCUnitArr[@Path='이미지3.jpg']/../preceding-sibling::CRClip)][1]/preceding-sibling::CRTrackClip)][@Type='2']/@*[name()='ID' or name()='Range' or name()='Type']"},{"kind":2,"language":"xpath","value":"//Document/Width/@value | //Document/Height/@value"},{"kind":2,"language":"xpath","value":"//Layer[Name[@value='Flower']]/Effects/Item[EffectData/VibranceValue]/(Name/@value | EffectData/VibranceValue/@value)"},{"kind":2,"language":"xpath","value":"//Layer[Name[@value='Flower']]/Effects/Item[EffectData/VibranceValue]/Name/@value | //Layer[Name[@value='Flower']]/Effects/Item/EffectData/VibranceValue/@value"}] [{"kind":2,"language":"xpath","value":"//Layer[Name[@value='Tracking']]/Effects/Item/Name/@value"},{"kind":2,"language":"xpath","value":"sum(//CRTrackList[@Name='텍스트' or @Name='비디오2']/CRTrackClip[@ClipIndex=0]/preceding-sibling::CRTrackClip/@Length)"},{"kind":2,"language":"xpath","value":"//CROwneUnit/CRCUnitArr[@Name=\"아름다운 꽃 축제 (Happy Flower Festival)\"]/@Name"},{"kind":2,"language":"xpath","value":"//Layer[Name[@value='{layer}']]/Effects/Item[EffectData/{option}]/Name/@value | //Layer[Name[@value='{layer}']]/Effects/Item/EffectData/{option}/@value"},{"kind":2,"language":"xpath","value":"//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex='3']/@Length"},{"kind":2,"language":"xpath","value":"//CRTransFilter[@ClipIndex=count(//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex=count(//CRClip[@Path='이미지3.jpg']/preceding-sibling::CRClip | //CRClip[@Type='11']/CRCUnitArr[@Path='이미지3.jpg']/../preceding-sibling::CRClip)][1]/preceding-sibling::CRTrackClip)][@Type='2']/@*[name()='ID' or name()='Range' or name()='Type']"},{"kind":2,"language":"xpath","value":"//Layer[MaskOpType/@value='Clipping']"},{"kind":2,"language":"xpath","value":"//Layer//Shape[shape_type/@value='RECTANGLE' and contains(draw_type/@value, 'Outline')]/primary_color/@value"},{"kind":2,"language":"xpath","value":"//Layer[Name[@value='Flower']]/Effects/Item[EffectData/VibranceValue]/Name/@value | //Layer[Name[@value='Flower']]/Effects/Item/EffectData/VibranceValue/@value"}]