Generates a new word
775842
def _generate(self, size=None):
        ""
        corpus_letters = list(self.vectors.keys())
        current_letter = random.choice(corpus_letters)
        if size is None:
            size = int(random.normalvariate(self.avg, self.std_dev))

        letters = [current_letter]

        for _ in range(size):
            if current_letter not in corpus_letters:
                # current_letter = random.choice(corpus_letters)
                break
            found_letter = self.vectors[current_letter].choose()
            letters.append(found_letter)
            current_letter = found_letter

        return ''.join(letters)
1241346
public function generateWord()
	{
		$rand				= new Alg_Randomizer();
		$rand->digits		= "2345678";
		$rand->larges		= "ABCDEFGHIKLMNPQRSTUVWXYZ";
		$rand->smalls		= "abcdefghiklmnpqrstuvwxyz";
		$rand->useSmalls	= $this->useSmalls;
		$rand->useLarges	= $this->useLarges;
		$rand->useDigits	= $this->useDigits;
		$rand->useSigns		= FALSE;
		$rand->unique		= $this->unique;
		return $rand->get( $this->length );
	}
1119128
def _add_word(completer):
    
    def inner(word: str):
        completer.words.add(word)
    return inner
927628
def _generate(self, item, *args):
        
        if item in self.done:
            return
        # verbose output with location.
        if self.generate_locations and item.location:
            print("# %s:%d" % item.location, file=self.stream)
        if self.generate_comments:
            self.print_comment(item)
        log.debug("generate %s, %s", item.__class__.__name__, item.name)
        #
        #log.debug('generate: %s( %s )', type(item).__name__, name)
        #if name in self.known_symbols:
        #    log.debug('item is in known_symbols %s'% name )
        #    mod = self.known_symbols[name]
        #    print >> self.imports, "from %s import %s" % (mod, name)
        #    self.done.add(item)
        #    if isinstance(item, typedesc.Structure):
        #        self.done.add(item.get_head())
        #        self.done.add(item.get_body())
        #    return
        #
        # to avoid infinite recursion, we have to mark it as done
        # before actually generating the code.
        self.done.add(item)
        # go to specific treatment
        mth = getattr(self, type(item).__name__)
        mth(item, *args)
        return
975958
function generateWords(err, ints) {
        if (err) {
          next(err)
          if (deferred) {
            deferred.reject(err)
          }
          return
        }
        var position = 0
        var numLoops = 0
        var words = []

        async.doWhilst(
          function generateWord(callback) {
            // if the word is too short, we need a new random number
            if (
              self.wordlist[ints[position]].length > maxLength ||
              self.wordlist[ints[position]].length < minLength
            ) {
              rand.randomInt(
                { min: 0, max: self.wordlist.length - 1 },
                // 
                function generateAnotherInt(err, int) {
                  if (err) return callback(err)

                  if (ints.indexOf(int) > -1) {
                    // we already found that random number, run callback to make the loop again
                    callback()
                  } else {
                    // replace the integer in that position and run the loop again
                    ints[position] = int
                    callback()
                  }
                }
              )
            } else {
              // it's a good word, push it onto the stack
              words.push(self.wordlist[ints[position]])
              position++
              callback()
            }
          },
          function postCheckGeneration() {
            if (!process.env.DISABLE_LOOP_PREVENTION) {
              if (
                numLoops >
                (numWords * 10000 > 850000 ? 850000 : numWords * 10000)
              ) {
                return false
              }
              numLoops++
            }
            return words.length < numWords
          },
          // 
          function resolveGeneration(err) {
            if (err) {
              next(err)
              if (deferred) {
                deferred.reject(err)
              }
            } else if (words.length < numWords) {
              var tooFewWordsError = new Error(
                "You asked for more words than could be generated. This may " +
                  "because you're asking for too many words of a certain length."
              )

              next(tooFewWordsError)
              if (deferred) {
                deferred.reject(tooFewWordsError)
              }
            } else {
              next(null, words)
              if (deferred) {
                deferred.resolve(words)
              }
            }
          }
        )
      }
