Link Parse to Logic via Lojban

From OpenCog
Jump to: navigation, search

(initial version by Ben Goertzel, July 8, 2016; radically revised by Ben November 2016)

This page suggests a radical replacement of R2L with an alternate system that is more in the spirit of the previous “RelEx2Frame” but uses Lojban in place of FrameNet.

Basic Idea

The basic idea is to replace the current RelEx2Logic (R2L) layer with rules that translate link parser output into logical Atoms that are organized based on the Lojban language.

(Note that a Lojban-to-Atomese framework already exists in OpenCog, though it is not yet complete at time of writing... it's being actively completed by Roman Treutlein)

These rules will not be hand-coded, but will be generated via a special pattern-mining process running on the results of loading a special text corpus into the Atomspace. This special text corpus will be a parallel (natural language, Lojban) corpus.

Lojban 2 LinkParse2Logic.png
We will start with an (English, Lojban) corpus, which will then result in an English version of the LinkParse2Logic rules. After this works, we will try the same process with a (Chinese, Lojban) corpus, resulting in a LinkParse2Logic rule-base for Chinese.

To expand the coverage of the rule-base for a certain language, one will then need to expand the parallel Lojban corpus for that language to include additional sentences, and re-run the special pattern-mining process.

The special pattern-mining process should be do-able using the OpenCog Pattern Miner, but with a special control mechanism layered on top of it.

Because the rules mined by this process will overlap in complex ways, PLN forward chaining will often be needed to apply them to complex sentences.

Alternatively, pattern-mining could be essentially wrapped in a PLN rule and called directly by the forward or backward chainer. The advantage of having the backward chainer call the pattern miner is that it can narrow the search by imposing a certain pattern on the output.

As a later stage, PLN inference will also be helpful for enabling the application of rules to cases that only approximately match them; and extrapolating new rules via combination of existing rules, to handle cases not in the parallel corpus. But this can be thought about in detail later, once the basic process is working.

Advantages of this approach would be:

  • 1) A more thorough and systematic layer of rule translating linguistic dependency relations into more abstract logic relations
  • 2) No abstract rules need to be hand-coded, only translations from English (or other languages) into Lojban
  • 3) An elegant way to connect language with abstract ontologies in the Atomspace
  • 4) No need to rebuild the rule base when the link grammar dictionary is changed; e.g. when it is replaced with rules that are learned via unsupervised language learning
  • 5) The approach can work for any language; one just needs to translate the English portion of the English-Lojban parallel corpus into the other language
  • 6) A simple methodology for handling multiple languages and translating between them. OpenCog becomes a machine translation engine!

Preliminary Sketchy Example

To motivate the approach, suppose we provide the translation

mi lumci le creka le grasu le rirxe 
	
I wash the grease off the shirt in the river.

Now, from dictionary lookup we know

creka = shirt
lumci = wash
grasu = grease
rirxe = river

And from the Lojban interface to OpenCog, we know the former sentence is mapped into

lumci(mi, creka, grasu, rirxi)

i.e. basically (the reality is a little more complicated in its details, and will be elaborated in later sections on this page)

EvaluationLink
	PredicateNode “arg_1”
	ListLink
		PredicateNode “lumci”
		ConceptNode “mi”

EvaluationLink
	PredicateNode “arg_2”
	ListLink
		PredicateNode “lumci”
		PredicateNode “creka”


etc., 

From the example translation we can then induce the rule (using pattern mining or PLN)

$I wash the $G off the $S in the $R.
==>
$I lumci le $S le $G le $R

Note, this rule will not have a strength of 1, because in the case of

I wash the grease off the shirt in the spring.

it would be wrong. But that's OK.

So, suppose we feed OpenCog a number of parallel translations like this — i.e. a number of simple sentences for each verb, exemplifying the argument structure; and a number of simple examples of each type of relative clause, conjunction, etc.

Then by abstracting from these translations in the manner of the example above, OpenCog can pretty straightforwardly induce mappings from simple English sentences into simple Lojban sentences, and thus into Atomese representations of Lojban sentences.

But the link parser represents each English sentence as a set of typed links. Thus from each these examples we can induce a mapping from a set of typed links into a set of Atomese expressions. In the above example the induced rule looks like (being very rough and simplistic -- more precise examples will be given below)

AND
	subj(wash,$I)
	obj(wash,$G)
	off($G,$S)
	in(wash,$R)

==>  (ImplicationLink)

AND

   EvaluationLink
	PredicateNode “arg_1”
	ListLink
		PredicateNode “lumci”
		$I
  
   EvaluationLink
	PredicateNode “arg_2”
	ListLink
		PredicateNode “lumci”
		$S

   EvaluationLink
	PredicateNode “arg_3”
	ListLink
		PredicateNode “lumci”
		$G

   EvaluationLink
	PredicateNode “arg_4”
	ListLink
		PredicateNode “lumci”
		$R


Having a large collection of such rules, we can then map the link parser output from any complex sentence into a collection of Lojbanic Atomese relationships.

The beauty of this approach is: no R2L or RelEx2Frame type rules need to be coded. All one needs is a bunch of (English, Lojban) simple-sentence pairs.

Language generation can also be handled in this way, as will be elaborated below.

