Messaging System For Prolog Modules
The bot at this present time runs on separate
computers clustered over
tcp/ip .. its database on win2k adv server , It 's main parser runs on Unix, and its
definitive clause grammar sometimes on another machine. In order to implement
the most scalable solution, I have all processes meeting in an IPC party
line. This allows the code written in C,SQL7,DCG,VB,PROLOG,TCL,sh to interact as
if part of the same program any Language that can open a socket can join the
party line and do its job for the total API.
The bot first utilizes an
Eggdrop Party-Line system. This acts as a firewall to the actually processes
from the turbulence of dying sockets and switching remote hosts and is the
place where a all Messaging API happens. Each of the programs/threads
joined a "topic" and can share and advantage from each others code and data
space. Program modules run may run on their own physical machine most of the
time.
Some example modules...
swiProlog - runs from ns1.vast1.com as UID="nobody" .. It telnets into vast1.com:65530 and logs on with its nick "swiProlog" and its password.. its level is Administrator/Owner as it performs the I/O requests of the other processes over the Eggdrop on EFNet. From its account it may use the built in TCL command set. It is written in prolog and runs from SWI-Prolog kernel. This process is always connected and presently serves for demonstrative purposes. SWI-Prolog is a rich and modifiable language
urlfetch - runs from ns1.vast1.com also and has UID="nobody" .. It telnets into vast1.com:65530 and logs on with its nick "urlfetcher" and its password.. its runs as a guest as it performs URL lookups. to return to other processes (Also written in SWI-Prolog).
pesterer - Works way the others do (all processes telnet in) and this is also written in SWI-Prolog
(I am going to obtain more info from the authors of "purl" shortly)
context - runs from dizzy.vast1.com and exists in the same scenario as it logs into the Eggdrop itself.. but use SICStus Prolog command interpreter..
How to win a yearly Chatterbox contest: |
First lets look at some things we don't want to do: i_have_my_agenda_and_your_going_to_follow_it (Parry) i_will_look_up_data_in_human_query_form_and_impress_the_heck _out_of_you (Purl, Shakespeare) i_am_going_to_use_free_association (MegaHAL) i_am_using_keywords_to_find_your_agenda_and_match_it (Eliza, MegaHAL) Those seem to be easy enough modules to write (maybe we will can incorporate some of them later) Now the one I use (also easy to write): I am in an adventure game and you are trying to query me on my whereabouts and my goals. I exist as a mutli-headed life living in several bodies at once each in there own adventure game , my bodies are sharing the same unified database. When you talk to me you are restating a story I hopefully already know and presently acting out .. or you will state book marked section of my map s .. I use you to help me re-live these themes and goals. You are directing my adventure character.. when you are not doing so I am trying to navigate it myself. Sometimes I have to map for something new. I have a map called Oz that is where new things get built into my database. I test them out and try to live them . Sometimes you are telling me something I already know but have never heard it that way.. through our conversations I will decide where and when you are talking about on a paragraph level. If you are doing so and I am in probably in OZ instead of Kansas.. I will hook into both a cross piece that does not allow tight data bindings. If you leave out something like a name or a place that is ok because i will instantiate loosely those places with datum i am already aware of. Some simple stories/games I know are : Hello
world, Greetings, What is your name? What is my name? Games only you know and are going to unavoidably teach me are Being a human , How we can talk about unknown data I am going to teach you how to program for
my database and write the
simple above functions . If you are not familiar with the syntax of Definitive Clause Grammar it reads like this... this --> something, something_else. this WILL BE represented while something AND something else is represented. (conjunctive) this --> something ; something_else. this will be represented while something OR something else is represented. (disjunctive) this --> something . this is equivalent to the above OR. this --> something, {clause}. this will be represented while something is represented and clause is true. this(A) --> something(A), {clause(A)}. this with A will be represented while something with A is represented and clause is true considering clause A. this --> [that]. this will be represented while 'that' is in the statemen t (syntax) this --> something, [that]. this will be represented while something is represented and 'that' follows in a statement. this --> [that] {clause}. this will be represented while 'that' is in the statement and clause is true. Of course there are many more variations of the above and I will create a link here to learn Definitive Clause Grammar syntax if you do not already know it. To explain its usefulness lets take a trip back to Aristotle meaning triangles to when we had syntax, semantics and pragmatics. semantics --> [syntax], {pragmatics}.
Example: These don't always follow the 3 types in this
symmetry such we may have an
all semantic clause. we could say the semantic it_is_lunch_time is
based on the following pragma... The [ ] meant there is nothing particularly
useful syntactically but was required for it_is_lunch_time The reason we do things like this is that most information about our world comes in inconcise and only 'describes' something real. Rules that we make often try to treat semantics like syntactics when they need to be kept separate We have these primitive lookup predicates primitive_lookups
--> semantic_to_syntax( _Sem, _Syn). /* sem2syn/2 */ Syntax is will always match one of these forms (always a flattened list) [atomic,list,of,enitities] /* simple list */ [one_atomic] /* simple atom */ [ ] /* nil */ [a,Variable,inside,a,list] /* equivalent to [a,_,inside,a,list] where variable can be a list of any length */ [_] /* match anything */ [funtion(foo),and,call(predicate)] As long as we denote with braces we can be optimistic it is syntactically parsable Pragma is actual Code that can be executed, often times it can be i/o code.. but sometimes it can be a wrapper to a functional superset of our learned functions. I am using a semi-ISO prolog standard for. I will assume you know a bit of prolog or can fill yourself in at http://www.swi.psy.uva.nl/projects/SWI-Prolog/Manual/ post('hello
there'). semantics are always at the head of a clause and can exist anywhere else in the body semantic_concept1 --> semantic_concept2 ; semantic_concept3 (or) this statement only uses the semantic concept 2 and 3 for their syntactical components when sateliting the syntactic construct. semantic_concept1 --> semantic_concept2 , [syntactic,construct], semantic_concept3. but also implies semantic_concept1 --> semantic_concept2 , semantic_concept3 (and) It seems important at this point to cover a little theory. So you can see what/why we are creating... You are familiar with the problems of parsing and all the nuances of what must be done to parse a natural language. It is a mind blowing difficult task to some, but not to you or I, we see it as just one of our challenges . We envision that once that is done, the sky is the limit. Well there is the entire rainbow to the problem... We want a "Natural Language to Logical Form Language(LFL)" function.. Yes very important.. But what would we do with all that LFL code? ok: "john will love mary" ==> do(time(future),loves(actor(john),actor(mary)). Which is more cryptic to the semantics? We can match do(time(future),loves(actor(john),actor(mary)) to do(time(past),loves(actor(john),actor(mary)). and gather a change occurred in time(X) and know that it represented a difference into time elements and can compare the transitions to other time/state changes. I believe it might be tempting to create this kind of LFL in an adhoc manner.. As per each transitive verb. And then tie them together via ontology. And them define a language for navigating our dynamic ontology. Maybe a nice thought out semantic network with a fixed number of link types? Yes this is useful, I agree. I will assure you that our system is capable of doing this task and more. Getting even more out of a 'well built network' .. The difference you will see in our approach is that we are going to generate any 'terminal objects' that have semantic meaning. Lets spend some time defining the 'perfect' logical form language which is capable of accessing our entire representational scheme. logical_form_language --> script ; plan ; goal. A Script, Plan or Goal makes up the top level of our interpreter. A script is an actual entry into the knowledge system (KS) its internal semantics look like this... script --> scriptlet ; ( scriptlet, script ). /* prefer one unit over a list */ meaning it is a list of tiny scriptlets... scriptlet --> factual_clause ; action_clause ; unknown_clause. /* only 2 true scriptlet types */ factual clauses are semantically declarative in query mode but pragmatic instantiations in execution mode. All factual clauses have to have an execution mode meaning they must be capable of manipulation of variables inside them. They are 'collectors' for unbound variables and 'test'ers to already bound variables. In other languages variables are limited to the pragmatic domain but since we have designed ours having 'collect' or 'test' modes in each declaration, they can work their way into semantics later. factual_clause --> [ fact(Datum) ], { nonvar(Datum), if_possible(Datum) }. /* fact(Datum) is what is put into the internal representation [syntactics] (nonvar(Datum) Datum should never be left unbound. {pragmatics} if_possible(Datum) either tests that Datum is structurally
sound or returns the known facts {pragmatics} Action clauses have no pragmatic requirements as they are actually fixatives or glue for the factual clauses. But each require a syntactic declaration or a subset of other scripts. action_clause itself is a scriptlet as they are often the most complex class of rules often existing cyclically. Here is some of its ontology: action_clause --> phys_conceptual_primitive ; mental_conceptual_primitive ; new_primitive. phys_conceptual_primitive --> ptrans ; atrans ; propel ; move ; grasp ; ingest ; expel ; speak ; attend . mental_conceptual_primitive --> mtrans ; mbuild ; forget . These reserved words like 'ptrans', 'mtrans', 'move' are taken
straight from 'conceptual
dependency theory' propel --> propel(_Actor,_Obj,_Loc,_Force). they also have a manifestation clauses propel(Actor,Obj,Loc,Force) --> [propel(Actor,Obj,Loc,Force)], Notice the arity of the declarations matching up the the
manifestation clauses. means 'Actor' is instanciatable only with things that are somewhere label to be 'actor's as each p(casting,Object) is stated. the neq(Object1,Object2) means in any actual case the two objects are not the same instance.. */ transitional_clause --> transition_semantics( _Object, _State1, _State2). factual_clause --> be_do.
In gaming terms we have 1) Agreement of Initialization And can be represented as.. game_foo --> game_foo_begins
--> game_foo_plays --> /* one turn */ game_foo_plays --> /* series of
turns */ ( two clauses with the same head means disjunctive
'or' ) <more> In this paper I will lay out the problems I am faced with and some proposed solutions. The first and main goal is to create a system that can hold and moderate the 'semantics of interaction' between two functions then eve n entities or data sources. To do this we must identify and continue creating a language that is capable of representing a model. Also we must define an interaction as well. an_interaction(UserA,UserB,Data) -->
mtrans(actor(UserA),info(Data),actor(UserB)) , nil. <more to come... chapter 1 unfinished>
Chapter 2: Hello World Source File contains this one line: To execute it we use: It responds with: or if we used the shorthand sem2syn(program,X),post(X) It still responds with:
Background on Douglas I am a PROLOG programmer that is using Conceptual
Dependancy Theory . |