Merged cenas com hugo

This commit is contained in:
Diogo Cordeiro 2018-12-10 17:37:34 +00:00
parent ea80d57ef9
commit aafef78100
1 changed files with 21 additions and 9 deletions

View File

@ -155,15 +155,29 @@ is_number_in_predicate(C, F) :-
/*******************************
* NLP *
*******************************/
/* DCG */
separator --> ["and"].
separator --> ["by"].
command --> ["show"].
command --> ["multiply"].
command --> ["simplify"].
command --> ["add"].
command --> ["forget"].
expression(A,B,C):-writeln("oi"),writeln(A),writeln(B),writeln(C),writeln("bye").
instruction(Left_expr, Right_expr) --> command, expression(Left_expr), separator, expression(Right_expr).
polyplay :-
write("> "),
read(R),
read_line_to_codes(user_input, R),
(
R = bye,
writeln(R),
R = "bye",
write("See ya")
;
(
nlp_understand(R, P, I),
(
nlp_understand(R, P, I),
writeln("That's trivial:"),
nlp_compute(P, I)
;
@ -172,9 +186,10 @@ polyplay :-
polyplay
).
nlp_understand(R,P,I) :-
nlp_understand(R, P, I) :-
split_string(R, "\n", "\r\t ", RL),
(
R = simplify_x_squared,
RL = "simplify x squared",
P = simplify,
I = x^2
;
@ -307,9 +322,6 @@ parse_expression(TL, TL-TR) --> parse_number(void, TR), { TR \= void, TL \= void
%% ?- parse_expression(T, [two, times, times, two], _).
%@ false.
/*******************************
* BACKEND *
*******************************/