To repeat some of the ancillary benefits of this approach, briefly summarized above:

  • 1) Ben is in the midst of developing a systematic ontology for connecting perception, action, language and cognition. However, connecting such an ontology to English with all its peculiarities is a pain. Connecting the ontology to Lojban is much more elegant and simple. But if the NLP pipeline is based on translation of English into Lojban, then a Lojban-based ontology will be just fine.
  • 2) For porting OpenCog to multiple languages, basically if the language in question has a dependency parser (or one can be built), then all that is needed to create a R2L type layer is to make a parallel-simple-sentences corpus between that language and Lojban.
  • 3) Via comprehending in one language and Sureal-Ing in another language, OpenCog becomes a machine translation system. Using Markov modeling to make Sureal output more natural-sounding, is naturally morphed into making a hybrid machine translation paradigm (if the Markov model is extended across both the input and output languages).
  • 4) Since the rules are learned via abstraction from a parallel corpus, when we get rid of hand-coded rules in the NL comprehension pipeline, PLN can just re-learn the rules... no need to re-code new rules based on the new, learned NL comprehension system...

Motivations

Firstly, I take as the premise of my discussion here that we are building an AGI system which has explicit, abstract logical inference as a significant component (e.g. PLN). If you want to argue for an AGI path that is purely subsymbolic, then I'm not going to dispute the viability of such a path, but I don't think it's optimal and anyway my suggestion of Lojban for OpenCog is premised on the fact that PLN is a big component of OpenCog...

The question then is how to map natural-language relationships into logic relationships.... Four approaches are obvious given current technologies:

  • 1) Hand-code mapping rules in some form
  • 2) Learn mapping rules via supervised learning, from a training corpus
  • 3) Learn mapping rules via unsupervised learning, from e.g. a big corpus of texts or speech
  • 4) Learn mapping rules via an embodied system's experience, i.e. via reinforcement and imitation learning combined with unsupervised learning

...

(4) is obviously appealing to me. For (4) to work one probably needs to hand-code mappings from nonlinguistic perception (e.g. vision, audition) into logical representation, but this is perhaps less problematic than hand-coding mappings from language into logic, because vision and audition have simpler structures in a way

Without hand-coded mappings from nonlinguistic perception into logic, it's hard to see how (4) would work *unless* one was also willing to have the logic itself emerge via reinforcement/ imitation / unsupervised learning. That is, unless one was willing to give up starting from a fixed logic like PLN and let the logic be learned.... I think this is possible but IMO it gets into "evolution of a brain architecture" territory rather than "learning within a brain architecture" territory...

What I am hoping to do is seed (4) with a combination of (1) and (3)

Specifically, regarding (3), Linas and I already wrote a paper pointing in the direction of what we want to do....

https://arxiv.org/abs/1401.3372

However, at the moment I don't personally see how that approach is going to let us learn something analogous to the RelEx2Logic rules. I think it can let us learn something analogous to the link parser grammar plus the RelEx rules. But I don't see how the unsupervised learning paradigm we describe there is going to learn rules that connect to PLN logic specifically.... I can sorta imagine how this might happen, but it seems really hard...

So then we could use our unsupervised learning method for (3) and then do (4) just for learning R2L rules. That might be viable....

However, Lojban seems to me like it could yield a robust way of doing (1), which could potentially accelerate the overall process of making an AGI that really understands language...

Our current R2L rule-base is kind of a mess and is also very incomplete. So if we're going to do practical NLP dialogue applications with OpenCog in the near future we need to either extend/improve R2L or replace it. Taking approach (4) or "(4) on top of (3)" is too researchy and difficult to be relevant to near-term application development, though it's an important research direction..

The value of Lojban for an R2L-type layer is based on the facts that

  • A) Lojban directly maps into predicate logic, so into PLN-friendly Atomese
  • B) Lojban expresses everything that natural language expresses, in ways that are reasonably elegant and already worked-out by other people, and honed by decades of practice. (On the other hand, the current system of R2L outputs is kind of unsystematic and messy... and turning it into something elegant and coherent would be a lot of work...)
  • C) via generating Relex2Lojban or LinkGrammar2Lojban rules from a parallel English/Lojban corpus, one avoids hand-coding any rules... instead one can use this sample corpus to generate a R2L-like layer for any syntax parser, including one learned via (3) or (3)+(4)... or Google's newly released parser... or whatever...
  • D) unlike hand-coding R2L rules, the approach is more language-independent (one only needs to create a parallel corpus in Lojban and the new language, to extend the approach to a new language)

...

Regarding B, please do not minimize this point. FrameNet doesn't do this, Cyc-L doesn't do this, SUMO doesn't do this.. the system of R2L outputs doesn't currently do this ... Lojban does this...

The point is not relabeling ConceptNodes with Lojban word-names instead of English word-names. The point is that Lojban contains

  • B1) a more complete and commonsensical list of argument-structures for verbs than Framenet
  • B2) systematic, commonsensical ways of dealing with everyday uses of time, space, conjunction, possession, comparisons, etc. etc. in formal logic

It's not the Lojban word-names that matter, it's the precisely-stated logical relationships between the Lojban words...

Collating the Parallel Corpus

The first step to realizing this vision is to collate a parallel corpus between English and Lojban

This would take the form of a spreadsheet where column 1 is Lojban and column 2 is English, and each row consists of (roughly) the same semantic content expressed in both Lojban and English.

Sources for this would seem to consist of:

  • 1) Jbovlaste, the Lojban dictionary, which contains English glosses for Lojban words, showing how their argument structures relate to English. These can be methodically turned into parallel sentences.
  • 2) The Lojban grammar and Lojban beginner’s textbook, which contain example sentences in both English and Lojban. These sentences cover basically all Lojban syntactic and semantic phenomena.
  • 3) A short list of everyday English conversations translated into Lojban, line by line.
  • 4) English texts translated into Lojban, e.g. Alice in Wonderland. These would need to be broken up, by a decent Lojban reader, into pairs of “aligned” sentences. (A first pass at this could be taken by a script doing word-matching, but then some human would need to double-check it and make small fixes.)

