Acesso direto ao conteúdo
Logotipo Dicas-L, por Ricardo Burile

Busca

Visite também: Segurança Linux ·  UnderLinux ·  VivaOLinux ·  LinuxSecurity ·  NoticiasLinux ·  BR-Linux ·  SoftwareLivre.org ·  [mais]   
 

Você está aqui: Home  → Arquivo Dicas-L

 

Curso de Inglês Online

Assine a Lista Dicas-L

Receba diariamente por email as dicas
de informática publicadas neste site
Para se descadastrar, clique aqui.

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
  

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

Formato PDF
Newsfeed RSS
Formato para impressão
PDF RSS Imprimir

Referências Adicionais

Referências adicionais sobre os assuntos abordados neste site podem ser encontradas em nossa Bibliografia.

Avalie esta dica

  • Currently 2.94/5
  • 1
  • 2
  • 3
  • 4
  • 5

Avaliação: 2.9 /5 (1278 votos)

Opinião dos Leitores

Seja o primeiro a comentar este artigo
*Nome:
Email:
Me notifique sobre novos comentários nessa página
Oculte meu email
*Texto:
 
  Para publicar seu comentário, digite o código contido na imagem acima
 


Powered by Scriptsmill Comments Script
Lan University

Submarino.com.br

Encontre imóveis, apartamentos e casas a venda no Imobilien
Saiba mais

 

 

Procure pela casa ou apartamento ideal à venda ou para aluguel na busca inteligente do Imohoo
Buscar imóveis