De acordo com as Leis 12.965/2014 e 13.709/2018, que regulam o uso da Internet e o tratamento de dados pessoais no Brasil, ao me inscrever na newsletter do portal DICAS-L, autorizo o envio de notificações por e-mail ou outros meios e declaro estar ciente e concordar com seus Termos de Uso e Política de Privacidade.


Gerador de palavreado bizarro

Colaboração: Juan Carlos Castro y Castro

Data de Publicação: 02 de Outubro de 2005

dica: Com este script, você pode gerar uma sequência de parágrafos de tamanho arbitrário usando o pacote "words", wue vem instalado em (pelo que sei) todas as distribuições Linux e que originalmente serve para evitar que usuários criem senhas para sí próprios que sejam palavras conhecidas. O arquivo fica em /usr/share/dict/words (No Fedora Core 3, pode ser que em outra distro o caminho seja diferente).

Se alguém souber de um pacote correspondente só com palavras da língua portuguesa, ficará facílimo gerar uma versão que gera palavreado na língua pátria. O pessoal que trabalha com tipografia pode achar isto útil para gerar texto "filler".

Abaixo o script, e um resultado de rodá-lo com os parâmetros "3 3 10 30":

<i>Exhortatively adventual fogon all-bitter ruths. Groundliness Forsythe Rieka but coinitial Mantuan but megalomaniacally Urey semiresoluteness but toatoa tibiae thought-laden Hibernical quasi-victorious immaculate syncretical the unofficiously multimetalic house totes cassena strickled sewages vapidity.
Wavy-edged gadrooned enalid discants astronomics preffroze. Arion unheritable Filicites concoagulate loathness cantillated superintenseness recooper nonsusceptive the Timotheus of giblet-checked Trinl deflexed qualmy histodiagnosis befrocked handbreed cookery cicrumspections IAS.
Buzzword. Prefabrications neat-dressed yellow-hilted monoketone genecology and atua. Hendaye of Corinna and Cervulus blepharoplast.</i>
  #!/bin/sh
  #
  # gibberish.sh - Generate Burroughsesque text
  # This script is in the PUBLIC DOMAIN
  #
  # Use: gibberish.sh [pmin] [pmax] [wordsmin] [wordsmax]
  # pmin, pmax - Minumum and maximum # of paragraphs
  # wordsmin, wordsmax - Minimum and maximum words per paragraph
  # (not counting "of", "the", "and", "or", "but")
  #
  # Defaults: 3 8 30 130
  #
  
  export NPARMIN=3
  export NPARMAX=8
  export NWORDSPARMIN=30
  export NWORDSPARMAX=130
  
  if [ "$4" != "" ]; then
  export NWORDSPARMAX=$4
  fi
  if [ "$3" != "" ]; then
  export NWORDSPARMIN=$3
  fi
  if [ "$2" != "" ]; then
  export NPARMAX=$2
  fi
  if [ "$1" != "" ]; then
  export NPARMIN=$1
  fi
  
  if [ 0$NWORDSPARMAX -lt 0$NWORDSPARMIN ]; then
  export NWORDSPARMAX=$NWORDSPARMIN
  fi
  if [ 0$NPARMAX -lt 0$NPARMIN ]; then
  export NPARMAX=$NPARMIN
  fi
  export NWORDSPARRNG=$(($NWORDSPARMAX-$NWORDSPARMIN))
  export NPARRNG=$(($NPARMAX-$NPARMIN))
  
  awk '
  BEGIN {
  nwords = 0;
  }
  
  {
  wlist[nwords++] = $0;
  }
  
  END {
  srand();
  npars = 3 + int(5 * rand());
  npars = ENVIRON["NPARMIN"] + int(ENVIRON["NPARRNG"] * rand());
  for (par = 0; par < npars; par++)
  {
  nwordspar = ENVIRON["NWORDSPARMIN"] + int(ENVIRON["NWORDSPARRNG"] * rand());
  for (i = 0; i < nwordspar; i++)
  {
  thisword = wlist[int(nwords * rand())];
  if (i > 0)
  {
  if (int(15 * rand()) == 8)
  printf ". %s%s", toupper(substr(thisword,1,1)), substr(thisword,2);
  else if (int(20 * rand()) == 19)
  printf " of %s", thisword;
  else if (int(20 * rand()) == 18)
  printf " the %s", thisword;
  else if (int(20 * rand()) == 17)
  printf " and %s", thisword;
  else if (int(20 * rand()) == 16)
  printf " or %s", thisword;
  else if (int(20 * rand()) == 15)
  printf " but %s", thisword;
  else
  printf " %s", thisword;
  }
  else
  printf "%s%s", toupper(substr(thisword,1,1)), substr(thisword,2);
  }
  printf ".\n\n";
  }
  }' </usr/share/dict/words
  

Adicionar comentário

* Campos obrigatórios
5000
Powered by Commentics

Comentários

Nenhum comentário ainda. Seja o primeiro!


Veja a relação completa dos artigos de Juan Carlos Castro y Castro