Roman Treutlein has made a lot of progress on this so far; I think that at time of writing he has more than 10,000 sentences in his parallel corpus... and it's growing...


Lojban-to-Atomese

To make the discussion concrete, at the end of this page you will find the Atomese representations of the Lojban-Atomese output for the three simple sentences (along with the link parser output, for good measure)

Bob tickled Mary
la bob cu mi'arpe'u la maris

Bob loved the little chicken.
la bob prami lo jipci poi ke'a cmalu ko'a

Who did you ask?
ma se preti fi do

Let’s step through the Lojban-Atomese output for the first sentence in detail. Firstly,

• “la” is an article that goes before a proper name • “mi’arpe’u” means “tickle”; its first argument (called “sumti 1” in Lojban) is the tickler and its second argument (“sumti 2”) is the ticklee • “cu” is a glue word that separates the first argument from the predicate, in a simple Lojban expression like this

So

la bob cu mi'arpe'u la maris

basically says

name-Bob separator tickle name-Mary

and the Lojban-Atomese parser basically maps this into

tickle(entity named Bob, entity named Mary)

which in Atomese looks like

EvaluationLink
      PredicateNode “tickle”
      ListLink
             ConceptNode “entity named Bob”
             ConceptNode “entity named Mary”

Or else like (the route we have taken in the Lojban-Atomese interface)

EvaluationLink
      PredicateNode “arg1”
      ListLink
            PredicateNode “tickle”
            ConceptNode “entity named Bob”

EvaluationLink
      PredicateNode “arg2”
      ListLink
            PredicateNode “tickle”
            ConceptNode “entity named Mary”

The reason to take this latter strategy is that in Lojban it’s easy and normal to add extra argument-slots to a predicate. So it’s better not to use a representation where linguistic/common-sense predicates have fixed arities.

The details are a little more complicated than this, in a way that should be familiar to anyone who knows the inner workings of the English OpenCog NLP pipeline – basically the complexities have to do with instances versus concepts. What we really have is more like

EvaluationLink
      PredicateNode “arg1”
      ListLink
            PredicateNode “tickle123”
            ConceptNode “Bob123”

EvaluationLink
      PredicateNode “arg2”
      ListLink
            PredicateNode “tickle123”
            ConceptNode “Mary123”

EvaluationLink
    PredicateNode “arg1”
    ListLink
            PredicateNode “name”
            ConceptNode “Bob”

EvaluationLink
    PredicateNode “arg2”
    ListLink
            PredicateNode “name”
            WordNode “Bob”

EvaluationLink
    PredicateNode “arg1”
    ListLink
            PredicateNode “name”
            ConceptNode “Mary”

EvaluationLink
    PredicateNode “arg2”
    ListLink
            PredicateNode “name”
            WordNode “Mary”


InheritanceLink
            ConceptNode “Bob123”
            ConceptNode “Bob”

InheritanceLink
            ConceptNode “Mary123”
            ConceptNode “Mary”

To step through the Lojban parse in detail, the snippet

   EvaluationLink (stv 0.75 0.9)
        PredicateNode (stv 1.0 0.0) "mi'arpe'u_sumti2"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "nMtuPfmIJBTgtPV),5on___mi'arpe'u"
          ConceptNode (stv 1.0 0.0) "1:B}MGduk`(2d/;iJ3T]___!#ur#SlFw}Ie,K6`E%a*___maris"
   EvaluationLink (stv 0.75 0.9)
        PredicateNode (stv 1.0 0.0) "mi'arpe'u_sumti1"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "nMtuPfmIJBTgtPV),5on___mi'arpe'u"
          ConceptNode (stv 1.0 0.0) "&/[xeRcQQ/rO!=THuNQk___+\tuh'fo<ZH(,*|L]W&a___bob"

is basically

EvaluationLink
      PredicateNode “arg1”
      ListLink
            PredicateNode “tickle123”
            ConceptNode “Bob123”

EvaluationLink
      PredicateNode “arg2”
      ListLink
            PredicateNode “tickle123”
            ConceptNode “Mary123”

Note that instead of “arg1” we have the equivalent of “tickle_arg1” in the Lojban output. This is not strictly necessary, but is more analogous to the case where the argument is added on the fly, e.g. if we had

EvaluationLink
    PredicateNode “speed”
    ListLink
        PredicateNode “tickle123”
        ConceptNode “fast”

to represent an extra argument-slot added to “tickle” to indicate the speed of the tickling.


The snippet

   EvaluationLink (stv 1.0 0.9)
        PredicateNode (stv 1.0 0.0) "cmene_sumti2"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "b=ne*!t9/:goXnZ?qDVR___cmene"
          ConceptNode (stv 1.0e-6 1.0e-2) "+\tuh'fo<ZH(,*|L]W&a___bob"
   EvaluationLink (stv 1.0 0.9)
        PredicateNode (stv 1.0 0.0) "cmene_sumti1"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "b=ne*!t9/:goXnZ?qDVR___cmene"
          ConceptNode (stv 1.0 0.0) "bob"

is basically


EvaluationLink
    PredicateNode “arg1”
    ListLink
            PredicateNode “name”
            ConceptNode “Bob”

EvaluationLink
    PredicateNode “arg2”
    ListLink
            PredicateNode “name”
            WordNode “Bob”

and there is a similar snippet for Mary’s name.

The snippet

    InheritanceLink (stv 1.0 0.9)
      ConceptNode (stv 1.0 0.0) "&/[xeRcQQ/rO!=THuNQk___+\tuh'fo<ZH(,*|L]W&a___bob"
      ConceptNode (stv 1.0e-6 1.0e-2) "+\tuh'fo<ZH(,*|L]W&a___bob"

