Create variations of the word based on letter combinations like oo,
sh, etc.
760244
def variations(word):
    """"""

    if len(word) == 1:
        return [[word[0]]]
    elif word == 'aa':
        return [['A']]
    elif word == 'ee':
        return [['i']]
    elif word == 'ei':
        return [['ei']]
    elif word in ['oo', 'ou']:
        return [['u']]
    elif word == 'kha':
        return [['kha'], ['kh', 'a']]
    elif word in ['kh', 'gh', 'ch', 'sh', 'zh', 'ck']:
        return [[word]]
    elif word in ["'ee", "'ei"]:
        return [["'i"]]
    elif word in ["'oo", "'ou"]:
        return [["'u"]]
    elif word in ["a'", "e'", "o'", "i'", "u'", "A'"]:
        return [[word[0] + "'"]]
    elif word in ["'a", "'e", "'o", "'i", "'u", "'A"]:
        return [["'" + word[1]]]
    elif len(word) == 2 and word[0] == word[1]:
        return [[word[0]]]

    if word[:2] == 'aa':
        return [['A'] + i for i in variations(word[2:])]
    elif word[:2] == 'ee':
        return [['i'] + i for i in variations(word[2:])]
    elif word[:2] in ['oo', 'ou']:
        return [['u'] + i for i in variations(word[2:])]
    elif word[:3] == 'kha':
        return \
            [['kha'] + i for i in variations(word[3:])] + \
            [['kh', 'a'] + i for i in variations(word[3:])] + \
            [['k', 'h', 'a'] + i for i in variations(word[3:])]
    elif word[:2] in ['kh', 'gh', 'ch', 'sh', 'zh', 'ck']:
        return \
            [[word[:2]] + i for i in variations(word[2:])] + \
            [[word[0]] + i for i in variations(word[1:])]
    elif word[:2] in ["a'", "e'", "o'", "i'", "u'", "A'"]:
        return [[word[:2]] + i for i in variations(word[2:])]
    elif word[:3] in ["'ee", "'ei"]:
        return [["'i"] + i for i in variations(word[3:])]
    elif word[:3] in ["'oo", "'ou"]:
        return [["'u"] + i for i in variations(word[3:])]
    elif word[:2] in ["'a", "'e", "'o", "'i", "'u", "'A"]:
        return [[word[:2]] + i for i in variations(word[2:])]
    elif len(word) >= 2 and word[0] == word[1]:
        return [[word[0]] + i for i in variations(word[2:])]
    else:
        return [[word[0]] + i for i in variations(word[1:])]
127036
protected void generateKeywords(IStyleAppendable it, String family, VimSyntaxGroup color, Iterable<String> keywords) {
		appendComment(it, "keywords for the '" + family + "' family."); //$NON-NLS-1$ //$NON-NLS-2$
		final Iterator<String> iterator = keywords.iterator();
		if (iterator.hasNext()) {
			it.append("syn keyword "); //$NON-NLS-1$
			it.append(family);
			do {
				it.append(" "); //$NON-NLS-1$
				it.append(iterator.next());
			} while (iterator.hasNext());
		}
		it.newLine();
		appendCluster(it, family);
		hilight(family, color);
		it.newLine();
	}
806223
def _upcase_word(text, pos):
    """"""
    text, new_pos = _forward_word(text, pos)
    return text[:pos] + text[pos:new_pos].upper() + text[new_pos:], new_pos
