Logotipo Dicas-L, por Ricardo Burile

Busca

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

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

 

PHP CONFERENCE

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

Stumble Upon Digg This Del.icio.us Twitter Recomendar este artigo a um amigo Entre em contato Formato PDF
Newsfeed RSS
Formato para impressão
StumbleUpon Digg Del.icio.us Twitter Recomendar Contato 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.87/5
  • 1
  • 2
  • 3
  • 4
  • 5

Avaliação: 2.9 /5 (604 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

Aprenda Inglês em Casa
Metodo inovador e criativo, para quem tem pouco tempo. Veja os depoimentos de nossos alunos.
Saiba mais

Biblioteca

Desenvolvendo Websites com PHP
Por Juliano Niederauer

O Monge e o Executivo: uma História sobre a Essência da Liderança
Por James C. Hunter

Extreme Programming
Por Vinicius Manhaes Teles

UML: Guia do Usuário
Por Grady Booch, James Rumbaugh e Ivar Jacobson

O Vendedor de Sonhos
Por Augusto Cury

Segurança de Redes em Ambientes Cooperativos
Por Emilio Tissato Nakamura e Paulo Licio de Geus

O Conhecimento em Rede
Por Carlos Nepomuceno e Marcos Cavalcanti

Utilizando UML e Padrões
Por CRAIG LARMAN

Sistema de Banco de Dados
Por Abraham Silberschatz

Hardware PC: Guia de Aprendizagem Rápida
Por Carlos E. Morimoto

Manual Completo do Linux: Guia do Administrador
Por Evi Nemeth, Trent R. Hein, Garth Snyder

Redes de Computadores e a Internet
Por James F. Kurose e Keith W. Ross

O Segredo
Por Rhonda Byrne

Os Segredos da Mente Milionária
Por T. Harv Eker

Construindo Sites com CSS e (X)HTML
Por Mauricio Samy Silva

Use a Cabeça!: JSP & Servlets
Por Brian Bashan, Kathy Sierra, Bert Bates

Expressões Regulares: Uma Abordagem Divertida
Por Aurélio Marinho Jargas

Qualidade de Software
Por Andre Koscianski Michel dos Santos Soares

Descobrindo o Linux: Entenda o Sistema Operacional GNU/Linux
Por Joao Eriberto Mota Filho

Enterprise Javabeans 3.0
Por Bill Burke, Richard Monson