basically says

InheritanceLink
    ConceptNode “Bob123”
    ConceptNode “Bob”

and there are similar snippets for Mary and tickle.

Patterns Between Link Parses and Atomese Lojban Interpretations

OK … now let us turn to the main topic of this page: How to create a system of “RelEx2Logic” type rules, by mapping link parses to logic expressions, by way of a Lojban-English (or Lojban-Chinese, etc.) parallel corpus.

Let’s first look at a simple example. Notice in these examples that “Mary tickled” and “Bob loved” are both represented, in the link parses of the relevant sentences, by Ss links


  +--Ss--+
  |       |      
Bob tickled 

  +--Ss--+
  |       |      
Mary   loved
 

In the Lojban-Atomese output, this corresponds to

     EvaluationLink (stv 0.75 0.9)
        PredicateNode (stv 1.0 0.0) "mi'arpe'u_sumti1"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "nMtuPfmIJBTgtPV),5on___mi'arpe'u"
          ConceptNode (stv 1.0 0.0) "&/[xeRcQQ/rO!=THuNQk___+\tuh'fo<ZH(,*|L]W&a___bob"
     
     EvaluationLink (stv 0.75 0.9)
        PredicateNode (stv 1.0 0.0) "prami_sumti1"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "|^F<jOd;aZc@Ld@7..}5___prami"
          ConceptNode (stv 1.0 0.0) "&/[xeRcQQ/rO!=THuNQk___+\tuh'fo<ZH(,*|L]W&a___bob"

Looking at these two examples suggests a LinkParse-to-Logic mapping rule, of the form

 ImplicationScopeLink
    VariableList
       TypedVariableLink
          VariableNode "$A"
          TypeNode "WordNode"
       TypedVariableLink
          VariableNode "$B"
          TypeNode "WordNode"
       TypedVariableLink
          VariableNode "$C"
          TypeNode "ConceptNode"
       TypedVariableLink
          VariableNode "$P"
          TypeNode "PredicateNode"
    AndLink
       EvaluationLink
          PredicateNode "linkparser_Ss"
          ListLink
             VariableNode "$A"
             VariableNode "$B"
       ReferenceLink
          VariableNode "$C"
          VariableNode "$A"
       ReferenceLink
          VariableNode "$P"
          VariableNode "$B"
    ExistsLink
        TypedVariableLink
           VariableNode "$S"
           TypeNode "PredicateNode"
        AndLink
           EvaluationLink
              VariableNode "$S"
              ListLink
                 VariableNode "$P"
                 VariableNode "$C"
           ImplicationLink
              VariableNode "$S"
              PredicateNode "sumti1"

This relies on having links of the form

     ImplicationLink
        PredicateNode (stv 1.0 0.0) "mi'arpe'u_sumti1"
        PredicateNode (stv 1.0 0.0) "sumti1”
     
     ImplicationLink
        PredicateNode (stv 1.0 0.0) "prami_sumti1"
        PredicateNode (stv 1.0 0.0) "sumti1”

in the Atomspace, which is quite reasonable.

This rule would be uncertain, because what it says is that “subject” of an English verb tends to map into “argument 1” of a Lojban predicate, which is probabilistically nearly always true, but isn’t necessarily strictly true. Still, this is a useful thing for the system to know, in case at some point it sees a Lojban word in its parallel corpus for which it doesn’t have a lot of training examples. According to this general background knowledge, if a single example involving a new Lojban word obeys the principle “subject of English verb corresponds to first argument of corresponding Lojban predicate”, then the system will assign greater confidence to the pattern observed in this example, because it fits with the general pattern it’s seen.

On the other hand, a more particular pattern such as

 ImplicationScopeLink
    VariableList
       TypedVariableLink
          VariableNode "$A"
          TypeNode "WordNode"
       TypedVariableLink
          VariableNode "$B"
          TypeNode "WordNode"
       TypedVariableLink
          VariableNode "$C"
          TypeNode "ConceptNode"
       TypedVariableLink
          VariableNode "$P"
          TypeNode "PredicateNode"
    AndLink
       EvaluationLink
          PredicateNode "linkparser_Ss"
          ListLink
             VariableNode "$A"
             VariableNode "$B"
       ReferenceLink
          VariableNode "$C"
          VariableNode "$A"
       ReferenceLink
          VariableNode "$P"
          VariableNode "$B"
       ImplicationLink
          VariableNode $P
          PredicateNode "tickle"
    ExistsLink
        TypedVariableLink
           VariableNode "$P1"
           TypeNode "PredicateNode"
        AndLink
           EvaluationLink
              PredicateNode "mi'arpe'u_sumti1"
              ListLink
                 VariableNode "$P1"
                 VariableNode "$C"
           ImplicationLink
              VariableNode "$P1"
              PredicateNode "mi'arpe'u"

can be, in this simple case, mined just from the one example of “Bob tickled Mary” and its Lojban translation. PLN would boost the confidence of this rule, mined from the one example, based on the general pattern given above.

The example I’ve just given is somewhat trivial. Things will get more interesting when dealing with relative clauses, conjunctions, quantifiers and various other tricky linguistic phenomena. However, the same basic principle holds in these cases as well. The Lojban to Atomese mapping gives precise logic-based renditions of the basic semantics of the Lojban sentences. The link parses of English (or other natural language) sentences give precise renditions of the syntax of the English sentences. Based on a parallel corpus between Lojban and English (or the other natural language in question), one can then do some pattern mining and infer rules mapping English link parses into Lojban-based Atomese representing logical relationships.

