


dominique f pannier wrote:Hi,
Natural language processing is a world of its own. There is a priori no reason to think that a computer language is better than another to do such a thing. But a main feature of that world is that it requires many original modelling tools. The advantadge of VIP is that it's very well adapted to that function. With practice, you can build a collection of tools whithout ever loosing sight of your goal because you need to focus on the language computer logic : with VIP, this one becomes almost transparent.
So I think it's good to bring in the idea natural language processing with VIP.
I also think that the best recommendation is to start practising directly VIP with simple language treatments.
Code: Select all
class predicates
interpret : (string List).
clauses
interpret(["forward", LenStr, Unit]) :-
Len = tryToTerm(integer, LenStr),
!,
forward(Len Unit).
...
interpret([F|Args]) :-
stdio::writef("Could not interpret %(%)\n", F, string::concatWithDelimiter(Args, ", ")).
interpret([]) :-
stdio::write("Nothing to interpret\n").
Code: Select all
stdio::write("Hello World", "\n").
Code: Select all
implement main
open core
clauses
run() :-
stdio::write("Hello World", "\n"). % place your own code here
end implement main
goal
console::runUtf8(main::run).
Thomas Linder Puls wrote:Visual Prolog does not have facilities for making calls in that way, you will have to create an interpreting predicate yourself:
Code: Select all
class predicates interpret : (string List). clauses interpret(["forward", LenStr, Unit]) :- Len = tryToTerm(integer, LenStr), !, forward(Len Unit). ... interpret([F|Args]) :- stdio::writef("Could not interpret %(%)\n", F, string::concatWithDelimiter(Args, ", ")). interpret([]) :- stdio::write("Nothing to interpret\n").
dominique f pannier wrote:Well, I see that what you mean by "natural language processing" is at a starting level.
I think then you should deal with the problem with some method :
1) you can get answers to such questions in the book Visual Prolog for Tyros which will gradualy show you how VIP works.
1) you should later run and analyse Visual Prolog Examples which provides you different tools that you can test with your own data.
The code you have to write to answer at your first question is the following one :that you put at the suggested place in the main.pro class of a console project like below :Code: Select all
stdio::write("Hello World", "\n").I let you study how to answer at the second one.Code: Select all
implement main open core clauses run() :- stdio::write("Hello World", "\n"). % place your own code here end implement main goal console::runUtf8(main::run).
Thomas Linder Puls wrote:Visual Prolog does not have facilities for making calls in that way, you will have to create an interpreting predicate yourself:
Code: Select all
class predicates interpret : (string List). clauses interpret(["forward", LenStr, Unit]) :- Len = tryToTerm(integer, LenStr), !, forward(Len Unit). ... interpret([F|Args]) :- stdio::writef("Could not interpret %(%)\n", F, string::concatWithDelimiter(Args, ", ")). interpret([]) :- stdio::write("Nothing to interpret\n").
Code: Select all
domains
limited = [0..50] digits 16.
Code: Select all
domains
fixed = a; b; c.
Thank you verry much.You have given me so much help.Someday you come to China,I invite you for dinnerThomas Linder Puls wrote:For a real domain you will have to include "digits" in the definition like this:
(16 is actually the only sensible choice).Code: Select all
domains limited = [0..50] digits 16.
You cannot define a sub-set of string like you propose, but you can define a functor domain with a fixed set of functors/enumerators:
That domain only have the three possible values a, b and c, but they are not like strings enclosed in quotes.Code: Select all
domains fixed = a; b; c.