Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Odud (1047)

Odud
  (email not shown publicly)

Journal of Odud (1047)

Tuesday September 24, 2002
09:01 AM

Taxonomy/Classification

[ #7963 ]

I've been looking for Perl scripts/modules that will help with developing a taxonomy/classification system. Basically I want to be able to ask n questions and then based on the answer select a further m questions to ask etc. etc. until the end of the tree is reached.

The application I have in mind is identification of typefaces - but I don't think that is particularly relevant.

For UK readers with long memories there was a program for the BBC Model B that "understood" animals and would do a reasonable job of "guessing" what animal you were thinking of based on simple questions about number of legs/wings/horns etc. It also could be configured to add new animals - provided that you could give a distinguishing question. At the moment this is the sort of complexity I need.

Searching CPAN (keywords: taxonomy, classification) hasn't yielded anything that looks relevant - for the first time ever in my experience! - is this a wheel that hasn't been invented yet?

Can anybody point me in the right direction?

Update: The answer is probably Clips with a Perl front end to make the question/answer part easy.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I remember the exact same program for the Apple II in BASIC. I never understood how it worked. (Hey, I was in fourth grade! :) )

    In fact, I thought of that program before you even wrote that paragraph.

    I always wanted to have a program that worked like that but had the ability to "forget." I tried to make that work in a similar (but simpler) BASIC program in eighth grade. Too bad I didn't have Perl and Tie::Hash::Cannabinol then. :)

    --
    J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
    • Found this [csupomona.edu] while Googling. It's Prolog and doesn't learn.
    • Here is the original Animals Integer Basic program source code:

      0 GOTO 1000
      1 REM *************************
      2 REM * *
      3 REM * ANIMALS: *
      4 REM * COPYRIGHT 1978 BY *
      5 REM * APPLE COMPUTER INC. *
      6 REM * *
      7 REM *************************
      100 CUR = 1 : REM HERE IS WHERE PROGRAM IS PLAYED
      110 PRINT OP$
      120 PRINT RF$;CUR
      130 INPUT NEW$ : IF NEW$(1,1) = "!" THEN 500 : INPUT RTPTR : INPUT WRNGPTR
      140 REM NOW HAVE QUESTION TO ASK. RTPTR POINTS AT RECORD TO GO TO IF
  • I call that sort of thing an "Expert System", but that doesn't show up any hits on CPAN either... Sorry.

    -Dom

  • #!/usr/bin/perl -w
    use strict;

    use Data::Dumper;

    my $info = "dog";

    {
      try($info);
      redo if (yes("play again?"));
    }
    print "Bye!\n";
    print Dumper($info);

    sub try {
      my $this = $_[0];
      if (ref $this) {
        return try($this->{yes($this->{Question}) ? 'Yes' : 'No' });
      }
      if (yes("Is it a $this")) {
        print "I got it!\n";
        return 1;
      };
      print "no!?  What was it then? ";
      chomp(my $new = <STDIN>);

    --
    • Randal L. Schwartz
    • Stonehenge
    • Thanks for that - I suspect it may be a good start towards what I'm looking for. I like the way it builds the tree inside $info. Although I'll probably need multiple choices.
       
      There's a Prolog program here [csupomona.edu] that looks a promising start as well.