Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Perl is to stupid to understand this 1 liner.

From: greggirwin:mindspring at: 16-Dec-2001 12:36

Hi Joel, << As always, I'd be very interested to hear if anyone else has a better solution to this meta-problem (or is that "meta-solution"?) >> It seems to me that you pointed it out in an earlier message when you made reference to how humans would identify phone numbers given potentially ambiguous data by using context. This is right up REBOL's alley, though far from the one liner approach. :) Do you recall my solution to your "table parser" dilemma (look at things like a human)? Same idea, different rules and, to be really good, it should learn. In this case you have some basic rules to start with, given your example text: [opt proper-name] 'at [phone-num] [proper-name] '( [phone-num] ') ['cell | 'phone | 'mobile...] [opt 'number] 'is [phone-num] What makes up a phone number? groups of digits, with various separators between. When you hit alpha chars (probably with special checks for "PIN", "x", "ext" followed by more digits, you're done with the number. Hmmm. Maybe a quick check for mutiple numbers? [phone-num] 'or [phone-num] Now, you run it and it shows you the results for confirmation, just like a new assistant you hire. You give it feedback, which it remembers, and over time it builds new rules to account for your style. At some point, it may do so well that you tell it "Don't ask me to proof your work unless you have some doubt about something". If something, like your example, is of a critical nature, you can always tell it "run this by me before you send it out", or "Add your own 'signature' so, if something is wrong, they can blame you." :) We could, of course, contrive a million examples that would confuse it, just as they might confuse a person who, for example, had never seen a number in an international format. One of the big things I believe is that we need to get over the perception that computers and software are faultless. We need to use them to lighten our load but any given system must build trust from its users over time and, even then, must be forgiven for its errors, just as we would its human counterpart. The world us just too lumpy. --Gregg