@willwade/aac-processors 0.0.16 → 0.0.18

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.
@@ -0,0 +1,32 @@
1
+ [
2
+ ["I", "like", "to", "be", "here", "with", "you"],
3
+ ["I", "want", "to", "go"],
4
+ ["where", "are", "you", "from"],
5
+ ["I", "see", "a", "pretty", "yellow", "flower"],
6
+ ["yesterday", "I", "went", "to", "the", "doctor"],
7
+ ["I", "like", "to", "sleep", "late"],
8
+ ["what", "is", "your", "favorite", "food"],
9
+ ["when", "do", "you", "want", "to", "help", "me"],
10
+ ["can", "you", "help", "me", "take", "this", "over", "there"],
11
+ ["this", "shirt", "is", "not", "my", "favorite"],
12
+ ["we", "can", "kick", "the", "ball", "out", "back"],
13
+ ["do", "you", "know", "if", "we", "need", "this", "report", "for", "the", "next", "meeting"],
14
+ ["I", "would", "like", "to", "go", "bowling", "after", "the", "movie", "is", "finished"],
15
+ ["he", "should", "set", "an", "alarm", "on", "his", "phone"],
16
+ ["that", "was", "so", "long", "ago", "I", "don't", "remember"],
17
+ ["I", "worry", "that", "the", "electricity", "will", "not", "come", "back", "on"],
18
+ ["she", "might", "need", "a", "travel", "map"],
19
+ ["unless", "you", "would", "rather", "go", "alone"],
20
+ ["we", "can", "make", "a", "pot", "roast", "with", "apple", "pie"],
21
+ ["I", "thought", "it", "was", "in", "the", "cupboard"],
22
+ ["it", "is", "strange", "to", "see", "them", "together", "again"],
23
+ ["that", "is", "such", "a", "big", "deal"],
24
+ ["please", "don't", "fight", "about", "it"],
25
+ ["I", "will", "meet", "with", "my", "accountant", "tomorrow"],
26
+ ["they", "say", "the", "show", "gets", "worse", "before", "it", "gets", "better"],
27
+ ["stir", "it", "well", "first"],
28
+ ["you", "are", "better", "than", "that"],
29
+ ["is", "it", "normal", "to", "miss", "her", "this", "much"],
30
+ ["I", "vote", "we", "sit", "under", "the", "umbrella"],
31
+ ["my", "favorite", "color", "is", "yellow"]
32
+ ]
@@ -0,0 +1,69 @@
1
+ [
2
+ ["1", "one"],
3
+ ["2", "two"],
4
+ ["3", "three"],
5
+ ["4", "four"],
6
+ ["5", "five"],
7
+ ["6", "six"],
8
+ ["7", "seven"],
9
+ ["8", "eight"],
10
+ ["9", "nine"],
11
+ ["10", "ten"],
12
+ ["0", "zero"],
13
+ ["o'clock", "o clock"],
14
+ ["hi", "hello"],
15
+ ["leaf", "leaves"],
16
+ ["egg", "eggs"],
17
+ ["tree", "trees"],
18
+ ["bird", "birds"],
19
+ ["toy", "toys"],
20
+ ["bug", "bugs"],
21
+ ["cow", "cows"],
22
+ ["not", "don't"],
23
+ ["my turn", "turn"],
24
+ ["your turn", "turn"],
25
+ ["afraid", "scared","frightened"],
26
+ ["really", "very"],
27
+ ["kind", "nice"],
28
+ ["mad", "angry"],
29
+ ["grandma", "grandmother"],
30
+ ["grandpa", "grandfather"],
31
+ ["bye", "goodbye", "good bye"],
32
+ ["speech therapist", "speech pathologist", "slp", "speech language pathologist"],
33
+ ["ot", "occupational therapist"],
34
+ ["soda", "soda pop"],
35
+ ["shoe", "shoes"],
36
+ ["sock", "socks"],
37
+ ["clothes", "clothing"],
38
+ ["butt", "bum", "bottom"],
39
+ ["fast", "quick"],
40
+ ["done", "all done", "all gone", "finished"],
41
+ ["divorce", "divorced"],
42
+ ["marriage", "married"],
43
+ ["mom", "mother"],
44
+ ["dad", "father"],
45
+ ["indoors", "inside"],
46
+ ["outdoors", "outside"],
47
+ ["grandma", "grandmother"],
48
+ ["grandpa", "grandfather"],
49
+ ["kid", "child"],
50
+ ["bug", "insect"],
51
+ ["bath tub", "bathtub"],
52
+ ["telephone", "phone"],
53
+ ["eggroll", "egg roll"],
54
+ ["donut", "doughnut"],
55
+ ["all right", "alright"],
56
+ ["ponytail", "pony tail"],
57
+ ["bathing suit", "swimsuit"],
58
+ ["bookstore", "book store"],
59
+ ["post it", "post-it", "post-it note", "sticky note"],
60
+ ["postage stamp", "stamp"],
61
+ ["dog house", "doghouse"],
62
+ ["spade", "shovel"],
63
+ ["4th of July", "Fourth of July"],
64
+ ["rosebud", "rose bud"],
65
+ ["mailbox", "mail box"],
66
+ ["score board", "scoreboard"],
67
+ ["make-up", "makeup"],
68
+ ["l.o.l.", "lol"]
69
+ ]
@@ -35,6 +35,12 @@ export declare class ReferenceLoader {
35
35
  loadBaseWords(): {
36
36
  [word: string]: boolean;
37
37
  };
38
+ /**
39
+ * Load common fringe vocabulary
40
+ * Common words that are NOT in core vocabulary lists
41
+ * (matching Ruby loader.rb:413-420)
42
+ */
43
+ loadCommonFringe(): string[];
38
44
  /**
39
45
  * Get all reference data at once
40
46
  */
@@ -49,3 +55,11 @@ export declare class ReferenceLoader {
49
55
  };
50
56
  };
