@willwade/aac-processors 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/cli/index.js +7 -0
  2. package/dist/core/analyze.js +1 -0
  3. package/dist/core/baseProcessor.d.ts +3 -0
  4. package/dist/core/treeStructure.d.ts +14 -2
  5. package/dist/core/treeStructure.js +8 -2
  6. package/dist/index.d.ts +2 -1
  7. package/dist/index.js +20 -3
  8. package/dist/{analytics → optional/analytics}/history.d.ts +3 -3
  9. package/dist/{analytics → optional/analytics}/history.js +3 -3
  10. package/dist/optional/analytics/index.d.ts +28 -0
  11. package/dist/optional/analytics/index.js +73 -0
  12. package/dist/optional/analytics/metrics/comparison.d.ts +36 -0
  13. package/dist/optional/analytics/metrics/comparison.js +330 -0
  14. package/dist/optional/analytics/metrics/core.d.ts +36 -0
  15. package/dist/optional/analytics/metrics/core.js +422 -0
  16. package/dist/optional/analytics/metrics/effort.d.ts +137 -0
  17. package/dist/optional/analytics/metrics/effort.js +198 -0
  18. package/dist/optional/analytics/metrics/index.d.ts +15 -0
  19. package/dist/optional/analytics/metrics/index.js +36 -0
  20. package/dist/optional/analytics/metrics/sentence.d.ts +49 -0
  21. package/dist/optional/analytics/metrics/sentence.js +112 -0
  22. package/dist/optional/analytics/metrics/types.d.ts +157 -0
  23. package/dist/optional/analytics/metrics/types.js +7 -0
  24. package/dist/optional/analytics/metrics/vocabulary.d.ts +65 -0
  25. package/dist/optional/analytics/metrics/vocabulary.js +140 -0
  26. package/dist/optional/analytics/reference/index.d.ts +51 -0
  27. package/dist/optional/analytics/reference/index.js +102 -0
  28. package/dist/optional/analytics/utils/idGenerator.d.ts +59 -0
  29. package/dist/optional/analytics/utils/idGenerator.js +96 -0
  30. package/dist/processors/gridset/colorUtils.d.ts +18 -0
  31. package/dist/processors/gridset/colorUtils.js +36 -0
  32. package/dist/processors/gridset/commands.d.ts +103 -0
  33. package/dist/processors/gridset/commands.js +958 -0
  34. package/dist/processors/gridset/index.d.ts +45 -0
  35. package/dist/processors/gridset/index.js +153 -0
  36. package/dist/processors/gridset/pluginTypes.d.ts +109 -0
  37. package/dist/processors/gridset/pluginTypes.js +285 -0
  38. package/dist/processors/gridset/resolver.d.ts +13 -0
  39. package/dist/processors/gridset/resolver.js +39 -1
  40. package/dist/processors/gridset/styleHelpers.d.ts +22 -0
  41. package/dist/processors/gridset/styleHelpers.js +35 -1
  42. package/dist/processors/gridset/symbolExtractor.d.ts +121 -0
  43. package/dist/processors/gridset/symbolExtractor.js +362 -0
  44. package/dist/processors/gridset/symbolSearch.d.ts +117 -0
  45. package/dist/processors/gridset/symbolSearch.js +280 -0
  46. package/dist/processors/gridset/symbols.d.ts +199 -0
  47. package/dist/processors/gridset/symbols.js +468 -0
  48. package/dist/processors/gridsetProcessor.js +59 -0
  49. package/dist/processors/index.d.ts +10 -1
  50. package/dist/processors/index.js +93 -2
  51. package/dist/processors/obfProcessor.js +25 -2
  52. package/dist/processors/obfsetProcessor.d.ts +26 -0
  53. package/dist/processors/obfsetProcessor.js +179 -0
  54. package/dist/processors/snapProcessor.js +29 -1
  55. package/dist/processors/touchchatProcessor.js +27 -0
  56. package/dist/types/aac.d.ts +21 -0
  57. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -17,6 +17,13 @@ function detectFormat(filePath) {
17
17
  filePath.endsWith('.ascconfig')) {
18
18
  return 'ascconfig';
19
19
  }
20
+ // Map multi-file formats to their base processor
21
+ if (filePath.endsWith('.obfset')) {
22
+ return 'obf'; // Use ObfProcessor for .obfset files
23
+ }
24
+ if (filePath.endsWith('.gridset')) {
25
+ return 'gridset';
26
+ }
20
27
  // Otherwise use file extension
21
28
  return path_1.default.extname(filePath).slice(1);
