Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #141966
| From | Eli the Bearded <*@eli.users.panix.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Anagrams |
| Date | 2019-03-14 20:25 +0000 |
| Organization | Some absurd concept |
| Message-ID | <eli$1903141603@qaz.wtf> (permalink) |
| References | <q687cl$pvs$1@toylet.eternal-september.org> <5SVhE.204037$U64.101380@fx20.am4> <eli$1903121946@qaz.wtf> <YH5iE.101059$tK1.28555@fx28.am4> |
In comp.lang.c, Bart <bc@freeuk.com> wrote:
> On 13/03/2019 00:22, Eli the Bearded wrote:
>> And, obviously, most of the code is dealing with input and output, the
>> actual test is very simple.
> I don't know enough Perl to know which part is just testing for
> anagrams. But if allowed to use a 'softer' language, then as I
> suggested, it can be trivial. This version also allows white-space,
> punctuation and mixed case (but matched text must be ASCII):
I forgot I was posting to comp.lang.c instead of alt.anagrams. :^)
The general description of the process my Perl code is
copy input source to sourcestring while
normalizing case and removing non-letters
copy input test to teststring while
normalizing case and removing non-letters
initialize missingstring to empty
for each letter in sourcestring;
if letter can be removed from teststring
remove it
else
add it to missingstring
if teststring is empty and missingstring is empty
anagram success
else
print non empty strings to show errors
If writing it in C, I'd replace characters rather than remove them,
and test for any remaining non-replacement characters in teststring.
This is easy to generalize to any set of allowed characters so long
as the underling type can store at last one character not in that set.
> But whether this is a true anagram test is debatable. If a word, phrase
> or sentence is written with each character on a tile, could you
> rearrange those tiles to form the other phrase/etc? In general you can't
> because punctuation could be different.
I agree this boils down to what the definition used is. My goal with
anagramhunt was not to be strict about that definition, but to find
subjectively interesting accidentaly anagrams across a huge corpus of
existing text.
(PS to anyone who wants to try to replicate that work: the web interface
to Gutenberg has per day download limits, but the FTP interface does
not.)
Elijah
------
and have fun coming up with a way to parse all of that into "sentences"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
As the Web Turns 30, Its Inventor Explains 3 Ways It Went Wrong—and How to Fix It "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2019-03-12 20:06 +0800
Re: As the Web Turns 30, Its Inventor Explains 3 Ways It Went Wrong—and How to Fix It gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-12 12:12 +0000
Re: As the Web Turns 30, Its Inventor Explains 3 Ways It Went Wrong—and How to Fix It "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2019-03-12 20:25 +0800
Re: As the Web Turns 30, Its Inventor Explains 3 Ways It Went Wrong—and How to Fix It Martin Edwards <buzzard554@fastmail.co.uk> - 2019-03-13 07:14 +0000
Re: As the Web Turns 30, Its Inventor Explains 3 Ways It Went Wrong—and How to Fix It "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2019-03-13 19:39 +0800
Re: As the Web Turns 30, Its Inventor Explains 3 Ways It Went Wrong—and How to Fix It Wolf K <wolfmac@sympatico.ca> - 2019-03-13 10:59 -0400
Re: As the Web Turns 30, Its Inventor Explains 3 Ways It Went Wrong—and How to Fix It Martin Edwards <buzzard554@fastmail.co.uk> - 2019-03-14 07:18 +0000
Re: As the Web Turns 30, Its Inventor Explains 3 Ways It Went Wrong—and How to Fix It Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-03-12 06:40 -0700
Re: As the Web Turns 30, Its Inventor Explains 3 Ways It Went Wrong—and How to Fix It "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-03-12 07:32 -0700
Another Crackpot Production... gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-12 14:43 +0000
Re: Another Crackpot Production... "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-03-12 08:24 -0700
Re: Another Crackpot Production... fir <profesor.fir@gmail.com> - 2019-03-12 09:30 -0700
Re: Another Crackpot Production... fir <profesor.fir@gmail.com> - 2019-03-12 09:42 -0700
Re: Another Crackpot Production... "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-03-12 09:54 -0700
Re: Another Crackpot Production... fir <profesor.fir@gmail.com> - 2019-03-12 10:10 -0700
Re: Another Crackpot Production... "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-03-12 10:29 -0700
Re: Another Crackpot Production... fir <profesor.fir@gmail.com> - 2019-03-12 10:45 -0700
Anagrams (was: Re: Another Crackpot Production...) Bart <bc@freeuk.com> - 2019-03-12 21:51 +0000
Re: Anagrams (was: Re: Another Crackpot Production...) Eli the Bearded <*@eli.users.panix.com> - 2019-03-13 00:22 +0000
Re: Anagrams Bart <bc@freeuk.com> - 2019-03-13 11:20 +0000
Re: Anagrams Eli the Bearded <*@eli.users.panix.com> - 2019-03-14 20:25 +0000
Re: Anagrams Learn to Filter you e-tard <cdalten@gmail.com> - 2019-03-15 08:02 -0700
Re: Anagrams Wouter Verhelst <w@uter.be> - 2019-03-15 17:11 +0200
Re: Anagrams (was: Re: Another Crackpot Production...) Ike Naar <ike@iceland.freeshell.org> - 2019-03-13 07:28 +0000
Re: Anagrams Bart <bc@freeuk.com> - 2019-03-13 10:50 +0000
Re: Anagrams Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-13 11:51 +0000
Re: Anagrams Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-03-13 06:10 -0700
Re: Anagrams Bart <bc@freeuk.com> - 2019-03-13 14:50 +0000
Re: Anagrams Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-13 15:15 +0000
Re: Anagrams Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-03-13 08:42 -0700
Re: Anagrams Bart <bc@freeuk.com> - 2019-03-13 16:17 +0000
Re: Anagrams Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-03-14 01:23 +0000
2001: A Space Odyssey - HAL 9000 "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2019-03-13 20:28 +0800
Re: 2001: A Space Odyssey - HAL 9000 Martin Edwards <buzzard554@fastmail.co.uk> - 2019-03-14 07:19 +0000
Re: 2001: A Space Odyssey - HAL 9000 "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2019-03-14 22:30 +0800
Re: 2001: A Space Odyssey - HAL 9000 gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-14 14:32 +0000
Re: 2001: A Space Odyssey - HAL 9000 "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-03-14 07:50 -0700
Re: 2001: A Space Odyssey - HAL 9000 "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2019-03-15 00:16 +0800
csiph-web