nimegeneratorpkg/letters

Types

Followed = object
  always*, often*, rarely*, never*: seq[char]
Letter = object
  letter*: char
  vowel*: bool
  followed*: Followed
  formables*: seq[string]
Operation = enum
  doProbableLetter, doFormable

Vars

cachedVowels: Table[char, Letter]
dictionary: Table[char, Letter]

Procs

proc addToDictionary(letters: seq[Letter]) {....raises: [ValueError], tags: [].}

Adds new letters to the dictionary.

If a letter already exists, it will be overridden (a warning is printed to stdout).

proc generateWordSubstringsWithCicles(cicles: Positive): seq[string] {.
    ...raises: [KeyError], tags: [].}
Generates substrings for a word with a set amount of cicles.
proc generateWordWithCicles(cicles: Positive): string {....raises: [KeyError],
    tags: [].}
Shortcut to generateWordSubstringsWithCicles().join().
proc getLetterFromChar(c: char): Letter {....raises: [KeyError], tags: [].}
Returns letter from dictionary. Returns a random one, if missing dictionary entry.
proc getNextLetter(curr: char): Letter {....raises: [KeyError], tags: [].}
Returns next Letter object from a char.
proc getNextLetter(curr: Letter): Letter {....raises: [KeyError], tags: [].}
Returns next Letter object.
proc getNextLetter(word: string): Letter {....raises: [KeyError], tags: [].}
Returns next Letter object from a string.
proc getRandomLetter(): Letter {....raises: [], tags: [].}
Returns a random letter.
proc getWordSubstringFromLetter(letter: Letter): string {....raises: [], tags: [].}

Generates a substring from a letter object.

Substrings can be:

  • formables (e.g. 'e': "er", "el")
  • the actual letter#