1299267
def main(*args):
    """"""
    options, args, parser = parse_options(args)

    if options.regex and options.write_changes:
        print('ERROR: --write-changes cannot be used together with '
              '--regex')
        parser.print_help()
        return 1
    word_regex = options.regex or word_regex_def
    try:
        word_regex = re.compile(word_regex)
    except re.error as err:
        print('ERROR: invalid regular expression "%s" (%s)' %
              (word_regex, err), file=sys.stderr)
        parser.print_help()
        return 1

    ignore_words_files = options.ignore_words or []
    ignore_words = set()
    for ignore_words_file in ignore_words_files:
        if not os.path.exists(ignore_words_file):
            print('ERROR: cannot find ignore-words file: %s' %
                  ignore_words_file, file=sys.stderr)
            parser.print_help()
            return 1
        build_ignore_words(ignore_words_file, ignore_words)

    ignore_words_list = options.ignore_words_list or []
    for comma_separated_words in ignore_words_list:
        for word in comma_separated_words.split(','):
            ignore_words.add(word.strip())

    dictionaries = options.dictionary or [default_dictionary]
    misspellings = dict()
    for dictionary in dictionaries:
        if dictionary == "-":
            dictionary = default_dictionary
        if not os.path.exists(dictionary):
            print('ERROR: cannot find dictionary file: %s' % dictionary,
                  file=sys.stderr)
            parser.print_help()
            return 1
        build_dict(dictionary, misspellings, ignore_words)
    colors = TermColors()
    if not options.colors or sys.platform == 'win32':
        colors.disable()

    if options.summary:
        summary = Summary()
    else:
        summary = None

    context = None
    if options.context is not None:
        if (options.before_context is not None) or \
                (options.after_context is not None):
            print('ERROR: --context/-C cannot be used together with '
                  '--context-before/-B or --context-after/-A')
            parser.print_help()
            return 1
        context_both = max(0, options.context)
        context = (context_both, context_both)
    elif (options.before_context is not None) or \
            (options.after_context is not None):
        context_before = 0
        context_after = 0
        if options.before_context is not None:
            context_before = max(0, options.before_context)
        if options.after_context is not None:
            context_after = max(0, options.after_context)
        context = (context_before, context_after)

    exclude_lines = set()
    if options.exclude_file:
        build_exclude_hashes(options.exclude_file, exclude_lines)

    file_opener = FileOpener(options.hard_encoding_detection,
                             options.quiet_level)
    glob_match = GlobMatch(options.skip)

    bad_count = 0
    for filename in args:
        # ignore hidden files
        if is_hidden(filename, options.check_hidden):
            continue

        if os.path.isdir(filename):
            for root, dirs, files in os.walk(filename):
                if glob_match.match(root):  # skip (absolute) directories
                    del dirs[:]
                    continue
                for file_ in files:
                    if glob_match.match(file_):  # skip files
                        continue
                    fname = os.path.join(root, file_)
                    if glob_match.match(fname):  # skip paths
                        continue
                    if not os.path.isfile(fname) or not os.path.getsize(fname):
                        continue
                    bad_count += parse_file(
                        fname, colors, summary, misspellings, exclude_lines,
                        file_opener, word_regex, context, options)

                # skip (relative) directories
                dirs[:] = [dir_ for dir_ in dirs if not glob_match.match(dir_)]

        else:
            bad_count += parse_file(
                filename, colors, summary, misspellings, exclude_lines,
                file_opener, word_regex, context, options)

    if summary:
        print("\n-------8<-------\nSUMMARY:")
        print(summary)
    return bad_count
1307193
function generateWords() {
         originWords = self.content.split(/\s+/g);
         originWords = originWords.map(function(word) {
            return {
               text: word,
               count: Math.floor(Math.random() * maxWordCount)
            };
         }).sort(function(a, b) {
            return b.count - a.count;
         });
         resizeWordsCloud();
      }
1360116
def _downcase_word(text, pos):
    """"""
    text, new_pos = _forward_word(text, pos)
    return text[:pos] + text[pos:new_pos].lower() + text[new_pos:], new_pos
947391
function sro2syllabics (sro, options) {
    options = options || {}
    let hyphens = options.hyphens || DEFAULT_SRO2SYLLABICS_OPTIONS.hyphens
    // Instead of using sro2syllabicsLookup directly, create a customizable
    // lookup here that fallsback to sro2syllabicsLookup.
    let lookup = Object.create(sro2syllabicsLookup)
    // The customization is what the hyphen should be converted to:
    lookup['-'] = hyphens

    let transliteration = nfc(sro).replace(wordPattern, transliterateWord)
    return transliteration.replace(fullStopPattern, function (_, syllabic) {
      // The pattern may yank the last syllabic before the full stop,
      // so add it back here:
      return (syllabic || '') + '\u166E' // ᙮ U+166E CANADIAN SYLLABICS FULL STOP
    })

    function transliterateWord (_match, preamble, word) {
      // The pattern matches zero or more non-word characters before the word
      // (preamble), so glue that before the word.
      return (preamble || '') + transcodeSROWordToSyllabics(word)
    }

    function transcodeSROWordToSyllabics (sroWord) {
      let toTranscribe = translateAltForms(sroWord.toLowerCase())

      let parts = []
      let match = toTranscribe.match(sroPattern)

      while (match) {
        let syllable = match[0]
        let onset = match[1]
        let vowel = match[2]
        let nextSyllablePos

        if (onset !== undefined) {
          // When the onset matched, apply sandhi for Cw?-V → Cw?V
          syllable = onset + vowel
          // Special case for sandhi hw?-V cases: Just transcribe
          // the 'h'/ᐦ part first, then run pretend that this
          // syllable is just the (optional w and) vowel.
          if (onset[0] === 'h') {
            parts.push('ᐦ');
            syllable = syllable.substr(1);
          }
        }
        nextSyllablePos = match[0].length

        let syllabic = lookup[syllable]
        parts.push(syllabic)
        toTranscribe = toTranscribe.slice(nextSyllablePos)

        match = toTranscribe.match(sroPattern)
      }

      if (endsWithHK(parts)) {
        // Replace last two charcters with 'hk' syllabic
        parts = parts.slice(0, parts.length - 2).concat('ᕽ')
      }

      return parts.join('')
    }
  }