The open questions here are: 1) how complex is the pattern mining, and 2) how large does the parallel corpus have to be? Here we are relying somewhat on Ben’s intuition!

To make this work in practice, the pattern mining algorithm has to be of the nature that it can get the pattern corresponding to a simple linguistic phenomenon from one or two examples, and to a complex linguistic phenomenon from perhaps a dozen examples. The Lojban corpus we have consists of 20K sentences or so, and we can expand it if need be (via doing new translation), but not by orders of magnitude.

While relying on a parallel corpus is not ideal, it is much better than relying on an expert rule-base. And while an approach to inferring a link grammar dictionary from a corpus via unsupervised learning has been articulated, no such approach to inferring LinkParse2Logic mapping rules appears to be viable. It does seem viable to infer LinkParse2Logic mapping rules via embodied learning, where the logic relations corresponding to a sentence are inferred from the non-linguistic observations associated with that sentence. However, this would require better embodiments than we currently have on hand, and a lot of training data or experience. The approach proposed here via Lojban is viable to pursue right now, and does not require building up an inflexible rule-base needing maintenance, because the pattern mining can be re-run when new link grammar dictionaries are available (due to language learning creating new ones, or due to applying the approach to additional languages, etc.)

Statistical Pattern Mining, and Inferential Rule Application

So how should the pattern mining be done? There are surely many ways to slice the problem. Here is my current suggestion.

We begin with a parallel English/Lojban corpus (the same approach will work for other languages beyond English, but we will stick with English here for simplicity, and because it is where we’ll actually start). We may assume we also have a larger English-only corpus, which we will also link-parse.

Step 1 is to do pattern mining on the larger English corpus. The goal of the pattern mining is to find combinations of link-grammar link types that occur surprisingly frequently in the sentences in the corpus. Then, we mine the English portion of the parallel corpus and make an index of all combinations of link-grammar link types that occur therein (leaving out large infrequent combinations). We then take the intersection of these lists: i.e. we take the combinations that are surprising in the larger corpus, and also occur reasonably frequently in the English portion of the parallel corpus (where the definition of “reasonably frequently” will depend on the combination size).

Step 2 involves iterating through all the combinations identified at the end of Step 2, and carrying out a separate pattern mining process for each of these combinations, as well as for each link grammar link type individually (from here on we will consider these as “combinations of size 1”, for sake of simplicity). For each combination C,

  • One isolates the set of English sentences in the parallel corpus that contain this combination in their link parses, and then isolates the set of corresponding Lojban sentences (call this latter set L_C).
  • One then looks at the set A_C of Atomese interpretations of the Lojban sentences in L_C.
  • One applies pattern mining to find patterns of Atom-combination that are either highly frequent, or surprisingly frequent, in L_C (where “surprisingness” is measured relative to the Atomese interpretations of the Lojban sentences in the parallel corpus that are not in L_C).


After doing Step 2, one has a set of “rules” of the form

ImplicationLink (or ImplicationScopeLink)
      Combination of link-parser links
      Pattern of Atoms (which will be logical Lojbanic Atoms)

These are the LinkParse2Logic rules. Note that they may overlap. This is where PLN comes in.

Step 3) To apply these rules, one uses the PLN forward-chainer. An English sentence is parsed, and then produces a set of link-parser links. The LinkParse2Logic rules are then applied, and the results of applying the multiple rules are merged together using PLN reasoning. Some application-specific inference control heuristics may be needed to keep this reasoning process from taking a long time. The Atoms resulting from this inference process are the logical interpretation of the English sentence.

Ta-daah!!

Like many things in AI, the above is surely much easier said than done. But there is no big mysterious leap required; the mapping of Lojban into logic is complicated but formulaic, and the pattern mining suggested is just a particular organization of counting.

Language Generation via Inferential Application of Reversed Rules

It is also worth noting that the process can be reversed. The current Lojban-to-Atomese parser also works in reverse, so that if we have a set of logical Atoms relating Lojbanic Atoms, we can use this to generate Lojban sentences. Or, we can reverse the implications mentioned above so they look like

ImplicationLink (or ImplicationScopeLink)
      Pattern of Atoms (which will be logical Lojbanic Atoms)
      Combination of link-parser links

(of course, the truth values of these reversed links will be different, according to Bayes’ rule).

Then, to do generation, one can start from a set of logical Lojbanic Atoms and apply PLN to these implication links. The result will be a set of English WordNodes related by link-parser link types. To get from such a set to English sentences can either be done by a slight variation of the current Sureal process, or by an optimization algorithm.

APPENDIX: Lojban-to-Atomese Examples

Here are examples of the Atomese logical representations of a few simple Lojban sentences. I have also thrown in the link parse for the English translation of each sentence, just for good measure...

These could be made prettier looking, but they are presented here in the form that currently comes out of the Lojban parser that Roman Treutlein has coded for OpenCog.

Bob tickled Mary 
la bob cu mi'arpe'u la maris

  +--Ss--+--Os--+
  |      |      |
Bob tickled.v  Mary

