can anyone help me to display untranslated word? for example i want to translate, 'i want to eat', in fact, there is no argument of to...so it will display 'saya mahu to makan'...the word to is remain the same it is and need to display it..this is the sample of my code..
:-dynamic(item/1).
kamus(saya,i).
kamus(suka,love).
kamus(awak,you).
run:-
write('Enter a sentence:'),
read(V),
printed(V,C).
%malay to eng
check(S,W,R):-
kamus(R,S),name(S,W).
%eng to malay
check(S,W,R):-
kamus(S,R),name(S,W).
check(Y,R):-
item(Z),name(Z,Y).
try2(P,R):-
name(P,Q),
split(Q,32,E),
member(Z,E),
assert(item(Z)),
(check(Y,R);check(S,W,R)),Z=W.
printed(V,C):-
try2(V,C),write(C),write(' '),fail.
split(String, Space, [Word|List]) :-
append(Word, [Space|Tail], String),
!,
split(Tail, Space, List).
split(String, _Space, [String]).
example of output:
?-run.
Enter the sentence : 'saya benci awak'.
i you no.
**there is no 'benci' in the fact but i need it to display in the output---> 'i benci you'