server / Modules / search/dico / Dico

Class: Dico

search/dico.Dico

Dico is a sigleton class that contains the dictionnary It is used to search for words in the grid

Constructors

constructor

new Dico()

Defined in

search/dico.ts:27open in new window

Properties

loadingPromise

Private loadingPromise: Promise<void>

The promise that will resolve when the dictionnary is loaded

Defined in

search/dico.ts:20open in new window


occurencies

occurencies: OccurenceMap[]

The occurences of the words in the dictionnary The first element is for 2 letters lemmes The second element is for 3 letters lemmes

Defined in

search/dico.ts:26open in new window


words

words: string[] = []

The list of words in the dictionnary

Defined in

search/dico.ts:12open in new window


wordsMap

wordsMap: Map<string, number>

The map of words in the dictionnary

Defined in

search/dico.ts:16open in new window

Methods

addWordsToDictionnary

addWordsToDictionnary(data): void

Add a word or a list of words to the dictionnary

Parameters

NameTypeDescription
datastring | string[]The word or the list of words to add

Returns

void

Defined in

search/dico.ts:119open in new window


countOccurences

countOccurences(«destructured»): void

For each letter of a word, count the occurences of the 2 or 3 letters lemmes and add it to the occurences map

Parameters

NameType
«destructured»Object
› indexnumber
› length3 | 2
› occsOccurenceMap
› wordstring

Returns

void

The occurence map of the words

Defined in

search/dico.ts:43open in new window


getWords

getWords(): Promise<string[]>

Get the list of words in the dictionnary

Returns

Promise<string[]>

All the words in the dictionnary

Defined in

search/dico.ts:210open in new window


getWordsSync

getWordsSync(): string[]

If you know that the dictionnary is already loaded

Returns

string[]

All the words in the dictionnary

Defined in

search/dico.ts:217open in new window


loadDictionary

loadDictionary(): Promise<void>

Load the dictionnary from the files in the dictionnary folder And in the user's dictionary

Returns

Promise<void>

The promise that will resolve when the dictionnary is loaded

Defined in

search/dico.ts:98open in new window


removeOccurence

removeOccurence(occsToRemove, targetOccs, dicoIndex): void

Remove the occurences of a word from the occurences map

Parameters

NameTypeDescription
occsToRemoveOccurenceMapThe occurenceMap generated by the word to remove
targetOccsOccurenceMapThe occurenceMap to cleanup
dicoIndexnumberThe index of the word to remove in the dictionnary

Returns

void

Defined in

search/dico.ts:75open in new window


removeWordsFromDictionary

removeWordsFromDictionary(data): Promise<void>

Remove a word or a list of words from the dictionnary Do not remove it from the array of words, just unreference it from the occurence map and from the wordsMap

Parameters

NameTypeDescription
datastring | string[]The word or the list of words to remove

Returns

Promise<void>

Defined in

search/dico.ts:161open in new window