@willwade/aac-processors 0.0.11 → 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 (38) hide show
  1. package/dist/cli/index.js +7 -0
  2. package/dist/core/analyze.js +1 -0
  3. package/dist/core/treeStructure.d.ts +12 -2
  4. package/dist/core/treeStructure.js +6 -2
  5. package/dist/index.d.ts +2 -1
  6. package/dist/index.js +20 -3
  7. package/dist/{analytics → optional/analytics}/history.d.ts +3 -3
  8. package/dist/{analytics → optional/analytics}/history.js +3 -3
  9. package/dist/optional/analytics/index.d.ts +28 -0
  10. package/dist/optional/analytics/index.js +73 -0
  11. package/dist/optional/analytics/metrics/comparison.d.ts +36 -0
  12. package/dist/optional/analytics/metrics/comparison.js +330 -0
  13. package/dist/optional/analytics/metrics/core.d.ts +36 -0
  14. package/dist/optional/analytics/metrics/core.js +422 -0
  15. package/dist/optional/analytics/metrics/effort.d.ts +137 -0
  16. package/dist/optional/analytics/metrics/effort.js +198 -0
  17. package/dist/optional/analytics/metrics/index.d.ts +15 -0
  18. package/dist/optional/analytics/metrics/index.js +36 -0
  19. package/dist/optional/analytics/metrics/sentence.d.ts +49 -0
  20. package/dist/optional/analytics/metrics/sentence.js +112 -0
  21. package/dist/optional/analytics/metrics/types.d.ts +157 -0
  22. package/dist/optional/analytics/metrics/types.js +7 -0
  23. package/dist/optional/analytics/metrics/vocabulary.d.ts +65 -0
  24. package/dist/optional/analytics/metrics/vocabulary.js +140 -0
  25. package/dist/optional/analytics/reference/index.d.ts +51 -0
  26. package/dist/optional/analytics/reference/index.js +102 -0
  27. package/dist/optional/analytics/utils/idGenerator.d.ts +59 -0
  28. package/dist/optional/analytics/utils/idGenerator.js +96 -0
  29. package/dist/processors/gridsetProcessor.js +25 -0
  30. package/dist/processors/index.d.ts +1 -0
  31. package/dist/processors/index.js +5 -3
  32. package/dist/processors/obfProcessor.js +25 -2
  33. package/dist/processors/obfsetProcessor.d.ts +26 -0
  34. package/dist/processors/obfsetProcessor.js +179 -0
  35. package/dist/processors/snapProcessor.js +29 -1
  36. package/dist/processors/touchchatProcessor.js +27 -0
  37. package/dist/types/aac.d.ts +4 -0
  38. 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
@@ -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, symbolLibrary, symbolPath, 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;
@@ -144,6 +148,8 @@ export declare class AACButton implements IAACButton {
144
148
  parameters?: {
145
149
  [key: string]: any;
146
150
  };
151
+ semantic_id?: string;
152
+ clone_id?: string;
147
153
  type?: 'SPEAK' | 'NAVIGATE' | 'ACTION';
148
154
  action?: {
149
155
  type: 'SPEAK' | 'NAVIGATE' | 'ACTION';
@@ -169,7 +175,9 @@ export declare class AACPage implements IAACPage {
169
175
  descriptionHtml?: string;
170
176
  images?: any[];
171
177
  sounds?: any[];
172
- 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, }: {
173
181
  id: string;
174
182
  name?: string;
175
183
  grid?: Array<Array<AACButton | null>> | {
@@ -183,6 +191,8 @@ export declare class AACPage implements IAACPage {
183
191
  descriptionHtml?: string;
184
192
  images?: any[];
185
193
  sounds?: any[];
194
+ semantic_ids?: string[];
195
+ clone_ids?: string[];
186
196
  });
187
197
  addButton(button: AACButton): void;
188
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, symbolLibrary, symbolPath, 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;
@@ -67,6 +67,8 @@ class AACButton {
67
67
  this.visibility = visibility;
68
68
  this.directActivate = directActivate;
69
69
  this.parameters = parameters;
70
+ this.semantic_id = semantic_id;
71
+ this.clone_id = clone_id;
70
72
  // Legacy mapping: if no semanticAction provided, derive from legacy `action` first
71
73
  if (!this.semanticAction && action) {
72
74
  if (action.type === 'NAVIGATE' && (action.targetPageId || this.targetPageId)) {
@@ -154,7 +156,7 @@ class AACButton {
154
156
  }
155
157
  exports.AACButton = AACButton;
156
158
  class AACPage {
157
- 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, }) {
158
160
  this.id = id;
159
161
  this.name = name;
160
162
  if (Array.isArray(grid)) {
@@ -175,6 +177,8 @@ class AACPage {
175
177
  this.descriptionHtml = descriptionHtml;
176
178
  this.images = images;
177
179
  this.sounds = sounds;
180
+ this.semantic_ids = semantic_ids;
181
+ this.clone_ids = clone_ids;
178
182
  }
179
183
  addButton(button) {
180
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
+ }