51
57
  }
58
+ /**
59
+ * Get the default reference data path
60
+ */
61
+ export declare function getReferenceDataPath(): string;
62
+ /**
63
+ * Check if reference data files exist
64
+ */
65
+ export declare function hasReferenceData(): boolean;
@@ -30,12 +30,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
32
  exports.ReferenceLoader = void 0;
33
+ exports.getReferenceDataPath = getReferenceDataPath;
34
+ exports.hasReferenceData = hasReferenceData;
33
35
  const fs = __importStar(require("fs"));
34
36
  const path = __importStar(require("path"));
35
37
  class ReferenceLoader {
36
- constructor(dataDir = path.join(__dirname, 'data'), locale = 'en') {
37
- this.dataDir = dataDir;
38
+ constructor(dataDir, locale = 'en') {
38
39
  this.locale = locale;
40
+ if (dataDir) {
41
+ this.dataDir = dataDir;
42
+ }
43
+ else {
44
+ // Resolve the data directory relative to this file's location
45
+ // Use __dirname which works correctly after compilation
46
+ this.dataDir = path.join(__dirname, 'data');
47
+ }
39
48
  }
40
49
  /**
41
50
  * Load core vocabulary lists
@@ -96,6 +105,23 @@ class ReferenceLoader {
96
105
  const content = fs.readFileSync(filePath, 'utf-8');
97
106
  return JSON.parse(content);
98
107
  }
108
+ /**
109
+ * Load common fringe vocabulary
110
+ * Common words that are NOT in core vocabulary lists
111
+ * (matching Ruby loader.rb:413-420)
112
+ */
113
+ loadCommonFringe() {
114
+ const commonWordsData = this.loadCommonWords();
115
+ const commonWords = new Set(commonWordsData.words.map((w) => w.toLowerCase()));
116
+ const coreLists = this.loadCoreLists();
117
+ const coreWords = new Set();
118
+ coreLists.forEach((list) => {
119
+ list.words.forEach((word) => coreWords.add(word.toLowerCase()));
120
+ });
121
+ // Common fringe = common words - core words
122
+ const commonFringe = Array.from(commonWords).filter((word) => !coreWords.has(word));
123
+ return commonFringe;
124
+ }
99
125
  /**
100
126
  * Get all reference data at once
101
127
  */
@@ -111,3 +137,23 @@ class ReferenceLoader {
111
137
  }
112
138
  }
113
139
  exports.ReferenceLoader = ReferenceLoader;
140
+ /**
141
+ * Get the default reference data path
142
+ */
143
+ function getReferenceDataPath() {
144
+ return path.join(__dirname, 'data');
145
+ }
146
+ /**
147
+ * Check if reference data files exist
148
+ */
149
+ function hasReferenceData() {
150
+ const dataPath = getReferenceDataPath();
151
+ const requiredFiles = [
152
+ 'core_lists.en.json',
153
+ 'common_words.en.json',
154
+ 'sentences.en.json',
155
+ 'synonyms.en.json',
156
+ 'fringe.en.json',
157
+ ];
158
+ return requiredFiles.every((file) => fs.existsSync(path.join(dataPath, file)));
159
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willwade/aac-processors",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "A comprehensive TypeScript library for processing AAC (Augmentative and Alternative Communication) file formats with translation support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -71,9 +71,10 @@
71
71
  "test": "test"
72
72
  },
73
73
  "scripts": {
74
- "build": "rimraf dist && mkdir dist && tsc",
74
+ "build": "rimraf dist && mkdir dist && tsc && npm run copy:assets",
75
75
  "build:watch": "tsc --watch",
76
76
  "clean": "rimraf dist coverage",
77
+ "copy:assets": "cp -r src/utilities/analytics/reference/data dist/utilities/analytics/reference/",
77
78
  "lint": "eslint \"src/**/*.{js,ts}\" \"test/**/*.{js,ts}\"",
78
79
  "lint:fix": "eslint \"src/**/*.{js,ts}\" \"test/**/*.{js,ts}\" --fix",
79
80
  "format": "prettier --write \"src/**/*.{js,ts}\" \"test/**/*.{js,ts}\" \"*.{js,ts,json,md}\"",