ListLink (stv 1.0 0.0)
    AndLink (stv 1.0 0.0)
      EvaluationLink (stv 0.75 0.9)
        PredicateNode (stv 1.0 0.0) "mi'arpe'u_sumti2"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "nMtuPfmIJBTgtPV),5on___mi'arpe'u"
          ConceptNode (stv 1.0 0.0) "1:B}MGduk`(2d/;iJ3T]___!#ur#SlFw}Ie,K6`E%a*___maris"
      EvaluationLink (stv 0.75 0.9)
        PredicateNode (stv 1.0 0.0) "mi'arpe'u_sumti1"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "nMtuPfmIJBTgtPV),5on___mi'arpe'u"
          ConceptNode (stv 1.0 0.0) "&/[xeRcQQ/rO!=THuNQk___+\tuh'fo<ZH(,*|L]W&a___bob"
    AndLink (stv 1.0 0.0)
      EvaluationLink (stv 1.0 0.9)
        PredicateNode (stv 1.0 0.0) "cmene_sumti2"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "b=ne*!t9/:goXnZ?qDVR___cmene"
          ConceptNode (stv 1.0e-6 1.0e-2) "+\tuh'fo<ZH(,*|L]W&a___bob"
      EvaluationLink (stv 1.0 0.9)
        PredicateNode (stv 1.0 0.0) "cmene_sumti1"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "b=ne*!t9/:goXnZ?qDVR___cmene"
          WordNode (stv 1.0 0.0) "bob"
    InheritanceLink (stv 1.0 0.9)
      ConceptNode (stv 1.0 0.0) "&/[xeRcQQ/rO!=THuNQk___+\tuh'fo<ZH(,*|L]W&a___bob"
      ConceptNode (stv 1.0e-6 1.0e-2) "+\tuh'fo<ZH(,*|L]W&a___bob"
    ImplicationLink (stv 1.0 0.9)
      PredicateNode (stv 1.0 0.0) "nMtuPfmIJBTgtPV),5on___mi'arpe'u"
      PredicateNode (stv 1.0 0.0) "mi'arpe'u"
    AndLink (stv 1.0 0.0)
      EvaluationLink (stv 1.0 0.9)
        PredicateNode (stv 1.0 0.0) "cmene_sumti2"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "b=ne*!t9/:goXnZ?qDVR___cmene"
          ConceptNode (stv 1.0e-6 1.0e-2) "!#ur#SlFw}Ie,K6`E%a*___maris"
      EvaluationLink (stv 1.0 0.9)
        PredicateNode (stv 1.0 0.0) "cmene_sumti1"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "b=ne*!t9/:goXnZ?qDVR___cmene"
          WordNode (stv 1.0 0.0) "maris"
    InheritanceLink (stv 1.0 0.9)


Mary loved the little chicken.
la maris cu prami lo jipci poi ke'a cmalu


      +---------Os---------+
      |    +------D*u------+
 +-Ss-+    |      +----A---+
 |    |    |      |        |
Mary loved the little.a chicken.n 		




la maris cu prami lo jipci poi ke'a cmalu, Mary loved the little chicken.



  ListLink (stv 1.0 0.0)
    AndLink (stv 1.0 0.0)
      EvaluationLink (stv 0.75 0.9)
        PredicateNode (stv 1.0 0.0) "prami_sumti2"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "|^F<jOd;aZc@Ld@7..}5___prami"
          ConceptNode (stv 1.0 0.0) "7},+asi)LBD9lt|T_i}L___Lvh+9z&e{$jsxAB*l=k6___"
      EvaluationLink (stv 0.75 0.9)
        PredicateNode (stv 1.0 0.0) "prami_sumti1"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "|^F<jOd;aZc@Ld@7..}5___prami"
          ConceptNode (stv 1.0 0.0) "&/[xeRcQQ/rO!=THuNQk___+\tuh'fo<ZH(,*|L]W&a___maris"
    AndLink (stv 1.0 0.0)
      EvaluationLink (stv 1.0 0.9)
        PredicateNode (stv 1.0 0.0) "cmene_sumti2"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "b=ne*!t9/:goXnZ?qDVR___cmene"
          ConceptNode (stv 1.0e-6 1.0e-2) "+\tuh'fo<ZH(,*|L]W&a___maris"
      EvaluationLink (stv 1.0 0.9)
        PredicateNode (stv 1.0 0.0) "cmene_sumti1"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "b=ne*!t9/:goXnZ?qDVR___cmene"
          WordNode (stv 1.0 0.0) " maris "
    InheritanceLink (stv 1.0 0.9)
      ConceptNode (stv 1.0 0.0) "&/[xeRcQQ/rO!=THuNQk___+\tuh'fo<ZH(,*|L]W&a___ maris "
      ConceptNode (stv 1.0e-6 1.0e-2) "+\tuh'fo<ZH(,*|L]W&a___ maris "
    ImplicationLink (stv 1.0 0.9)
      PredicateNode (stv 1.0 0.0) "|^F<jOd;aZc@Ld@7..}5___prami"
      PredicateNode (stv 1.0 0.0) "prami"
    AndLink (stv 1.0 0.0)
      EvaluationLink (stv 0.75 0.9)
        PredicateNode (stv 1.0 0.0) "cmalu_sumti1"
        ListLink (stv 1.0 0.0)
          PredicateNode (stv 1.0 0.0) "\<%uEWCjN3Rhs.0okdHH___cmalu"
          ConceptNode (stv 1.0 0.0) "=vfy`&y-EDDF>!_wt,fv___ke'a"
    ImplicationLink (stv 1.0 0.9)
      PredicateNode (stv 1.0 0.0) "oaxoLn7sNPqOqs{!H'Vx___jipci"
      PredicateNode (stv 1.0 0.0) "jipci"
    InheritanceLink (stv 1.0 0.9)
      ConceptNode (stv 1.0 0.0) "Lvh+9z&e{$jsxAB*l=k6___"
      SatisfyingSetLink (stv 1.0 0.0)
        VariableNode (stv 1.0 0.0) "$var"
        AndLink (stv 1.0 0.0)
          EvaluationLink (stv 0.75 0.9)
            PredicateNode (stv 1.0 0.0) "jipci_sumti1"
            ListLink (stv 1.0 0.0)
              PredicateNode (stv 1.0 0.0) "oaxoLn7sNPqOqs{!H'Vx___jipci"
              VariableNode (stv 1.0 0.0) "$var"
    InheritanceLink (stv 1.0 0.9)
      ConceptNode (stv 1.0 0.0) "=vfy`&y-EDDF>!_wt,fv___ke'a"
      ConceptNode (stv 1.0 0.0) "Lvh+9z&e{$jsxAB*l=k6___"
    ImplicationLink (stv 1.0 0.9)
      PredicateNode (stv 1.0 0.0) "\<%uEWCjN3Rhs.0okdHH___cmalu"
      PredicateNode (stv 1.0 0.0) "cmalu"
    InheritanceLink (stv 1.0 0.9)
      ConceptNode (stv 1.0 0.0) "7},+asi)LBD9lt|T_i}L___Lvh+9z&e{$jsxAB*l=k6___"
      ConceptNode (stv 1.0 0.0) "Lvh+9z&e{$jsxAB*l=k6___"



