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
Properties
loadingPromise
• Private
loadingPromise: Promise
<void
>
The promise that will resolve when the dictionnary is loaded
Defined in
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
words
• words: string
[] = []
The list of words in the dictionnary
Defined in
wordsMap
• wordsMap: Map
<string
, number
>
The map of words in the dictionnary
Defined in
Methods
addWordsToDictionnary
▸ addWordsToDictionnary(data
): void
Add a word or a list of words to the dictionnary
Parameters
Name | Type | Description |
---|---|---|
data | string | string [] | The word or the list of words to add |
Returns
void
Defined in
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
Name | Type |
---|---|
«destructured» | Object |
› index | number |
› length | 3 | 2 |
› occs | OccurenceMap |
› word | string |
Returns
void
The occurence map of the words
Defined in
getWords
▸ getWords(): Promise
<string
[]>
Get the list of words in the dictionnary
Returns
Promise
<string
[]>
All the words in the dictionnary
Defined in
getWordsSync
▸ getWordsSync(): string
[]
If you know that the dictionnary is already loaded
Returns
string
[]
All the words in the dictionnary
Defined in
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
removeOccurence
▸ removeOccurence(occsToRemove
, targetOccs
, dicoIndex
): void
Remove the occurences of a word from the occurences map
Parameters
Name | Type | Description |
---|---|---|
occsToRemove | OccurenceMap | The occurenceMap generated by the word to remove |
targetOccs | OccurenceMap | The occurenceMap to cleanup |
dicoIndex | number | The index of the word to remove in the dictionnary |
Returns
void
Defined in
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
Name | Type | Description |
---|---|---|
data | string | string [] | The word or the list of words to remove |
Returns
Promise
<void
>