conlangers-suite-test 1.0.6

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 (34) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -0
  3. package/dist/collator.d.ts +5 -0
  4. package/dist/conlangers-suite-test.cjs.js +771 -0
  5. package/dist/conlangers-suite-test.es.js +6073 -0
  6. package/dist/escape_mapper.d.ts +11 -0
  7. package/dist/generata/supra_builder.d.ts +14 -0
  8. package/dist/generata/word_builder.d.ts +23 -0
  9. package/dist/index.d.ts +6 -0
  10. package/dist/logger.d.ts +45 -0
  11. package/dist/main.d.ts +22 -0
  12. package/dist/parser.d.ts +79 -0
  13. package/dist/resolvers/canon_graphemes_resolver.d.ts +14 -0
  14. package/dist/resolvers/category_resolver.d.ts +26 -0
  15. package/dist/resolvers/feature_resolver.d.ts +23 -0
  16. package/dist/resolvers/generation_resolver.d.ts +34 -0
  17. package/dist/resolvers/nesca_grammar_stream.d.ts +15 -0
  18. package/dist/resolvers/trans_category_resolver.d.ts +15 -0
  19. package/dist/resolvers/transform_resolver.d.ts +63 -0
  20. package/dist/text_builder.d.ts +31 -0
  21. package/dist/transforma/carryover_associator.d.ts +11 -0
  22. package/dist/transforma/chance_mapper.d.ts +15 -0
  23. package/dist/transforma/greek.d.ts +2 -0
  24. package/dist/transforma/hangul.d.ts +3 -0
  25. package/dist/transforma/lettercase_mapper.d.ts +12 -0
  26. package/dist/transforma/reference_mapper.d.ts +14 -0
  27. package/dist/transforma/transformer.d.ts +66 -0
  28. package/dist/transforma/xsampa.d.ts +3 -0
  29. package/dist/utils/picker_utilities.d.ts +4 -0
  30. package/dist/utils/types.d.ts +161 -0
  31. package/dist/utils/utilities.d.ts +12 -0
  32. package/dist/word.d.ts +19 -0
  33. package/dist/word_bank.d.ts +27 -0
  34. package/package.json +92 -0