Who did you ask?	
ma se preti fi do,

           +------B*w-----+
           |    +---I*d---+
    +--Wq--+    +-SIp+    |
    |      |    |    |    |
LEFT-WALL who did.v you ask.v

  
PutLink (stv 1.0 0.0)
    ListLink (stv 1.0 0.0)
      AndLink (stv 1.0 0.0)
        EvaluationLink (stv 0.75 0.9)
          PredicateNode (stv 1.0 0.0) "preti_sumti3"
          ListLink (stv 1.0 0.0)
            PredicateNode (stv 1.0 0.0) "YCw2Og`,>qA"GjrY]MH.___preti"
            ConceptNode (stv 1.0 0.0) "-`N57F!Z@Bz6rpsza!iU___do"
        EvaluationLink (stv 0.75 0.9)
          PredicateNode (stv 1.0 0.0) "preti_sumti2"
          ListLink (stv 1.0 0.0)
            PredicateNode (stv 1.0 0.0) "YCw2Og`,>qA"GjrY]MH.___preti"
            VariableNode (stv 1.0 0.0) "dM#/j0&7`;j`8,yD'ypu___ma"
      InheritanceLink (stv 1.0 0.9)
        VariableNode (stv 1.0 0.0) "dM#/j0&7`;j`8,yD'ypu___ma"
        VariableNode (stv 1.0 0.0) "ma"
      ImplicationLink (stv 1.0 0.9)
        PredicateNode (stv 1.0 0.0) "YCw2Og`,>qA"GjrY]MH.___preti"
        PredicateNode (stv 1.0 0.0) "preti"
      InheritanceLink (stv 1.0 0.9)
        ConceptNode (stv 1.0 0.0) "-`N57F!Z@Bz6rpsza!iU___do"
        ConceptNode (stv 1.0 0.0) "do"
    GetLink (stv 1.0 0.0)
      ListLink (stv 1.0 0.0)
        AndLink (stv 1.0 0.0)
          EvaluationLink (stv 0.75 0.9)
            PredicateNode (stv 1.0 0.0) "preti_sumti3"
            ListLink (stv 1.0 0.0)
              PredicateNode (stv 1.0 0.0) "YCw2Og`,>qA"GjrY]MH.___preti"
              ConceptNode (stv 1.0 0.0) "-`N57F!Z@Bz6rpsza!iU___do"
          EvaluationLink (stv 0.75 0.9)
            PredicateNode (stv 1.0 0.0) "preti_sumti2"
            ListLink (stv 1.0 0.0)
              PredicateNode (stv 1.0 0.0) "YCw2Og`,>qA"GjrY]MH.___preti"
              VariableNode (stv 1.0 0.0) "dM#/j0&7`;j`8,yD'ypu___ma"
        InheritanceLink (stv 1.0 0.9)
          VariableNode (stv 1.0 0.0) "dM#/j0&7`;j`8,yD'ypu___ma"
          VariableNode (stv 1.0 0.0) "ma"
        ImplicationLink (stv 1.0 0.9)
          PredicateNode (stv 1.0 0.0) "YCw2Og`,>qA"GjrY]MH.___preti"
          PredicateNode (stv 1.0 0.0) "preti"
        InheritanceLink (stv 1.0 0.9)
          ConceptNode (stv 1.0 0.0) "-`N57F!Z@Bz6rpsza!iU___do"
          ConceptNode (stv 1.0 0.0) "do"

Representation Issues Highlighted by Lojban-to-Atomese Mapping

This section of this wiki page may get expanded as we refine further Lojban-to-Atomese mapping details...

Commuting Logical Operators Through Predicate Evaluations

Starting off without Lojban … on a purely logical-syntax level it may be useful to be able to say

“Bob went to the beach and then the restaurant and then the solarium and then the earwig removal shop and then the public restroom and then the planetarium"

“Jim went to the beach and then the restaurant and then the solarium and then the earwig removal shop and then the water fountain and then the planetarium"

THEREFORE Bob and Jim were possibly traveling together

rather than having to split the premises up into separate clauses as in

“Bob went to the beach, and then Bob went to the restaurant, and then Bob went to the solarium, … etc."

My point is that doing this inference when the premises each use “went” only once will be a shorter inference trail than doing it when the premises each involve multiple “went” clauses.

For a smaller example, consider “You and then I go there”. (as an alternate way of saying “you go there and then I go there.” ) To represent this logically in a way that preserves the grouping in the sentence, we would want to say

EvaluationLink
    PredicateNode “go" 
    List
       SequentialAND
           ConceptNode “I"  
           ConceptNode “you"
       ConceptNode “there"

But there is also a problem here: There is no obvious mathematical reason why we should be able to commute the SequentialAND out of the EvaluationLink to make this equivalent to

