home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / question / 15097 < prev    next >
Encoding:
Text File  |  1993-01-01  |  2.1 KB  |  67 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!psinntp!jpradley!jpr
  3. From: jpr@jpradley.jpr.com (Jean-Pierre Radley)
  4. Subject: Re: word cracker
  5. Date: Fri, 01 Jan 1993 18:43:50 GMT
  6. Message-ID: <1993Jan01.184350.24450@jpradley.jpr.com>
  7. References: <1992Dec30.235126.25601@mnemosyne.cs.du.edu>
  8. Organization: Unix in NYC
  9. Lines: 56
  10.  
  11. In article <1992Dec30.235126.25601@mnemosyne.cs.du.edu> sscrivan@nyx.cs.du.edu (steve scrivano) writes:
  12. >OK, gurus!  Can anyone solve this problem?
  13. >
  14. >I am looking for a fairly portable "C" program or script that will produce
  15. >every possible 4 letter or greater combination using the following
  16. >letters:
  17. >
  18. >c e e f g h i i l l n n o p p r r r s s t t t u
  19. >
  20. >
  21. >Some of the letters appear more than once and therefore will increase the
  22. >possible number of combinations possible.  I realize that the number of 
  23. >combinations are incredible and will probably consume a great deal of
  24. >cpu time.  My intentions are to find every possible word that 4 or more
  25. >of these letters can create.  Each time a letter combination is created,
  26. >that combination would be compared with /usr/dict/words and if found
  27. >there it would be concatenated to a resulting word file.
  28. >
  29. >The end result would be a word file created with all possible combinations.
  30. >You might say, sort of a crossword puzzle cracker.  It would be ideal if
  31. >the program could accept input so all I had to do is enter in the letters
  32. >and it would the job from there although not mandatory.
  33. >
  34.  
  35. Here's a script wich filters what you don't want out of /usr/dict/words.
  36.  
  37.     </usr/dict/words tr '[A-Z]' '[a-z]' |
  38.     sed '
  39.     /^.$/d
  40.     /^..$/d
  41.     /^...$/d
  42.     /[abdjkmqv-z0-9]/d
  43.     /c.*c/d
  44.     /e.*.e.*e/d
  45.     /f.*f/d
  46.     /g.*g/d
  47.     /h.*h/d
  48.     /i.*.i.*i/d
  49.     /l.*.l.*l/d
  50.     /n.*.n.*n/d
  51.     /o.*o/d
  52.     /p.*.p.*p/d
  53.     /r.*r.*r.*r/d
  54.     /s.*.s.*s/d
  55.     /t.*t.*t.*t/d
  56.     /u.*u/d
  57.     ' > out.file
  58.  
  59. Note that /usr/dict words doesn't contain 'called', 'calling', 'calls' ;
  60. spelling programs know a bit of English, and can construct those once they've
  61. found 'call' in the file.
  62.  
  63. I made my own assumption about capitalized words, converting them and keeping
  64. them.
  65. -- 
  66. Jean-Pierre Radley   Unix in NYC   jpr@jpr.com   jpradley!jpr   CIS: 72160.1341
  67.