22
29
  }
@@ -22,6 +22,7 @@ function getProcessor(format, options) {
22
22
  case 'opml':
23
23
  return new opmlProcessor_1.OpmlProcessor(options);
24
24
  case 'obf':
25
+ case 'obfset': // Obfset files use ObfProcessor
25
26
  return new obfProcessor_1.ObfProcessor(options);
26
27
  case 'touchchat':
27
28
  case 'ce': // TouchChat file extension
@@ -7,6 +7,9 @@ export interface ProcessorOptions {
7
7
  gridsetPassword?: string;
8
8
  customButtonFilter?: (button: AACButton) => boolean;
9
9
  preserveAllButtons?: boolean;
10
+ grid3SymbolDir?: string;
11
+ grid3Path?: string;
12
+ grid3Locale?: string;
10
13
  }
11
14
  export interface ExtractedString {
12
15
  string: string;
@@ -83,6 +83,8 @@ export interface AACSemanticAction {
83
83
  type: 'SPEAK' | 'NAVIGATE' | 'ACTION';
84
84
  message?: string;
85
85
  targetPageId?: string;
86
+ temporary_home?: boolean | string | null;
87
+ add_to_sentence?: boolean;
86
88
  };
87
89
  }
88
90
  export declare class AACButton implements IAACButton {
@@ -115,7 +117,9 @@ export declare class AACButton implements IAACButton {
115
117
  parameters?: {
116
118
  [key: string]: any;
117
119
  };
118
- constructor({ id, label, message, targetPageId, semanticAction, audioRecording, style, contentType, contentSubType, image, resolvedImageEntry, x, y, columnSpan, rowSpan, scanBlocks, visibility, directActivate, parameters, type, action, }: {
120
+ semantic_id?: string;
121
+ clone_id?: string;
122
+ constructor({ id, label, message, targetPageId, semanticAction, audioRecording, style, contentType, contentSubType, image, resolvedImageEntry, symbolLibrary, symbolPath, x, y, columnSpan, rowSpan, scanBlocks, visibility, directActivate, parameters, semantic_id, clone_id, type, action, }: {
119
123
  id: string;
120
124
  label?: string;
121
125
  message?: string;
@@ -132,6 +136,8 @@ export declare class AACButton implements IAACButton {
132
136
  contentSubType?: string;
133
137
  image?: string;
134
138
  resolvedImageEntry?: string;
139
+ symbolLibrary?: string;
140
+ symbolPath?: string;
135
141
  x?: number;
136
142
  y?: number;
137
143
  columnSpan?: number;
@@ -142,6 +148,8 @@ export declare class AACButton implements IAACButton {
142
148
  parameters?: {
143
149
  [key: string]: any;
144
150
  };
151
+ semantic_id?: string;
152
+ clone_id?: string;
145
153
  type?: 'SPEAK' | 'NAVIGATE' | 'ACTION';
146
154
  action?: {
147
155
  type: 'SPEAK' | 'NAVIGATE' | 'ACTION';
@@ -167,7 +175,9 @@ export declare class AACPage implements IAACPage {
167
175
  descriptionHtml?: string;
168
176
  images?: any[];
169
177
  sounds?: any[];
170
- constructor({ id, name, grid, buttons, parentId, style, locale, descriptionHtml, images, sounds, }: {
178
+ semantic_ids?: string[];
179
+ clone_ids?: string[];
180
+ constructor({ id, name, grid, buttons, parentId, style, locale, descriptionHtml, images, sounds, semantic_ids, clone_ids, }: {
171
181
  id: string;
172
182
  name?: string;
173
183
  grid?: Array<Array<AACButton | null>> | {
@@ -181,6 +191,8 @@ export declare class AACPage implements IAACPage {
181
191
  descriptionHtml?: string;
182
192
  images?: any[];
183
193
  sounds?: any[];
194
+ semantic_ids?: string[];
195
+ clone_ids?: string[];
184
196
  });
185
197
  addButton(button: AACButton): void;
186
198
  }
@@ -43,7 +43,7 @@ var AACSemanticIntent;
43
43
  AACSemanticIntent["PLATFORM_SPECIFIC"] = "PLATFORM_SPECIFIC";
44
44
  })(AACSemanticIntent || (exports.AACSemanticIntent = AACSemanticIntent = {}));
45
45
  class AACButton {
46
- constructor({ id, label = '', message = '', targetPageId, semanticAction, audioRecording, style, contentType, contentSubType, image, resolvedImageEntry, x, y, columnSpan, rowSpan, scanBlocks, visibility, directActivate, parameters,
46
+ constructor({ id, label = '', message = '', targetPageId, semanticAction, audioRecording, style, contentType, contentSubType, image, resolvedImageEntry, symbolLibrary, symbolPath, x, y, columnSpan, rowSpan, scanBlocks, visibility, directActivate, parameters, semantic_id, clone_id,
47
47
  // Legacy input support
48
48
  type, action, }) {
49
49
  this.id = id;
@@ -57,6 +57,8 @@ class AACButton {
57
57
  this.contentSubType = contentSubType;
58
58
  this.image = image;
59
59
  this.resolvedImageEntry = resolvedImageEntry;
60
+ this.symbolLibrary = symbolLibrary;
61
+ this.symbolPath = symbolPath;
60
62
  this.x = x;
61
63
  this.y = y;
62
64
  this.columnSpan = columnSpan;
@@ -65,6 +67,8 @@ class AACButton {
65
67
  this.visibility = visibility;
66
68
  this.directActivate = directActivate;
67
69
  this.parameters = parameters;
70
+ this.semantic_id = semantic_id;
71
+ this.clone_id = clone_id;
68
72
  // Legacy mapping: if no semanticAction provided, derive from legacy `action` first
69
73
  if (!this.semanticAction && action) {
70
74
  if (action.type === 'NAVIGATE' && (action.targetPageId || this.targetPageId)) {
@@ -152,7 +156,7 @@ class AACButton {
152
156
  }
153
157
  exports.AACButton = AACButton;
154
158
  class AACPage {
155
- constructor({ id, name = '', grid = [], buttons = [], parentId = null, style, locale, descriptionHtml, images, sounds, }) {
159
+ constructor({ id, name = '', grid = [], buttons = [], parentId = null, style, locale, descriptionHtml, images, sounds, semantic_ids, clone_ids, }) {
156
160
  this.id = id;
157
161
  this.name = name;
158
162
  if (Array.isArray(grid)) {
@@ -173,6 +177,8 @@ class AACPage {
173
177
  this.descriptionHtml = descriptionHtml;
174
178
  this.images = images;
175
179
  this.sounds = sounds;
180
+ this.semantic_ids = semantic_ids;
181
+ this.clone_ids = clone_ids;
176
182
  }
177
183
  addButton(button) {
178
184
  this.buttons.push(button);
package/dist/index.d.ts CHANGED
@@ -2,8 +2,9 @@ export * from './core/treeStructure';
2
2
  export * from './core/baseProcessor';
3
3
  export * from './core/stringCasing';
4
4
  export * from './processors';
5
- export { collectUnifiedHistory, listGrid3Users as listHistoryGrid3Users, listSnapUsers as listHistorySnapUsers, } from './analytics/history';
6
5
  export * from './validation';
6
+ export * as Analytics from './optional/analytics';
7
+ export { collectUnifiedHistory, listGrid3Users as listHistoryGrid3Users, listSnapUsers as listHistorySnapUsers, } from './optional/analytics/history';
7
8
  import { BaseProcessor } from './core/baseProcessor';
8
9
  /**
9
10
  * Factory function to get the appropriate processor for a file extension
package/dist/index.js CHANGED
@@ -10,11 +10,23 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
13
18
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
19
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
20
  };
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
16
28
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.listHistorySnapUsers = exports.listHistoryGrid3Users = exports.collectUnifiedHistory = void 0;
29
+ exports.listHistorySnapUsers = exports.listHistoryGrid3Users = exports.collectUnifiedHistory = exports.Analytics = void 0;
18
30
  exports.getProcessor = getProcessor;
19
31
  exports.getSupportedExtensions = getSupportedExtensions;
20
32
  exports.isExtensionSupported = isExtensionSupported;
@@ -23,11 +35,12 @@ __exportStar(require("./core/treeStructure"), exports);
23
35
  __exportStar(require("./core/baseProcessor"), exports);
24
36
  __exportStar(require("./core/stringCasing"), exports);
25
37
  __exportStar(require("./processors"), exports);
26
- var history_1 = require("./analytics/history");
38
+ __exportStar(require("./validation"), exports);
39
+ exports.Analytics = __importStar(require("./optional/analytics"));
40
+ var history_1 = require("./optional/analytics/history");
27
41
  Object.defineProperty(exports, "collectUnifiedHistory", { enumerable: true, get: function () { return history_1.collectUnifiedHistory; } });
28
42
  Object.defineProperty(exports, "listHistoryGrid3Users", { enumerable: true, get: function () { return history_1.listGrid3Users; } });
29
43
  Object.defineProperty(exports, "listHistorySnapUsers", { enumerable: true, get: function () { return history_1.listSnapUsers; } });
30
- __exportStar(require("./validation"), exports);
31
44
  const dotProcessor_1 = require("./processors/dotProcessor");
32
45
  const excelProcessor_1 = require("./processors/excelProcessor");
33
46
  const opmlProcessor_1 = require("./processors/opmlProcessor");
@@ -37,6 +50,7 @@ const snapProcessor_1 = require("./processors/snapProcessor");
37
50
  const touchchatProcessor_1 = require("./processors/touchchatProcessor");
38
51
  const applePanelsProcessor_1 = require("./processors/applePanelsProcessor");
39
52
  const astericsGridProcessor_1 = require("./processors/astericsGridProcessor");
53
+ const obfsetProcessor_1 = require("./processors/obfsetProcessor");
40
54
  /**
41
55
  * Factory function to get the appropriate processor for a file extension
42
56
  * @param filePathOrExtension - File path or extension (e.g., '.dot', '/path/to/file.obf')
@@ -58,6 +72,8 @@ function getProcessor(filePathOrExtension) {
58
72
  case '.obf':
59
73
  case '.obz':
60
74
  return new obfProcessor_1.ObfProcessor();
75
+ case '.obfset':
76
+ return new obfsetProcessor_1.ObfsetProcessor();
61
77
  case '.gridset':
62
78
  case '.gridsetx':
63
79
  return new gridsetProcessor_1.GridsetProcessor();
@@ -85,6 +101,7 @@ function getSupportedExtensions() {
85
101
  '.opml',
86
102
  '.obf',
87
103
  '.obz',
104
+ '.obfset',
88
105
  '.gridset',
89
106
  '.gridsetx',
90
107
  '.spb',
@@ -1,6 +1,6 @@
1
- import { dotNetTicksToDate } from '../utils/dotnetTicks';
2
- import { Grid3UserPath } from '../processors/gridset/helpers';
3
- import { SnapUserInfo } from '../processors/snap/helpers';
1
+ import { dotNetTicksToDate } from '../../utils/dotnetTicks';
2
+ import { Grid3UserPath } from '../../processors/gridset/helpers';
3
+ import { SnapUserInfo } from '../../processors/snap/helpers';
4
4
  export type HistorySource = 'Grid' | 'Snap';
5
5
  export interface HistoryOccurrence {
6
6
  timestamp: Date;
@@ -9,10 +9,10 @@ exports.readSnapUsageForUser = readSnapUsageForUser;
9
9
  exports.listSnapUsers = listSnapUsers;
10
10
  exports.listGrid3Users = listGrid3Users;
11
11
  exports.collectUnifiedHistory = collectUnifiedHistory;
12
- const dotnetTicks_1 = require("../utils/dotnetTicks");
12
+ const dotnetTicks_1 = require("../../utils/dotnetTicks");
13
13
  Object.defineProperty(exports, "dotNetTicksToDate", { enumerable: true, get: function () { return dotnetTicks_1.dotNetTicksToDate; } });
14
- const helpers_1 = require("../processors/gridset/helpers");
15
- const helpers_2 = require("../processors/snap/helpers");
14
+ const helpers_1 = require("../../processors/gridset/helpers");
15
+ const helpers_2 = require("../../processors/snap/helpers");
16
16
  /**
17
17
  * Read Grid 3 phrase history from a history.sqlite database and tag entries with their source.
18
18
  */
@@ -0,0 +1,28 @@
1
+ /**
2
+ * AAC Analytics Module (Optional)
3
+ *
4
+ * This module provides metrics calculation and analysis for AAC board sets.
5
+ * The core types, utilities, and effort functions are always available.
6
+ *
7
+ * This module is similar to symbolTools - the functionality is here but
8
+ * you only use it if you need it. No special installation required.
9
+ *
10
+ * @module
11
+ */
12
+ export * from './metrics/types';
13
+ export * from './metrics/effort';
14
+ export * from './utils/idGenerator';
15
+ export * from './history';
16
+ export { MetricsCalculator } from './metrics/core';
17
+ export { VocabularyAnalyzer } from './metrics/vocabulary';
18
+ export { SentenceAnalyzer } from './metrics/sentence';
19
+ export { ComparisonAnalyzer } from './metrics/comparison';
20
+ export { ReferenceLoader } from './reference';
21
+ /**
22
+ * Get the default reference data path
23
+ */
24
+ export declare function getReferenceDataPath(): string;
25
+ /**
26
+ * Check if reference data files exist
27
+ */
28
+ export declare function hasReferenceData(): boolean;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ /**
3
+ * AAC Analytics Module (Optional)
4
+ *
5
+ * This module provides metrics calculation and analysis for AAC board sets.
6
+ * The core types, utilities, and effort functions are always available.
7
+ *
8
+ * This module is similar to symbolTools - the functionality is here but
9
+ * you only use it if you need it. No special installation required.
10
+ *
11
+ * @module
12
+ */
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
+ };
27
+ var __importDefault = (this && this.__importDefault) || function (mod) {
28
+ return (mod && mod.__esModule) ? mod : { "default": mod };
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.ReferenceLoader = exports.ComparisonAnalyzer = exports.SentenceAnalyzer = exports.VocabularyAnalyzer = exports.MetricsCalculator = void 0;
32
+ exports.getReferenceDataPath = getReferenceDataPath;
33
+ exports.hasReferenceData = hasReferenceData;
34
+ const path_1 = __importDefault(require("path"));
35
+ const fs_1 = __importDefault(require("fs"));
36
+ // Always-available exports
37
+ __exportStar(require("./metrics/types"), exports);
38
+ __exportStar(require("./metrics/effort"), exports);
39
+ __exportStar(require("./utils/idGenerator"), exports);
40
+ // Export history functionality
41
+ __exportStar(require("./history"), exports);
42
+ // Export core metrics calculator
43
+ var core_1 = require("./metrics/core");
44
+ Object.defineProperty(exports, "MetricsCalculator", { enumerable: true, get: function () { return core_1.MetricsCalculator; } });
45
+ // Export vocabulary and comparison analyzers
46
+ var vocabulary_1 = require("./metrics/vocabulary");
47
+ Object.defineProperty(exports, "VocabularyAnalyzer", { enumerable: true, get: function () { return vocabulary_1.VocabularyAnalyzer; } });
48
+ var sentence_1 = require("./metrics/sentence");
49
+ Object.defineProperty(exports, "SentenceAnalyzer", { enumerable: true, get: function () { return sentence_1.SentenceAnalyzer; } });
50
+ var comparison_1 = require("./metrics/comparison");
51
+ Object.defineProperty(exports, "ComparisonAnalyzer", { enumerable: true, get: function () { return comparison_1.ComparisonAnalyzer; } });
52
+ var reference_1 = require("./reference");
53
+ Object.defineProperty(exports, "ReferenceLoader", { enumerable: true, get: function () { return reference_1.ReferenceLoader; } });
54
+ /**
55
+ * Get the default reference data path
56
+ */
57
+ function getReferenceDataPath() {
58
+ return path_1.default.join(__dirname, 'reference', 'data');
59
+ }
60
+ /**
61
+ * Check if reference data files exist
62
+ */
63
+ function hasReferenceData() {
64
+ const dataPath = getReferenceDataPath();
65
+ const requiredFiles = [
66
+ 'core_lists.en.json',
67
+ 'common_words.en.json',
68
+ 'sentences.en.json',
69
+ 'synonyms.en.json',
70
+ 'fringe.en.json',
71
+ ];
72
+ return requiredFiles.every((file) => fs_1.default.existsSync(path_1.default.join(dataPath, file)));
73
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Comparative Analysis
3
+ *
4
+ * Compares two AAC board sets to identify missing/extra words,
5
+ * analyze vocabulary differences, and generate CARE component scores.
6
+ */
7
+ import { MetricsResult, ComparisonResult } from './types';
8
+ export declare class ComparisonAnalyzer {
9
+ private vocabAnalyzer;
10
+ private sentenceAnalyzer;
11
+ private referenceLoader;
12
+ constructor();
13
+ /**
14
+ * Compare two board sets
15
+ */
16
+ compare(targetResult: MetricsResult, compareResult: MetricsResult, options?: {
17
+ includeSentences?: boolean;
18
+ locale?: string;
19
+ }): ComparisonResult;
20
+ /**
21
+ * Calculate CARE component scores
22
+ */
23
+ private calculateCareComponents;
24
+ /**
25
+ * Analyze fringe vocabulary
26
+ */
27
+ private analyzeFringe;
28
+ /**
29
+ * Analyze common fringe vocabulary
30
+ */
31
+ private analyzeCommonFringe;
32
+ /**
33
+ * Calculate overall effort score for a metrics result
34
+ */
35
+ private calculateEffortScore;
36
+ }