@@ -33,9 +33,10 @@ export class SigilQuery {
33 this.symbols.forEach((symbol, i) => {
33 this.symbols.forEach((symbol, i) => {
34 if (i % 2 === 0) {
34 if (i % 2 === 0) {
35 symbol.symbolType = 'prefix';
35 symbol.symbolType = 'prefix';
36+ // symbol.components = ['gci', 'lhf'];
37 symbol.symbolType = 'suffix';
38 symbol.symbolType = 'suffix';
38− // symbol.components = ['gsq', 'ablf2']
39+ // symbol.components = ['gsq', 'atrf4'];
41 this.symbols = this.symbols;
42 this.symbols = this.symbols;
@@ -50,13 +51,17 @@ export class SigilQuery {
52 get isPlausible() {
53 get isPlausible() {
53− return this.activeSymbols.every(symbol => !symbol.isPlausible);
54+ return this.activeSymbols.every(symbol => symbol.isPlausible);
56 get querySyls(): string[][] {
57 get querySyls(): string[][] {
57 return this.activeSymbols.map(symbol => symbol.plausibleSyllables);
58 return this.activeSymbols.map(symbol => symbol.plausibleSyllables);
61+ get queryInts(): number[][] {
62+ return this.activeSymbols.map(symbol => symbol.plausibleInts);
60 get isDefinitive() {
65 get isDefinitive() {
61 return this.querySyls.every(syls => syls.length === 1);
66 return this.querySyls.every(syls => syls.length === 1);
@@ -65,8 +70,14 @@ export class SigilQuery {
65 return this.activeSymbols.some(symbol => symbol.components.length > 0);
70 return this.activeSymbols.some(symbol => symbol.components.length > 0);
73+ get isWorthSearching() {
74+ if (!this.isNotEmpty) return false; // 🙃
75+ if (!this.isPlausible) return false;
76+ return 100000 > this.querySyls.reduce((acc, syls) => acc * (syls.length || 256), 1);
68 get string(): string {
79 get string(): string {
69− return this.symbols.map((symbol) => symbol.components.join(',')).join('|')
80+ return this.queryInts.map((int) => int.length == 256 ? 'any' : int.join('.')).join('_');
72 setSymbol(symbol: SymbolQuery, activeSymbolIndex: number) {
83 setSymbol(symbol: SymbolQuery, activeSymbolIndex: number) {
@@ -92,15 +103,18 @@ function addEquivalentParts(parts: string[]): string[] {
92 return [...parts, ...moreParts];
103 return [...parts, ...moreParts];
95−export function getPlausibleSyllables(parts: string[], symbolType: SymbolType): string[] {
106+function getSyllablesBySymbolType(symbolType: SymbolType): string[] {
96− let plausibleSyllables: string[];
97 if (symbolType === 'prefix') {
107 if (symbolType === 'prefix') {
98− plausibleSyllables = prefixes;
108+ return prefixes;
99 } else if (symbolType === 'suffix') {
109 } else if (symbolType === 'suffix') {
100− plausibleSyllables = suffixes;
110+ return suffixes;
102− plausibleSyllables = [...prefixes, ...suffixes];
112+ return [...prefixes, ...suffixes];
116+export function getPlausibleSyllables(parts: string[], symbolType: SymbolType): string[] {
117+ let plausibleSyllables = getSyllablesBySymbolType(symbolType);
104 const possibilitiesByPart = parts.map((partId) => {
118 const possibilitiesByPart = parts.map((partId) => {
105 let parents = partParents[partId];
119 let parents = partParents[partId];
106 const otherPart = equivalentParts[partId];
120 const otherPart = equivalentParts[partId];
@@ -113,6 +127,11 @@ export function getPlausibleSyllables(parts: string[], symbolType: SymbolType):
113 return plausibleSyllables;
127 return plausibleSyllables;
130+function convertSyllableToInt(syl: string, symbolType: SymbolType): number {
131+ let syls = getSyllablesBySymbolType(symbolType);
132+ return syls.findIndex(s => s === syl) % 256;
116export function getPlausibleNewParts(parts: string[], symbolType: SymbolType): string[] {
135export function getPlausibleNewParts(parts: string[], symbolType: SymbolType): string[] {
117 const syllables: string[] = getPlausibleSyllables(parts, symbolType);
136 const syllables: string[] = getPlausibleSyllables(parts, symbolType);
118 let plausibleParts = uniq(syllables.map((syllable) => symbolDefs[syllable]).flat());
137 let plausibleParts = uniq(syllables.map((syllable) => symbolDefs[syllable]).flat());
@@ -205,6 +224,10 @@ export class SymbolQuery {
205 return getPlausibleSyllables(this.components, this.symbolType);
224 return getPlausibleSyllables(this.components, this.symbolType);
227+ get plausibleInts() {
228+ return this.plausibleSyllables.map(syl => convertSyllableToInt(syl, this.symbolType));
208 get isPlausible() {
231 get isPlausible() {
209 return this.plausibleSyllables.length > 0;
232 return this.plausibleSyllables.length > 0;