SequentialAND
   EvaluationLink
       PredicateNode “go" 
       List
            ConceptNode “I"  
            ConceptNode “there"
   EvaluationLink
       PredicateNode “go" 
       List
            ConceptNode “you"  
           ConceptNode “there"

(The same issue exists with the more standardly English “You and I go there”, in which AND takes the place of SequentialAND)

The subtlety here is that in Lojban, it is assumed that we can commute a conjunction or other logical operation out of a predicate, as a matter of language syntax. And for “go” and most natural language predicates this seems unproblematic. However, for some mathematical predicates it would be a logical problem.

For instance, suppose

F( SeqAND(A,B) )  = A,  

meaning that F( SeqAND(A,B) ) is true to the extent A is true…

In this case, F(SeqAND(A,B)) is not equal to SeqAND( (F(A), F(B) ) = SeqAND(A,B) -- so you can’t commute SeqAND out of F

However, most natural language (or Lojban) predicates are not like F in this way

Probably the simplest way to handle this situation is to mark natural language predicates with e.g.

ImplicationLink
	PredicateNode “go”
	PredicateNode “Commonsense Predicate”

Being a “Commonsense Predicate” will imply a variety of properties, including

  • Being one of those darn Soggy Predicates
  • The ability to commute logical and temporal connectives out of the predicate

i.e.

ImplicationLink
	PredicateNode “Commonsense Predicate”
	PredicateNode “Soggy Predicate”

ImplicationLink
	PredicateNode “Commonsense Predicate”
	PredicateNode “Logical Operator Commutative Predicate”

There may be some odd cases of predicates that are Soggy but not logical-operator commutative, or vice versa.

The composition or Boolean combination of Commonsense Predicates will always yield a Commonsense Predicate.

Qualified Logical Operators

As a small additional note, observe that SequentialANDLInk can be grounded as

AndLink
   AfterLink
   AndLink

This is useful to observe because in Lojban interpretation we will run into many similar “qualified logical operator” constructs such as

AndLink
    EvaluationLink
       ShortDistanceToTheLeft
    AndLink


Specific Instances

One shortcoming of our current habitual representations in OpenCog is a failure to systematically distinguish specific instances from general concepts.

It seems to me that we want to introduce a notion of “Specific Instance”, i.e.

  • ConceptNode “SpecificInstance”
  • PredicateNode “SpecificInstance”

The PredicateNode version is the one we have an acute need for at the moment.

The essential criterion defining a specific instance, is that each of its “argument slots” can be filled with at most one entity. (Certainly there is subtlety here, in that an argument slot can be filled with a disjunction, conjunction or other combination of entities. Nevertheless, the distinction is heuristically very valuable in the scope of human cognition.)

To formalize this criterion we also need to formalize the notion of an “argument slot”, e.g.

ImplicationLink
	PredicateNode “sumti_1”
	PredicateNode “ArgumentSlot”

ImplicationLink
	PredicateNode “arg_3”
	PredicateNode “ArgumentSlot”

We would then have general a rule of the form

LambdaLink
    VariableNode $S, $E, $X, $Y
    ImplicationLink
        AndLink
	    ImplicationLink
		$S
		PredicateNode “ArgumentSlot”
	    ImplicationLink
		$E
		PredicateNode “SpecificInstance”
	    EvaluationLink
		$S
		ListLink
		    $E
		    $X
	    EvaluationLink
		$S
		ListLink
		    $E
		    $Y
	EquivalenceLink
	    $X
	    $Y

which basically says what it means to be a specific instance.

So to represent

"la dali nelci nu mi sanga" 
"Dali likes the event of me singing"
(meaning, more idiomatically, “Dali likes it when I sing”)

we could say

EvaluationLink
    PredicateNode “nelci”
    ListLink
        ConceptNode “dali”
        SatisfyingSet
            VariableNode $X
            AND
                Implication
                    $X
                    ConceptNode “nu”
                ExistsLink
                    $Y
                    AND
                        Implication $X $Y
                        Implication $Y “sanga”
                        Implication $Y “Specific Instance”
                        EvaluationLink
                            PredicateNode “sumti_1”
                            ListLink
                                $Y
                                ConceptNode “mi"

Relatedly, consider

“I know that fish can swim”

Just as “nu” means “event” in Lojban, “du’u X “ is supposed to refer to “ the cognitive content X”. So a reasonable representation would be

EvaluationLink
    PredicateNode “know”
    EvaluationLink 
        PredicateNode “du’u”
        EvaluationLink
          PredicateNode “swim”
          ConceptNode “fish"

However, this seems unnecessarily verbose, and it seems OK to just way

EvaluationLink
   PredicateNode “know”
   EvaluationLink
          PredicateNode “swim”
          ConceptNode “fish"

i.e. to leave the “du’u” (“this is cognitive content”) relation implicit.


Unfortunately, because we allow disjunctions, conjunctions and so on we run into a bit of an issue. As explained in the previous paragraph in Lojban we can always commute out these connectives. Which leads to a situation where 2 different arguments are applied to the same specific instance which is invalid.

EvaluationLink
    PredicateNode “sumti_1" 
    List
       PredicateNode "go_123"
       AndLink
           ConceptNode “I"  
           ConceptNode “you"

=>

AndLink
   EvaluationLink
       PredicateNode “sumti_1"
       List
            PredicateNode "go_123"
            ConceptNode “I"
   EvaluationLink
       PredicateNode “sumti_1"
       List
            PredicateNode "go_123"
            ConceptNode “you"

Now you have 3 different things in the argument slot sumti_1 namely "I", "You" and "I & You".