[erlang-questions] Translating from Prolog to Erlang
Joel Reymont
joelr1@REDACTED
Tue Dec 4 02:05:06 CET 2007
Folks,
Any takers to translate the following bit of Prolog into Erlang?
I suspect that it's something simple but I don't know enough Prolog.
Thanks in advance, Joel
--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% simple English grammar
%% s -> np(Num) vp(Num)
english: rule(s, s, c(np_sg, vp_sg),
[p1 = [arg(np_sg,1,p1), arg(vp_sg,2,p1)]]).
english: rule(s, s, c(np_pl, vp_pl),
[p1 = [arg(np_pl,1,p1), arg(vp_pl,2,p1)]]).
%% np(Num) -> d(Num) n(Num)
english: rule(np2, np_sg, c(d_sg, n_sg),
[p1 = [arg(d_sg,1,p1), arg(n_sg,2,p1)]]).
english: rule(np2, np_pl, c(d_pl, n_pl),
[p1 = [arg(d_pl,1,p1), arg(n_pl,2,p1)]]).
%% np(pl) -> n(pl)
english: rule(np1, np_pl, c(n_pl),
[p1 = [arg(n_pl,1,p1)]]).
%% vp(Num) -> v(Num) np(_)
english: rule(vp, vp_sg, c(v_sg, np_sg),
[p1 = [arg(v_sg,1,p1), arg(np_sg,2,p1)]]).
english: rule(vp, vp_sg, c(v_sg, np_pl),
[p1 = [arg(v_sg,1,p1), arg(np_pl,2,p1)]]).
english: rule(vp, vp_pl, c(v_pl, np_sg),
[p1 = [arg(v_pl,1,p1), arg(np_sg,2,p1)]]).
english: rule(vp, vp_pl, c(v_pl, np_pl),
[p1 = [arg(v_pl,1,p1), arg(np_pl,2,p1)]]).
%% d(sg) -> "a"
english: rule(d_one, d_sg, c, [p1 = [tok(a)]]).
%% d(pl) -> "many"
english: rule(d_many, d_pl, c, [p1 = [tok(many)]]).
%% n(sg) -> "lion"
%% n(pl) -> "lions"
english: rule(n_lion, n_sg, c, [p1 = [tok(lion)]]).
english: rule(n_lion, n_pl, c, [p1 = [tok(lions)]]).
%% n(_) -> "fish"
english: rule(n_fish, n_sg, c, [p1 = [tok(fish)]]).
english: rule(n_fish, n_pl, c, [p1 = [tok(fish)]]).
%% v(sg) -> "eats"
%% v(pl) -> "eat"
english: rule(v_eat, v_sg, c, [p1 = [tok(eats)]]).
english: rule(v_eat, v_pl, c, [p1 = [tok(eat)]]).
%% v(sg) -> "hunts"
%% v(pl) -> "hunt"
english: rule(v_hunt, v_sg, c, [p1 = [tok(hunts)]]).
english: rule(v_hunt, v_pl, c, [p1 = [tok(hunt)]]).
--
http://wagerlabs.com
More information about the erlang-questions
mailing list