833291
def random_letter(self):
        """"""
        return self.generator.random.choice(
            getattr(string, 'letters', string.ascii_letters))
597268
function wordmap(input) {
    var ignore = "a an and on in it of if for the i is i'm i'd it's or to me be not was do so at are what bin bins".split(' ');

    var endings = 'ing ly lies s';
    var endingRe = new RegExp('(' + endings.split(' ').join('|') + ')$');

    return (input||'')
      //- strip html
      .replace(/(<([^>]+)>)/ig,'')
      //- strip non-letters
      .replace(/\W/g, ' ').replace(/["'\.,]/g, '')
      //- turn in to array of lower case words
      .toLowerCase().split(' ')
      //- filter out ignored words
      .filter(function (word) {
        return ignore.indexOf(word.trim()) === -1;
      }).filter(function (e, i, words) {
        //- return unique
        return words.lastIndexOf(e) === i;
      }).filter(function (word) {
        //- return words 3 chars or longer
        return word.length > 2;
      }).map(function (word) {
        return word.trim().replace(endingRe, '');
      }).sort();
  }
235293
def random_words(self, letter=None, count=1):
        
        self.check_count(count)

        words = []

        if letter is None:
            all_words = list(
                chain.from_iterable(self.nouns.values()))

            try:
                words = sample(all_words, count)
            except ValueError:
                len_sample = len(all_words)
                raise ValueError('Param "count" must be less than {0}. \
(It is only {0} words)'.format(len_sample + 1, letter))

        elif type(letter) is not str:
            raise ValueError('Param "letter" must be string.')

        elif letter not in self.available_letters:
            raise ValueError(
                'Param "letter" must be in {0}.'.format(
                    self.available_letters))

        elif letter in self.available_letters:
            try:
                words = sample(self.nouns[letter], count)
            except ValueError:
                len_sample = len(self.nouns[letter])
                raise ValueError('Param "count" must be less than {0}. \
(It is only {0} words for letter "{1}")'.format(len_sample + 1, letter))

        return words
12488
def random_letters(count):
    """"""
    rv = random.choice(string.ascii_uppercase)
    while len(rv) < count:
        l = random.choice(string.ascii_uppercase)
        if not l in rv:
            rv += l
    return rv
352322
public static Word combine(List<Word> words){
        if(words==null || words.size() < 2){
            return null;
        }
        String key = "";
        for(Word word : words){
            key += word.getText();
            key += " ";
        }
        key=key.trim();
        String value = GENERIC_TRIE.get(key);
        if(value==null){
            return null;
        }
        return new Word(value);
    }
534803
def _generate_shape(word: str) -> str:
        

        def counting_stars(w) -> List[int]:
            count = [1]
            for i in range(1, len(w)):
                if w[i - 1] == w[i]:
                    count[-1] += 1
                else:
                    count.append(1)

            return count

        shape = ""
        p = 0
        for c in counting_stars(word):
            if c > 4:
                shape += word[p:p + 4]
            else:
                shape += word[p:p + c]
            p = p + c

        return shape
742691
def _edits1(word: str) -> Set[str]:
    
    splits = [(word[:i], word[i:]) for i in range(len(word) + 1)]
    deletes = [L + R[1:] for L, R in splits if R]
    transposes = [L + R[1] + R[0] + R[2:] for L, R in splits if len(R) > 1]
    replaces = [L + c + R[1:] for L, R in splits if R for c in thai_letters]
    inserts = [L + c + R for L, R in splits for c in thai_letters]

    return set(deletes + transposes + replaces + inserts)
227726
function breakWord (word) {
  if (replaceAnsi(word).length > this.options.width) {
    const letters = word.split('')
    let piece
    const pieces = []
    while ((piece = letters.splice(0, this.options.width)).length) {
      pieces.push(piece.join(''))
    }
    return pieces
  } else {
    return word
  }
}
167393
def mergewords(self, newword, *originalwords, **kwargs):
        """"""
        return self.correctwords(originalwords, [newword], **kwargs)
300788
def lexify(self, text='????', letters=string.ascii_letters):
        
        return _re_qm.sub(lambda x: self.random_element(letters), text)