Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

SEXP-parser in LISP

Name: Anonymous 2010-12-27 20:55


parseWS xs -> all \Space xs
parseNumber [@xs] -> if (all digit? xs) then asBase 10 xs
parseSymbol [@xs] -> if (all alpha? xs) then asSymbol xs
parseRest x -> x.{[] => 'nil; [@!WS] => 'nil
                  [\Space @!WS e:!Sexp es:!Rest] => if es=='nil [e] [e@es]}
parseList xs -> parseRest [\Space @xs]
parseSexp x -> x.{[e:!Number]=>e; [e:!Symbol]=>e
                  [\( @!WS es:!List \)] => e}

Name: Anonymous 2010-12-29 3:43

>>21
Not related to Haskell, but natural language parsing is pretty difficult as most of them evolved naturally, and to truly be able to obtain the true meaning of a sentence in an unmbiguous way requires "understanding" and "context". There's some promising statistical methods for dealing with this, but they're still quite imperfect. I think the best solution is to just aim at creating a human-level intelligence general AI and teach it human languages (such an AI could be based on a high-level model of our brain or a more low-level model such as a huge neural net that tries to model the neocortex and other related structures. Too bad such projects are still quite expensive these days).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List