@@ -0,0 +1,161 @@
1
+ export type App = "vocabug" | "nesca";
2
+ export type Log = {
3
+ payload: string;
4
+ errors: string[];
5
+ warnings: string[];
6
+ infos: string[];
7
+ diagnostics: string[];
8
+ };
9
+ export type Association = {
10
+ entry_id: number;
11
+ base_id: number;
12
+ variant_id: number;
13
+ is_target: boolean;
14
+ };
15
+ export type Schema = {
16
+ fields: string[];
17
+ delimiters: string[];
18
+ };
19
+ export type Word_Step = {
20
+ action: string | null;
21
+ form: string | null;
22
+ line_num: number | null;
23
+ };
24
+ export type Token = {
25
+ type: "pending";
26
+ base: string;
27
+ min: number;
28
+ max: number | typeof Infinity;
29
+ } | {
30
+ type: "grapheme";
31
+ base: string;
32
+ min: number;
33
+ max: number | typeof Infinity;
34
+ escaped?: boolean;
35
+ named_reference_bind?: string;
36
+ association?: Association;
37
+ } | {
38
+ type: "wildcard";
39
+ base: "*";
40
+ min: number;
41
+ max: number | typeof Infinity;
42
+ named_reference_bind?: string;
43
+ } | {
44
+ type: "anythings-mark";
45
+ base: "%";
46
+ min: number;
47
+ max: number | typeof Infinity;
48
+ consume?: string[][];
49
+ blocked_by?: string[][];
50
+ } | {
51
+ type: "deletion";
52
+ base: "^";
53
+ } | {
54
+ type: "insertion";
55
+ base: "^";
56
+ } | {
57
+ type: "reject";
58
+ base: "0";
59
+ } | {
60
+ type: "word-boundary";
61
+ base: "#";
62
+ min: number;
63
+ max: number | typeof Infinity;
64
+ } | {
65
+ type: "syllable-boundary";
66
+ base: "$";
67
+ min: number;
68
+ max: number | typeof Infinity;
69
+ } | {
70
+ type: "routine";
71
+ base: string;
72
+ routine: string;
73
+ } | {
74
+ type: "target-mark";
75
+ base: "&T";
76
+ min: number;
77
+ max: number | typeof Infinity;
78
+ } | {
79
+ type: "metathesis-mark";
80
+ base: "&M";
81
+ min: number;
82
+ max: number | typeof Infinity;
83
+ } | {
84
+ type: "empty-mark";
85
+ base: "&E";
86
+ min: number;
87
+ max: number | typeof Infinity;
88
+ } | {
89
+ type: "based-mark";
90
+ base: "~";
91
+ min: number;
92
+ max: number | typeof Infinity;
93
+ } | {
94
+ type: "reference-start-capture";
95
+ base: "&=";
96
+ min: number;
97
+ max: number | typeof Infinity;
98
+ } | {
99
+ type: "reference-capture";
100
+ base: string;
101
+ key: string;
102
+ min: number;
103
+ max: number | typeof Infinity;
104
+ } | {
105
+ type: "reference-mark";
106
+ base: string;
107
+ key: string;
108
+ min: number;
109
+ max: number | typeof Infinity;
110
+ };
111
+ export type Transform = {
112
+ t_type: "rule" | "cluster-field" | Routine;
113
+ target: Token[][];
114
+ result: Token[][];
115
+ conditions: {
116
+ before: Token[];
117
+ after: Token[];
118
+ }[];
119
+ exceptions: {
120
+ before: Token[];
121
+ after: Token[];
122
+ }[];
123
+ chance: number | null;
124
+ line_num: number;
125
+ };
126
+ export type Transform_Pending = {
127
+ t_type: "rule" | "cluster-field" | Routine;
128
+ target: string;
129
+ result: string;
130
+ conditions: string[];
131
+ exceptions: string[];
132
+ chance: number | null;
133
+ line_num: number;
134
+ };
135
+ export type Stage = {
136
+ name: string;
137
+ transforms: Transform[];
138
+ };
139
+ export type Sub_Stage = {
140
+ name: string;
141
+ transforms: Transform[];
142
+ };
143
+ export type Token_Stream_Mode = "TARGET" | "RESULT" | "BEFORE" | "AFTER";
144
+ export type Output_Mode = "word-list" | "debug" | "paragraph" | "old-to-new";
145
+ export type Distribution = "gusein-zade" | "zipfian" | "shallow" | "flat";
146
+ export type Directive = "categories" | "words" | "units" | "alphabet" | "invisible" | "graphemes" | "syllable-boundaries" | "features" | "feature-field" | "stage" | "letter-case-field" | "schema" | "none";
147
+ export declare const directive_check: string[];
148
+ export type Routine = "decompose" | "compose" | "capitalise" | "decapitalise" | "to-uppercase" | "to-lowercase" | "xsampa-to-ipa" | "ipa-to-xsampa" | "latin-to-hangul" | "hangul-to-latin" | "greek-to-latin" | "latin-to-greek" | "reverse";
149
+ export declare const SYNTAX_CHARS: string[];
150
+ export declare const SYNTAX_CHARS_AND_CARET: string[];
151
+ export type Carryover_Associations = {
152
+ entry_id: number;
153
+ base_id: number;
154
+ variant_id: number;
155
+ }[];
156
+ interface Associateme_Entry {
157
+ bases: string[];
158
+ variants: string[][];
159
+ }
160
+ export type Associateme_Mapper = Associateme_Entry[];
161
+ export {};
@@ -0,0 +1,12 @@
1
+ export declare const cappa: string;
2
+ export declare const get_last: <T = never>(arr: ArrayLike<T> | null | undefined) => T | undefined;
3
+ export declare const get_first: <T = never>(arr: ArrayLike<T> | null | undefined) => T | undefined;
4
+ export declare const make_percentage: (input: string) => number | null;
5
+ export declare function swap_first_last_items(array: string[]): string[];
6
+ export declare function reverse_items(array: string[]): string[];
7
+ export declare function final_sentence(items: string[]): string;
8
+ export declare function recursive_expansion(input: string, mappings: Map<string, {
9
+ content: string;
10
+ line_num: number;
11
+ }>, enclose_in_brackets?: boolean): string;
12
+ export declare function graphemosis(input: string, canon_graphemes: string[]): string[];
package/dist/word.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import type { Output_Mode, Word_Step } from "./utils/types";
2
+ declare class Word {
3
+ static output_mode: Output_Mode;
4
+ current_form: string;
5
+ rejected: boolean;
6
+ num_of_transformations: number;
7
+ steps: Word_Step[];
8
+ field_values: Record<string, string>;
9
+ static fields: string[];
10
+ static field_delimiters: string[];
11
+ constructor(action: string | null, fields: Record<string, string>);
12
+ get_last_form(): string;
13
+ get_word(): string;
14
+ private recombine_word_by_schema;
15
+ record_transformation(transformation: string, form: string, line_num: number): void;
16
+ record_output(): void;
17
+ record_step(action: string | null, form: string | null, line_num: number | null): void;
18
+ }
19
+ export default Word;
@@ -0,0 +1,27 @@
1
+ import Word from "./word";
2
+ import Logger from "./logger";
3
+ import type { Output_Mode, Schema } from "./utils/types";
4
+ import Lettercase_Mapper from "./transforma/lettercase_mapper";
5
+ declare class Word_Bank {
6
+ logger: Logger;
7
+ private lettercase_mapper;
8
+ build_start: number;
9
+ schema_input: Schema;
10
+ schema_output: Schema;
11
+ words: Word[];
12
+ private input_divider;
13
+ private output_divider;
14
+ private num_of_rejects;
15
+ private num_of_transformed;
16
+ private num_of_passed;
17
+ private output_mode;
18
+ sort_words: boolean;
19
+ alphabet: string[];
20
+ invisible: string[];
21
+ constructor(logger: Logger, lettercase_mapper: Lettercase_Mapper, build_start: number, schema_input: Schema, schema_output: Schema, input_words: string, input_divider: string, output_mode: Output_Mode, output_divider: string, sort_words: boolean, alphabet: string[], invisible: string[]);
22
+ make_text(): string;
23
+ private split_word_by_schema;
24
+ create_record(): void;
25
+ show_debug(): void;
26
+ }
27
+ export default Word_Bank;
package/package.json ADDED
@@ -0,0 +1,92 @@
1
+ {
2
+ "name": "conlangers-suite-test",
3
+ "version": "1.0.6",
4
+ "type": "module",
5
+ "description": "Vocabulary generator and sound change applier",
6
+ "author": "Neonnaut",
7
+ "license": "MIT",
8
+ "homepage": "https://neonnaut.neocities.org/",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Neonnaut/the-conlangers-suite.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/Neonnaut/the-conlangers-suite/issues"
15
+ },
16
+ "keywords": [
17
+ "conlang",
18
+ "word generator",
19
+ "wordgen",
20
+ "words",
21
+ "vocabulary",
22
+ "vocabug",
23
+ "nesca",
24
+ "sound change applier"
25
+ ],
26
+ "scripts": {
27
+ "build": "node build.js",
28
+
29
+ "lint": "eslint ./ --fix",
30
+ "format": "prettier --write 'src/**/*.{ts,js,json,md}'",
31
+ "test": "vitest run",
32
+ "build:ts": "tsc && vite build",
33
+ "build:win": "tsc.cmd",
34
+
35
+ "dev-vocabug": "vite --config app/vocabug/vite.config.ts",
36
+ "dev-nesca": "vite --config app/nesca/vite.config.ts",
37
+
38
+ "build:app-vocabug": "vite build --config app/vocabug/vite.config.js",
39
+ "build:app-nesca": "vite build --config app/nesca/vite.config.js",
40
+
41
+ "build:cli-vocabug": "tsup bin/vocabug/index.ts --format esm --no-dts minify --target node18 --out-dir bin/vocabug",
42
+ "build:cli-nesca": "tsup bin/nesca/index.ts --format esm --no-dts minify --target node18 --out-dir bin/nesca",
43
+
44
+ "build:cm6-vocabug": "cd codemirror && npx rollup src/editor.ts -f iife -o ../app/vocabug/cm6.bundle.js -p @rollup/plugin-node-resolve -p @rollup/plugin-typescript --output.name cm6",
45
+ "build:cm6-nesca": "cd codemirror && npx rollup src/editor.ts -f iife -o ../app/nesca/cm6.bundle.js -p @rollup/plugin-node-resolve -p @rollup/plugin-typescript --output.name cm6"
46
+ },
47
+ "devDependencies": {
48
+ "@eslint/eslintrc": "^3.3.1",
49
+ "@eslint/js": "^9.37.0",
50
+ "@types/node": "^24.0.12",
51
+ "@types/yargs": "^17.0.33",
52
+ "eslint": "^9.37.0",
53
+ "eslint-config-prettier": "^10.1.8",
54
+ "eslint-plugin-prettier": "^5.5.4",
55
+ "eslint-plugin-unicorn": "^61.0.2",
56
+ "globals": "^16.4.0",
57
+ "jiti": "^2.6.1",
58
+ "prettier": "3.6.2",
59
+ "rollup": "^4.53.5",
60
+ "terser": "^5.44.0",
61
+ "tsup": "^8.5.1",
62
+ "typescript": "~5.8.3",
63
+ "typescript-eslint": "^8.46.0",
64
+ "vite": "^6.3.5",
65
+ "vite-plugin-banner": "^0.8.1",
66
+ "vite-plugin-dts": "^4.5.4",
67
+ "vitest": "^3.2.4"
68
+ },
69
+ "main": "./dist/vocabug.cjs.js",
70
+ "module": "./dist/vocabug.es.js",
71
+ "types": "./dist/index.d.ts",
72
+ "exports": {
73
+ ".": {
74
+ "import": "./dist/vocabug.es.js",
75
+ "require": "./dist/vocabug.cjs.js"
76
+ }
77
+ },
78
+ "files": [
79
+ "dist",
80
+ "LICENSE",
81
+ "README"
82
+ ],
83
+ "bin": {
84
+ "vocabug": "bin/index.js",
85
+ "nesca": "bin/index.js"
86
+ },
87
+ "dependencies": {
88
+ "@rollup/plugin-node-resolve": "^16.0.1",
89
+ "@typescript-eslint/eslint-plugin": "^8.46.0",
90
+ "yargs": "^18.0.0"
91
+ }
92
+ }