841953
function (hexStr) {
            // Shortcut
            var hexStrLength = hexStr.length;

            // Convert
            var words = [];
            for (var i = 0; i < hexStrLength; i += 2) {
                words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
            }

            return new WordArray.init(words, hexStrLength / 2);
        }
83205
function (length) {
		length = length || this.exports.generate.integer(5,10);
		var word = '';
		for (var i = 0; i < length; ++i) {
			word += this.exports.helpers.getRandomItem(values['letters']);
		}
		return word;
	}
673072
def build
      text = @word.hyphenated? ? remove_dash(@word.to_s) : add_dash(@word.to_s)

      Word.new(text)
    end
1162442
function(word)
		{
			var c = word[0];
			for (var i = 0; i < 3; i++)
				word[i] = word[i+1];
			word[3] = c;
			
			return word;
		}
146714
def new_sent(self, text, ID=None, **kwargs):
        '''  '''
        if ID is None:
            ID = next(self.__idgen)
        return self.add_sent(Sentence(text, ID=ID, **kwargs))
167393
def mergewords(self, newword, *originalwords, **kwargs):
        """"""
        return self.correctwords(originalwords, [newword], **kwargs)
50425
def chain_add(word, next_word)
    markov_chains[word] ||= Hash.new(0)
    markov_chains[word][next_word] += 1
  end
1208072
def correctwords(self, originalwords, newwords, **kwargs):
        """"""
        for w in originalwords:
            if not isinstance(w, Word):
                raise Exception("Original word is not a Word instance: " + str(type(w)))
            elif w.sentence() != self:
                raise Exception("Original not found as member of sentence!")
        for w in newwords:
            if not isinstance(w, Word):
                raise Exception("New word is not a Word instance: " + str(type(w)))
        if 'suggest' in kwargs and kwargs['suggest']:
            del kwargs['suggest']
            return self.correct(suggestion=newwords,current=originalwords, **kwargs)
        else:
            return self.correct(original=originalwords, new=newwords, **kwargs)
325964
def random(self, length=4):
        """"""
        if not isinstance(length, int):
            raise TypeError('DigitWord can only be randomized by an integer length')

        if self.wordtype == DigitWord.DIGIT:
            self._word = [Digit(random.randint(0, 9)) for i in range(0, length)]
        elif self.wordtype == DigitWord.HEXDIGIT:
            self._word = [HexDigit(str(hex(random.randint(0, 15))).replace('0x',''))
                          for i in range(0, length)]
        else:
            raise TypeError('wordtype is invalid.')
956748
def words(min_size, max_size = None):
        
        max_size = max_size if max_size != None else min_size
        result = ""
        
        count = RandomInteger.next_integer(min_size, max_size)
        for i in range(count):
            result += random.choice(_all_words)

        return result
1272906
def _uniquewords(*args):
    """"""
    words = {}
    n = 0
    for word in itertools.chain(*args):
        if word not in words:
            words[word] = n
            n += 1
    return words
965691
def get_or_generate_vocabulary(data_dir,
                               tmp_dir,
                               data_prefix,
                               max_page_size_exp,
                               approx_vocab_size=32768,
                               strip=True):
  
  num_pages_for_vocab_generation = approx_vocab_size // 3
  vocab_file = vocab_filename(approx_vocab_size, strip)

  def my_generator(data_prefix):
    """Line generator for vocab."""
    count = 0
    for page in corpus_page_generator(
        all_corpus_files(data_prefix)[::-1], tmp_dir, max_page_size_exp):
      revisions = page["revisions"]
      if revisions:
        text = get_text(revisions[-1], strip=strip)
        yield text
        count += 1
        if count % 100 == 0:
          tf.logging.info("reading pages for vocab %d" % count)
        if count > num_pages_for_vocab_generation:
          break

  return generator_utils.get_or_generate_vocab_inner(data_dir, vocab_file,
                                                     approx_vocab_size,
                                                     my_generator(data_prefix))