const fs = require('fs'); const path = require('path'); const base_path = 'doc/curtis/prompt/scanimpl_analysis'; const inputFile = path.join(base_path, 'step2_classified_methods.json'); const modules = [ 'ScannerController', 'BusinessLogic', 'ImageProcessor', 'TransportManager', 'UIView' ]; function disaggregate() { const classifiedMethods = JSON.parse(fs.readFileSync(inputFile, 'utf8')); modules.forEach(mod => { // If any of the tags is the module name, it belongs to this module const filtered = classifiedMethods.filter(m => m.tags && m.tags.includes(mod)); const outputFile = path.join(base_path, `scanimpl_annalysis.${mod}.json`); fs.writeFileSync(outputFile, JSON.stringify(filtered, null, 2), 'utf8'); console.log(`Saved ${filtered.length} methods to ${outputFile}`); }); } disaggregate();