noitu
Version:
A Vietnamese word connection game library with word validation and next word finding capabilities
38 lines • 1.27 kB
TypeScript
import { WordPair, WordDictionary, ValidationResult } from './types';
/**
* WordChecker class for validating Vietnamese word connections
*/
export declare class WordChecker {
private dictionary;
private normalizedDictionary;
constructor(dictionary: WordDictionary);
/**
* Validate if a word pair is in correct format (2 words)
*/
private validateFormat;
/**
* Check if a word pair exists in the dictionary
*/
private isWordInDictionary;
/**
* Normalize Vietnamese text (remove accents for comparison)
*/
private normalizeVietnamese;
/**
* Validate a word pair input
*/
validateWord(input: string, usedWords?: Set<string>): ValidationResult;
/**
* Check if two word pairs can connect (second word of first pair matches first word of second pair)
*/
canConnect(firstPair: WordPair, secondPair: WordPair): boolean;
/**
* Get all possible next words for a given ending word
*/
getPossibleNextWords(endingWord: string): WordPair[];
/**
* Check if a word pair can be connected to the current game state
*/
validateConnection(currentWord: WordPair | null, newWord: WordPair): ValidationResult;
}
//# sourceMappingURL=wordChecker.d.ts.map