1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| 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();
|
|