-1

Is there's someway to generate a meaningful text from random letters as ex. if I type

sbras

the program should give this or something similar

saber

if the above request can't get a good answer , then

I like the generated text and/or numbers on screens in hack & technologies movies

is there's someway to generate a text or numbers , I mean with typing animations

I can use my own text and numbers in python print but won't give me the typing animations like movies

if the above requests can done in python ,that will be great

but if can done in other language , I will be thankful too

Pro-Fun
  • 21
  • 1
  • 7
  • Brute force: 1) Get a dictionary of words, 2) do all permutations of your letters, 3) check for the existence of each permutation in the dictionary. – tommy.carstensen Oct 13 '16 at 07:38
  • 1. You seem to have two unrelated questions. In such cases, you should ask *two separate questions*. 2. How is "saber" supposed to be generated from "sbras", since "sbras" does not contain "e"? – svick Oct 13 '16 at 17:08

1 Answers1

0

As for your first question: Well, that depends on how specifically you want it. If you want to do it real-time, i.e. you want proper words to appear as you type random stuff, well, good luck with that. If you have a text with random letters, you could afterwards look for proper anagrams of every word in the text. You will require a list of proper words to see if they are anagrams, however.

Note that also "a sentence with proper words" is a completely different thing than "a proper sentence". The former is done relatively easy with enough time and effort, while the latter is (close to) impossible to do, as you require your program to have knowledge of both grammar and the type of words (i.e. noun, verb, preposition...).

As for your second question, print is indeed instant. However, you could use the time module to get the wanted effect. One example:

import time
import sys
sentence = "The quick brown fox jumps over the lazy dog"
for c in sentence:
  sys.stdout.write(c)
  time.sleep(0.1)

You can adjust the 0.1 to your liking - it's the sleep time in seconds. You could even make it random within some interval. For the reason I used sys.stdout.write as opposed to print c or print c, see this question.

Community
  • 1
  • 1
Lolgast
  • 329
  • 2
  • 10
  • this is a good answer , `time` module will be good for array the multiple lines but not give the the typing animation because all the line output in single time , you can check [https://pro-devel.github.io/] or specially for this post [https://pro-devel.github.io/css-typing-animation/] – Pro-Fun Oct 13 '16 at 06:37
  • What exactly do you mean? From what I see, your typing is almost the same as mine, except for the fact that the letters in themselves also gradually appear. If that's what you want, you will need some kind of GUI, since afaik such things are impossible to do in consoles. – Lolgast Oct 13 '16 at 07:54