텍스트 유사도 검사 기능 추가

This commit is contained in:
2025-02-07 17:33:38 +09:00
parent 7a95ac4de3
commit 42b91003e8
16 changed files with 499 additions and 33 deletions

View File

@@ -6,20 +6,28 @@ const path = require('path');
const xpath = require('xpath');
const { DOMParser } = require('xmldom');
// 복사된 답안 파일 폴더
const answerFilesDir = './output/B/DIC/';
const sampleDir = './output/C/DIC/';
const students = fs.readdirSync(sampleDir);
// 답안 폴더 내부에 디렉토리가 아닌 일반 파일이 있을 경우 디렉토리만 필터링 해서 불러옴
const studentDirs = fs.readdirSync(answerFilesDir).filter(file => {
const filePath = path.join(answerFilesDir, file);
return fs.statSync(filePath).isDirectory();
});
//const students = fs.readdirSync(answerFilesDir);
// 기준표 파일 읽기
const scoring = require('./제2501회 정기 DIC C형.json');
const scoring = require('./제2501회 정기 DIC B형.json');
const psdData = [];
// 채점 결과 리스트
const gradingResults = [];
students.forEach(student => {
studentDirs.forEach(student => {
// 맥에서 한글 디렉토리 이름을 읽어서 엑셀에 저장 할 시 자소 분리가 되어 저장되는 문제 노말라이즈해서 해결
const name = student.normalize('NFC');
const studentDir = path.join(sampleDir, student);
const studentDir = path.join(answerFilesDir, student);
const psdFiles = fs.readdirSync(studentDir).filter(file => file.endsWith('.psd'));
const gmepFile = fs.readdirSync(studentDir).filter(file => file.endsWith('.gmep'));