LG in Java for language production

52 views
Skip to first unread message

Anton Kolonin @ Gmail

unread,
Jun 6, 2020, 12:24:21 AM6/6/20
to link-grammar, rvi...@gmail.com
Hi Linas and Amir!

We are going to try using LG formalism for language production in Java
project:
https://github.com/aigents/aigents-java/issues/22

Note that we are not going use LG to "parse" NL texts, we are going to
use it to "generate" NL texts (the opposite task but the same formalism
and the same dictionaries are to be used).

Can one of you answer some questions?

1. What is the current location of the best-of-breed LG dictionaries
(for English and Russian in particular)?
2. What is the location of most reliable code branch to read these
dictionaries?
3. If there are any known Java projects of pieces that can be re-used
under OSS license?
4. Can we use this tutorial
(https://www.abisource.com/projects/link-grammar/api/index.html) to make
a Java implementation of the Link Grammar parser?
5. We rewrote the C++ code from the tutorial above in Java - but any
recommendation on what the Java substitute for #include
"link-includes.h" is? We know it has to do with the Java bindings in the
opencog repo but we are not totally sure how to use that.

We will appreciate your answers :-)

-Anton

Linas Vepstas

unread,
Jun 6, 2020, 12:56:45 PM6/6/20
to link-grammar, rvi...@gmail.com
Hi Anton,

On Fri, Jun 5, 2020 at 11:24 PM Anton Kolonin @ Gmail <akol...@gmail.com> wrote:
Hi Linas and Amir!

We are going to try using LG formalism for language production in Java
project:
https://github.com/aigents/aigents-java/issues/22

So, NL Generation is the goal of  https://github.com/opencog/generate -- it already generates small sentences from simple vocabularies just fine. I have not attempted anything complex, maybe it will work and maybe it won't. It's alpha version 0.1.0 so many of the things I can think of that I want to have are absent.

It's not Java.

I think it would be awesome if you could work on that project, but I imagine that you would not want to, that you prefer green-field solutions written by your own people over which you have total control.


Note that we are not going use LG to "parse" NL texts, we are going to
use it to "generate" NL texts (the opposite task but the same formalism
and the same dictionaries are to be used).

Can one of you answer some questions?

1. What is the current location of the best-of-breed LG dictionaries
(for English and Russian in particular)?

Comes with LG

2. What is the location of most reliable code branch to read these
dictionaries?

Comes with LG

3. If there are any known Java projects of pieces that can be re-used
under OSS license?

Comes with LG

4. Can we use this tutorial
(https://www.abisource.com/projects/link-grammar/api/index.html) to make
a Java implementation of the Link Grammar parser?

Yes, that is the official LG documentation.

5. We rewrote the C++ code from the tutorial above in Java - but any
recommendation on what the Java substitute for #include
"link-includes.h" is? We know it has to do with the Java bindings in the
opencog repo but we are not totally sure how to use that.

LG already comes with java bindings that work in both local and remote mode, and also comes with two different java servers. One java server generates json and the other generates atomese.

Depending on what API you want, include either bindings/java/org/linkgrammar/LinkGrammar.java or bindings/java/org/linkgrammar/LGRemoteClient.java  the README file explains how to use these

-- linas

--
cassette tapes - analog TV - film cameras - you

Vignav Ramesh

unread,
Jun 6, 2020, 11:46:44 PM6/6/20
to linasv...@gmail.com, link-grammar
Hi Linas & Amir,

This is Vignav. I am working with Anton on the Java-based NL language production for Aigents.

I am taking a look at the LinkGrammar.java file in bindings/java/org/linkgrammar but there does not seem to be much clear documentation on how to use the LinkGrammar class and its methods after downloading the file and importing it. Since it has native methods, I am assuming it uses JNI and there is a processing of integrating the C and Java code. Is there any documentation on this that I can follow to sort this all out and get the Java version working?

Thanks,
Vignav

Linas Vepstas

unread,
Jun 7, 2020, 12:05:04 AM6/7/20
to Vignav Ramesh, link-grammar
Hi Vignav,

Mailing lists work better if you actually subscribe to them. As it is, you will not receive any replies unless people explicitly CC you.


On Sat, Jun 6, 2020 at 10:45 PM Vignav Ramesh <rvi...@gmail.com> wrote:
Hi Linas & Amir,

This is Vignav. I am working with Anton on the Java-based NL language production for Aigents.

I am taking a look at the LinkGrammar.java file in bindings/java/org/linkgrammar but there does not seem to be much clear documentation on how to use the LinkGrammar class and its methods after downloading the file and importing it. Since it has native methods, I am assuming it uses JNI and there is a processing of integrating the C and Java code. Is there any documentation on this that I can follow to sort this all out and get the Java version working?

If you look at the java-jni directory, you will find the java jni bindings.  You should spend some quality time reading the contents of java-jni/jni-client.h and java-jni/jni-client.c so that you can clearly understand what the jni bindings actually are.  After all, this is open source, and part of what makes it open is that you can actually examine and explore it, instead of depending on a corporation to feed you one spoonful at a time.

The jni bindings have corresponding java files. if you say `find bindings/java/org` you will see:

org
org/linkgrammar
org/linkgrammar/Link.java
org/linkgrammar/LGConfig.java
org/linkgrammar/LGRemoteClient.java
org/linkgrammar/ParseResult.java
org/linkgrammar/LinkGrammar.java
org/linkgrammar/JSONUtils.java
org/linkgrammar/LGService.java
org/linkgrammar/Linkage.java
org/linkgrammar/JSONReader.java

Hopefully it is painfully obvious what each file does, given its name: a configuration file, two json processing files, a file for working with parses, a file for working with linkages, a server file, a client file, and an API file.

All of the documentation is in javadoc format. All you have to do is to run your favorite javadoc tool on it and you will have full and complete documentation for everything. Please keep in mind that many different kinds of documentation systems are compatible with javadoc, and so just about any system will produce documentation for you.

Again, I would like to remind you that there already is an existing project for language generation here: https://github.com/opencog/generate that is link-grammar compatible, and it already generates simple sentences from simple dictionaries.  I would rather see work proceed on that, rather than all-new green-field development. There are major compatibility problems with coding in java. It's not a good language choice for these kinds of projects.  -- speaking from experience. 

-- Linas

Anton Kolonin @ Gmail

unread,
Jun 7, 2020, 4:48:34 AM6/7/20
to link-g...@googlegroups.com, Linas Vepstas, Vignav Ramesh

Hi Linas, thank you for the guidance.

>Again, I would like to remind you that there already is an existing project for language generation here: https://github.com/opencog/generate that is link-grammar compatible, and it already generates simple sentences from simple dictionaries. 

Cool, worth looking into that as a reference!

>I would rather see work proceed on that, rather than all-new green-field development. There are major compatibility problems with coding in java. It's not a good language choice for these kinds of projects.  -- speaking from experience. 

In given case, we are looking for "Pure Java" solution so it can run under the Aigents framework on smartphones and JVM-enabled coffee machines ;-) 

We also need the grammar to be coupled with ontology which is already present in the in-memory Java graph DB.

Thanks,

-Anton

--
You received this message because you are subscribed to the Google Groups "link-grammar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to link-grammar...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/link-grammar/CAHrUA37h_f_9dLK2toQxyqXjEmDBcfst%2Bi-WqvpFUnCpD9d93w%40mail.gmail.com.
-- 
-Anton Kolonin
skype: akolonin
cell: +79139250058
akol...@aigents.com
https://aigents.com
https://www.youtube.com/aigents
https://www.facebook.com/aigents
https://wt.social/wt/aigents
https://medium.com/@aigents
https://steemit.com/@aigents
https://reddit.com/r/aigents
https://twitter.com/aigents
https://golos.in/@aigents
https://vk.com/aigents
https://aigents.com/en/slack.html
https://www.messenger.com/t/aigents
https://web.telegram.org/#/im?p=@AigentsBot

rvi...@gmail.com

unread,
Jun 25, 2020, 1:57:00 AM6/25/20
to link-grammar
Hi Linas,

Thanks for your feedback. Quick question - are there any files or links in particular part of opencog/generate that would be most helpful as a reference/general code structure when building the language production engine in Java?

Thanks,
Vignav
To unsubscribe from this group and stop receiving emails from it, send an email to link-g...@googlegroups.com.

Linas Vepstas

unread,
Jun 25, 2020, 3:14:30 AM6/25/20
to link-grammar
Hi Vignav,

On Thu, Jun 25, 2020 at 12:57 AM <rvi...@gmail.com> wrote:
Hi Linas,

Thanks for your feedback. Quick question - are there any files or links in particular part of opencog/generate that would be most helpful as a reference/general code structure when building the language production engine in Java?

I don't know how to answer that question, other than to say "all of it" which is not what you want to hear....

The README explains in detail what the code does: it walks over a collection of "jigsaw puzzle pieces" and attempts to join them together -- it does this in a breadth-first search -- that is adding one piece at a time, always trying to attach to one of the existing unconnected connectors. This sounds easy, but is remarkably hard -- I had to create something I call an "odometer", to track the state of what has been tried and what has not been tried. It took me a while, to get it to work right ... there were some tricky bits.. but now it works.

So .. basically -- I'm saying -- gee, well, here is this complicated code .. do you really want to port that to java? 

There is also some interesting interplay with something called "the pattern engine" inside of the atomspace. Let me give a very short  explanation.  So .. say you have a function f(x) and you want to plug a value "b" into it, to get "f(b)". What you are "really doing" is connecting "f(x) <==> b" where f(x) is one "jigsaw puzzle piece connector" (say, the hole) and "b" is the jigsaw tab that plugs in. Painfully obvious, right?

So, the pattern engine is currently a database search engine that has a bunch of "holes" aka "variables x,y,z..." and it searches for all "patterns" which can match those "holes" (and so the name "pattern matcher"). It vaguely resembles a "perl regex" and an "SQL query" and a "prolog inference step" all mashed up into one, and generalized for graph search.

I have a plan to generalize the pattern engine "real soon now" to generalize the "variables x,y,z" and "things that match them" into generalized "jigsaw puzzle piece connectors". This is a natural generalization, because the pattern engine already applies type-checking (so, for example, you can only plug an int into an int variable, a float into a float variable, an instance of "class foo" into something that takes "class foo" as an argument.... think of function signatures as you already know them in java.)  So the pattern engine already knows how to plug "instances of things" into "fill-in-the-blanks" search queries, with type-checking (with a full type-theoretical type hierarchy and type constructors) ... I want to generalize that into arbitrary user-defined "connectors" that can "connect together" instead of "instances of objects" and "things that accept instances of objects".

I want to do the above in parallel with the graph generator work, so that the two systems are inter-compatible.  I think its neat.

Instead of thinking "jigsaw puzzle-pieces" you can think of biology analogs: bits of proteins that fit into other proteins. Immunoglobulin parts that can mate-with, stick to other other parts.  RNA that sticks to DNA ... So, in a certain sense, I feel like I am re-inventing biochemistry: different "types" have different "affinities" for forming "chemical bonds".

- Linas.

p.s. I'm cc'ing the opencog mailing list as a way of saying "here's another way of explaining that sheaf thing I keep talking about".

p.p.s. to avoid confusion between link-grammar links and atomsace links, I plan to rename the link-grammar links to "bonds".  All the old language-learning code, and the generator code still calls them "links" but this is confusing.  Of course, I cannot rename "link grammar" to "bond grammar", so that stays unchanged. But calling them "bonds" in analogy to "chemical bonds" gets across a better idea of the concept of attachment.

I'm not the first: Eugene A Nida: "The Molecular Level of Lexical Semantics" https://www.academia.edu/36534355/The_Molecular_Level_of_Lexical_Semantics_by_EA_Nida
International Journal of Lexicography, Volume 10, Issue 4, December 1997, Pages 265–274, https://doi.org/10.1093/ijl/10.4.265

To unsubscribe from this group and stop receiving emails from it, send an email to link-grammar...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/link-grammar/570da168-fce7-4630-8347-1518171e07dbo%40googlegroups.com.

Linas Vepstas

unread,
Jun 25, 2020, 3:18:43 AM6/25/20
to link-grammar, opencog
Meant to CC the opencog mailing list in teh reply.

rvi...@gmail.com

unread,
Jun 30, 2020, 2:19:51 AM6/30/20
to link-grammar
Hi Linas,

Thanks for the feedback. The description helped clarify a lot for me.

Quick question: would this folder alone - https://github.com/opencog/generate/tree/master/opencog/scm - be all I need if I decide to pursue the route of porting your Scheme generator code to Java? Or is any code in the rest of the repository needed for this to work?

Thanks,
Vignav

Linas Vepstas

unread,
Jun 30, 2020, 2:59:58 AM6/30/20
to link-grammar
I could answer that question for you, but it would be beneficial for you to learn how to look at each and every file in a git repo, and figure out which ones are the important ones. It really should not take more than about 5-10 minutes to figure this out.

--linas


Thanks,
Vignav

--
You received this message because you are subscribed to the Google Groups "link-grammar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to link-grammar...@googlegroups.com.


--
Verbogeny is one of the pleasurettes of a creatific thinkerizer.
        --Peter da Silva

Anton Kolonin @ Gmail

unread,
Jun 30, 2020, 3:56:14 AM6/30/20
to link-g...@googlegroups.com, rvi...@gmail.com

Hi Linas,

I have another question - if we are using LG notation properly on the earlier results from last year.

For reference:

http://langlearn.singularitynet.io/data/clustering_2018/POC-English-2018-12-31/POC-English-Amb_LG-English_dILEd_gen-rules/dict_30C_2018-12-31_0006.4.0.dict

http://langlearn.singularitynet.io/data/poc-english/poc_english.txt

Consider the sentence : A mom is a human.

Looking at "is a human".

Rules:
% AB
"child" "food" "human" "parent" "tool":
(AHAB- & AJAB-) or (AHAB- & ARAB-) or (AHAB- & BCAB- & ABAL+);


% AH
"a":
(AHAB+) or (AHAC+) or (AHAD+);


% AR
"is":
(ACAR- & ARAB+) or (ACAR- & ARAB+ & ARAV+) or (ACAR- & ARAX+) or (ADAR- & ARAB+) or (AEAR- & ARAB+) or (AEAR- & ARAB+ & ARAV+);


The connecting disjuncts seem to be:

% AB
"child" "food" "human" "parent" "tool":
(AHAB- & ARAB-);


% AH
"a":
(AHAB+);


% AR
"is":
(ACAR- & ARAB+) or (ADAR- & ARAB+) or (AEAR- & ARAB+);

The question - if the (AHAB- & ARAB-) is a right disjunct according to LG formalism or we should have (ARAB- & AHAB-) here because "is" (AR) comes before "a" (AB) when going left to right?

Can you point to the specific place in LG documentation where this can be clarified?

Thanks,
-Anton 




Linas Vepstas

unread,
Jun 30, 2020, 12:55:37 PM6/30/20
to link-grammar, Vignav Ramesh
Hi Anton,

This is a great question, as it is indeed a recurring source of confusion. The easiest way to remember the correct ordering is the "no link crossing" mnemonic. So, if you draw lines or arcs between the connectors, (and draw them so that they are always above) then

(AHAB- & ARAB-) is correct -- the AHAB- to the nearby "a" and the ARAB- to the more distant "is".  The other ordering causes the links to cross.  

Yes, the other ordering is the "backward-word-ordering", but only to the left; its normal word-ordering to the right. So, yes, that is annoying and confusing, because word-order is a natural way to think about it.

Abstractly speaking, it doesn't really matter which convention you choose; however, the current file-format uses the "no link-crossing" convention.

Documentation -- see section 1.2.1 Connector ordering.
https://www.abisource.com/projects/link-grammar/dict/introduction.html

Other sections there say interesting things too.

--linas

--
You received this message because you are subscribed to the Google Groups "link-grammar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to link-grammar...@googlegroups.com.

Vignav Ramesh

unread,
Jul 11, 2020, 1:50:34 AM7/11/20
to link-grammar
Hi all,

Quick question on the sentence "Mom is a human". When I test out the sentence on http://langlearn.singularitynet.io/check.html, I see that "Mom" and "is" are connected by an Ss link. However, when I print out the rule for "mom" with all macros expanded, I see:

(({NM+} & ({G-} & {[MG+]} & (({DG- or [GN-] or [@A- & @AN-] or [{@A-} & {D-}] or ({@A-} & Jd- & Dmc-)} & (({@M+} & {R+ & Bs+ & {[[@M+]]}} & {@MXs+} & (JG- or Js- or Os- or [{[Bsj+]} & Xd- & (Xc+ or [[[[()]]]]) & MX-]  or [[[[()]]]])) or ({@M+} & dSJls+) or ({[@M+]} & dSJrs-) or YS+ )) or ({[[@MX+]]} & [AN+]) or G+))) or (MXs+ & (Js- or Os- or [{[Bsj+]} & Xd- & (Xc+ or [[[[()]]]]) & MX-]  or [[[[()]]]] or ({@M+} & dSJls+) or ({[@M+]} & dSJrs-))) or ({@A- or G-} & {D-} & Wa- & {NM+})  or [{[[Wa-]]} & (({OH-} & Wc- & {MG+} & (Xc+ or [()]) & (Qd+ or Wq+)) or  ({Xd-} & {OH-} & (Xc+ or [[()]]) & [dCOa+])) or ({OH-} & Xc+ & S**i+)])


As you can see here, there is no Ss link. I discussed this with Anton and he also had some trouble figuring out where the Ss link from the word "mom" comes from. Any ideas on what we are missing here?


Thanks,

Vignav

To unsubscribe from this group and stop receiving emails from it, send an email to link-g...@googlegroups.com.

Anton Kolonin @ Gmail

unread,
Jul 11, 2020, 2:12:49 AM7/11/20
to link-g...@googlegroups.com, Vignav Ramesh

Linas, Amir, here is the parse that we have for the sentence - using standard English setup out of the LG box:

I have used my eyeballs to track the macros-es from "mom.f" to all link definitions including Ss+ & Wd- together or apart but failed to find the connected chain of macro expansions:

https://github.com/opencog/link-grammar/tree/master/data/en

Thank you!

-Anton 

To unsubscribe from this group and stop receiving emails from it, send an email to link-grammar...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/link-grammar/6ab1d289-c69d-4d48-847b-0ddce7b1295ao%40googlegroups.com.

Amir Plivatsky

unread,
Jul 11, 2020, 10:57:08 PM7/11/20
to link-grammar
Hello Vignav and Anton,

Apparently you use an old LG version (prior to version 5.4.4), since the parse is now:
    +----->WV---->+---Ost--+
    +-->Wd--+-Ss*s+  +Ds**c+
    |       |     |  |     |
LEFT-WALL mom.f is.v a  human.n

(Ss*s instead of Ss.)
My answer is according to the current version (5.8.0) but its first part applies to older versions too.

You can see the macro-expanded expression of mom.f using the link-parser ! command, as follows:
linkparser> !!mom.f
Token "mom.f" matches:
    mom.f                        21631  disjuncts

Token "mom.f" expressions:
    mom.f                     (({NM+} & ({G-} & {[MG+]} & (({DG- or [GN-]0.500 or [@A- & @AN-]0.500 or [{@A-} & {D-}] or ({@A-} & Jd- & Dmc-)} & (((({@M+} & {R+ & Bs+ & {[[@M+]]}} & {@MXs+})) & (JG- or (((Ss*s+ & ({({@hCOd-} & (C- or ((dRJrc- or dRJlc+)))) or ({@hCO-} & Wd-) or [Rn-]})) or SIs- or (Js- & ({Jk-} or {Mf+})) or Os- or ([{[Bsj+]} & Xd- & (Xc+ or ([[[[()]]]])) & MX-]0.100) or ([[[[()]]]]))))) or ((({@M+} & dSJls+) or ({[@M+]} & dSJrs-))) or YS+)) or ({[[@MX+]]} & [AN+]) or G+))) or (MXs+ & ((((Ss*s+ & ({({@hCOd-} & (C- or ((dRJrc- or dRJlc+)))) or ({@hCO-} & Wd-) or [Rn-]})) or SIs- or (Js- & ({Jk-} or {Mf+})) or Os- or ([{[Bsj+]} & Xd- & (Xc+ or ([[[[()]]]])) & MX-]0.100) or ([[[[()]]]]))) or ((({@M+} & dSJls+) or ({[@M+]} & dSJrs-))))) or ({@A- or G-} & {D-} & Wa- & {NM+}) or [(({[[Wa-]]} & (({OH-} & Wc- & {MG+} & (Xc+ or [()]1.200) & (Qd+ or Wq+)) or ({Xd-} & {OH-} & (Xc+ or [[()]]) & [dCOa+])))) or (({OH-} & Xc+ & S**i+))]0.200)

Note the subexpression (Ss*s+ & ({({@hCOd-} & (C- or ((dRJrc- or dRJlc+)))) or ({@hCO-} & Wd-) or [Rn-]})) .
(In the version you use it starts with Ss+ .)

Also note the !links and !disjuncts commands of link-parser (python bindings Clinbkgrammar.linkage_print_links_and_domains() and Clinbkgrammar.linkage_print_disjuncts()).
$ link-parser -links -disjuncts
...
linkparser> Mom is a human
Found 16 linkages (16 had no P.P. violations)
Linkage 1, cost vector = (UNUSED=0 DIS= 0.00 LEN=6)

    +----->WV---->+---Ost--+
    +-->Wd--+-Ss*s+  +Ds**c+
    |       |     |  |     |
LEFT-WALL mom.f is.v a  human.n

       LEFT-WALL      RW            ----RW-----  RW              RIGHT-WALL
 (m)   LEFT-WALL      hWV           >---WV---->  dWV             is.v
 (m)   LEFT-WALL      hWd           >---Wd-----  Wd              mom.f
 (m)   mom.f          Ss*s          ----Ss*s---  Ss              is.v
 (m)   is.v           O*t           ----Ost----  Os              human.n
 (m)   a              Ds**c         ----Ds**c--  Ds**c           human.n

            LEFT-WALL     0.000  hWd+ hWV+ RW+
                mom.f     0.000  Wd- Ss*s+
                 is.v     0.000  Ss- dWV- O*t+
                    a     0.000  Ds**c+
              human.n     0.000  Ds**c- Os-
           RIGHT-WALL     0.000  RW-


On version 5.8.0 the ! command is much more sophisticated (see !help ! in link-parser - the help text is very long so you may need to scroll back to the start of it) and allows tracking the macro expansions.
This looks as follows (note the expansion of the <noun-main-s> macro):
linkparser> !!mom.f/m
Token "mom.f" matches:
    mom.f                        21631  disjuncts


Token "mom.f" expressions:
    mom.f                     <entity-singular>: (({NM+} & ({G-} & {[MG+]} & (({DG- or [GN-]0.500 or [@A- & @AN-]0.500 or [{@A-} & {D-}] or ({@A-} & Jd- & Dmc-)} & ((
    <noun-rel-s>: (({@M+} & {R+ & Bs+ & {[[@M+]]}} & {@MXs+}))
       & (JG- or
    <noun-main-s>: (((Ss*s+ &
        <CLAUSE>: ({({@hCOd-} & (C- or ((dRJrc- or dRJlc+)))) or ({@hCO-} & Wd-) or [Rn-]})
          ) or SIs- or (Js- & ({Jk-} or {Mf+})) or Os- or
        <post-nominal-s>: ([{[Bsj+]} & Xd- & (Xc+ or
            <costly-null>: ([[[[()]]]])
              ) & MX-]0.100)
           or
        <costly-null>: ([[[[()]]]])
          ))
      )) or
    <noun-and-s>: ((({@M+} & dSJls+) or ({[@M+]} & dSJrs-)))
       or YS+)) or ({[[@MX+]]} & [AN+]) or G+))) or (MXs+ & (
    <noun-main-s>: (((Ss*s+ &
        <CLAUSE>: ({({@hCOd-} & (C- or ((dRJrc- or dRJlc+)))) or ({@hCO-} & Wd-) or [Rn-]})
          ) or SIs- or (Js- & ({Jk-} or {Mf+})) or Os- or
        <post-nominal-s>: ([{[Bsj+]} & Xd- & (Xc+ or
            <costly-null>: ([[[[()]]]])
              ) & MX-]0.100)
           or
        <costly-null>: ([[[[()]]]])
          ))
       or
    <noun-and-s>: ((({@M+} & dSJls+) or ({[@M+]} & dSJrs-)))
      )) or ({@A- or G-} & {D-} & Wa- & {NM+}) or [
    <directive-opener>: (({[[Wa-]]} & (({OH-} & Wc- & {MG+} & (Xc+ or [()]1.200) & (Qd+ or Wq+)) or ({Xd-} & {OH-} & (Xc+ or [[()]]) & [dCOa+]))))
       or
    <directive-subject>: (({OH-} & Xc+ & S**i+))
      ]0.200)

Amir



To unsubscribe from this group and stop receiving emails from it, send an email to link-grammar+unsubscribe@googlegroups.com.

Vignav Ramesh

unread,
Jul 12, 2020, 3:34:15 AM7/12/20
to link-grammar
Thanks so much Amir! That cleared up a lot - I found the error and fixed it.

Now I am getting another problem that I wanted to run by you. When I print the full macro-expanded rule for the word "is.v" as per our Java code, I get this: 

(({@E-} & (Ss- or SFs- or SFu- or (RS- & Bs-)) & ({@EBm+} & (( ([{CV-} & B**t-] or (B**t- & ((dWV- or dCV- or dIV-) & {VC+}) or [()]) or [K+] or (((dWV- or dCV- or dIV-) & {VC+}) or [()] & BI+) or (((dWV- or dCV- or dIV-) & {VC+}) or [()] & OF+) or (Osi+ & R+ & Bs+ & ((dWV- or dCV- or dIV-) & {VC+}) or [()]) or (Opi+ & R+ & Bp+ & ((dWV- or dCV- or dIV-) & {VC+}) or [()]) or ([()]0 & ((dWV- or dCV- or dIV-) & {VC+}) or [()])) & {@MV+} & {VC+}) or (((dWV- or dCV- or dIV-) & {VC+}) or [()] & Pp+ & {THi+ or @MV+}) or THb+ or TO+ & IV+ or (PFb- & ((dWV- or dCV- or dIV-) & {VC+}) or [()] & {Pa+}) or ({MV+} & [Pa+]0 & {((dWV- or dCV- or dIV-) & {VC+}) or [()]}))) or ({N+} & ((AF- & ((dWV- or dCV- or dIV-) & {VC+}) or [()]) or ({MV+} & [Pv+]) or [I*v+]))  or (({N+} or {Pp+}) & Pg*b+ & ((dWV- or dCV- or dIV-) & {VC+}) or [()]) or ({@EBm+} & (O*t+ or O*m+) & {@MV+} & {THb+} & ((dWV- or dCV- or dIV-) & {VC+}) or [()]))) or (({@E-} & dVJrs- & ({@EBm+} & ((([B**t-] or [K+] or BI+ or OF+ or PFb- or (Osi+ & R+ & Bs+) or (Opi+ & R+ & Bp+) or [[()]]) & {@MV+} & {VC+}) or (Pp+ & {THi+ or @MV+}) or THb+ or TO+ & IV+ or Pa+)) or ({N+} & (AF- or [Pv+] or I*v+)) or  (({N+} or {Pp+}) & Pg*b+) or {@EBm+} & (O*t+ or O*m+) & {@MV+} & {THb+})) or ((({@EBm+} & ((([B**t-] or [K+] or BI+ or OF+ or PFb- or (Osi+ & R+ & Bs+) or (Opi+ & R+ & Bp+) or [[()]]) & {@MV+} & {VC+}) or (Pp+ & {THi+ or @MV+}) or THb+ or TO+ & IV+ or Pa+)) or ({N+} & (AF- or [Pv+] or I*v+)) or  (({N+} or {Pp+}) & Pg*b+) or {@EBm+} & (O*t+ or O*m+) & {@MV+} & {THb+} & {@E-} & dVJls+)) or (({Rw- or ({{Xd-} & Iq-} & (Qd- or Qp- or ((Qw- or Qe-) & ((dWV- or dCV- or dIV-) & {VC+}) or [()]))) or [()]} & (SIs*x+ or SIs*b+ or SFIs+) & {({@EBm+} & (( ([{CV-} & B**t-] or (B**t- & ((dWV- or dCV- or dIV-) & {VC+}) or [()]) or [K+] or (((dWV- or dCV- or dIV-) & {VC+}) or [()] & BI+) or (((dWV- or dCV- or dIV-) & {VC+}) or [()] & OF+) or (Osi+ & R+ & Bs+ & ((dWV- or dCV- or dIV-) & {VC+}) or [()]) or (Opi+ & R+ & Bp+ & ((dWV- or dCV- or dIV-) & {VC+}) or [()]) or ([()]0 & ((dWV- or dCV- or dIV-) & {VC+}) or [()])) & {@MV+} & {VC+}) or (((dWV- or dCV- or dIV-) & {VC+}) or [()] & Pp+ & {THi+ or @MV+}) or THb+ or TO+ & IV+ or (PFb- & ((dWV- or dCV- or dIV-) & {VC+}) or [()] & {Pa+}) or ({MV+} & [Pa+]0 & {((dWV- or dCV- or dIV-) & {VC+}) or [()]}))) or ({N+} & ((AF- & ((dWV- or dCV- or dIV-) & {VC+}) or [()]) or ({MV+} & [Pv+]) or [I*v+]))  or (({N+} or {Pp+}) & Pg*b+ & ((dWV- or dCV- or dIV-) & {VC+}) or [()]) or ({@EBm+} & (O*t+ or O*m+) & {@MV+} & {THb+} & ((dWV- or dCV- or dIV-) & {VC+}) or [()])})) or ((Sa*a- & Pv+)) or ((Ss*w- & ((dWV- or dCV- or dIV-) & {VC+}) or [()] & Pp+ & TO+ & IV+)) or ( (EQ*r- & S- & ((dWV- or dCV- or dIV-) & {VC+}) or [()] & EQ*r+))


This does not contain an Ss*s link. To check this, I went to the 4.0.dict file, and I when I Ctrl-F "Ss*s", that link only appears in the macros "<noun-main-s>" and "<noun-main-e>" - Given this, how can the words "mom" and "is"--which is a verb and does not contain the "<noun-main-s>" or "<noun-main-e>" macros--be connected by an Ss*s link?


Best,

Vignav

Amir Plivatsky

unread,
Jul 12, 2020, 8:00:02 AM7/12/20
to link-grammar
Hi Vignav,

Recall the !links command output from my previous answer.
Here it is:
       LEFT-WALL      RW            ----RW-----  RW              RIGHT-WALL
 (m)   LEFT-WALL      hWV           >---WV---->  dWV             is.v
 (m)   LEFT-WALL      hWd           >---Wd-----  Wd              mom.f
 (m)   mom.f          Ss*s          ----Ss*s---  Ss              is.v
 (m)   is.v           O*t           ----Ost----  Os              human.n
 (m)   a              Ds**c         ----Ds**c--  Ds**c           human.n

In the above you can see that the matching connectors of mom.f and  is.v are Ss*s+ and  Ss-, and their corresponding link label is Ss*s.
See section "1.2.2 Connector Subscripts" in the LG introduction doc for how connector subscripts are matched. But this document somehow neglects to mention how link labels are obtained.
The idea is that link labels are the "intersection" of their endpoint connector labels.
In this particular case:
Ss**
Ss*s
----
Ss*s

Amir

Vignav Ramesh

unread,
Jul 14, 2020, 9:52:28 PM7/14/20
to link-grammar
Thanks Amir, the !links command seems very helpful. However, when I try to download the LG parser from https://github.com/opencog/link-grammar and follow all the installation steps, I still get 

(base) Viggys-MacBook-Pro:link-grammar-master vignavramesh$ link-parser en

-bash: link-parser: command not found


How can I fix this and get the parser working so I can test out these commands and debug myself?

Best,
Vignav

Amir Plivatsky

unread,
Jul 14, 2020, 10:18:21 PM7/14/20
to link-grammar
Hi Vignav,
If your "make install" command has succeeded, you may need to add /usr/local/bin to your PATH.

Amir

Linas Vepstas

unread,
Jul 14, 2020, 10:20:06 PM7/14/20
to link-grammar
When you compiled the code, it generated a binary executable in some directory. Be sure to cd to that directory (the 'cd' command changes the current working directory).  Then, in that directory say "link-parser en" and that should work. If that does not work, then try "./link-parser en".  In unix command-line shells, such as bash or csh, the ">" means "the current working directory", and the / slash is a directory separator. So "./link-parser" says "start the command in the current working directory.

If that does not work, then try saying "pwd". This will print out the current working directory.  Then try "/whatever/pd/printed/out/link-grammar en" If that still does not work, then try "/whatever/pd/printed/out/link-grammar /where/you/unpacked/the/tar-file/data/en" and that should work.

You might want to read about "unix file systems" on the internet, to refresh what you know about command lines and the locations of things.

--linas

To unsubscribe from this group and stop receiving emails from it, send an email to link-grammar...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/link-grammar/ff41b78f-af19-4b5f-a2ac-965cf39a86bco%40googlegroups.com.

Vignav Ramesh

unread,
Jul 15, 2020, 12:05:03 AM7/15/20
to link-g...@googlegroups.com
On Tue, Jul 14, 2020 at 7:20 PM Linas Vepstas <linasv...@gmail.com> wrote:
When you compiled the code, it generated a binary executable in some directory. Be sure to cd to that directory (the 'cd' command changes the current working directory).  Then, in that directory say "link-parser en" and that should work.

That worked, thanks Linas & Amir!

Vignav Ramesh

unread,
Aug 6, 2020, 3:28:33 AM8/6/20
to link-grammar
Hi Linas & Amir,

I am running into another error. When running the sentence "They smiled at each other" through the parser, I get:

linkparser> They smiled at each other
Found 2 linkages (2 had no P.P. violations)
Linkage 1, cost vector = (UNUSED=0 DIS= 0.00 LEN=7)

    +------>WV----->+      +----J---+
    +-->Wd--+---Sp--+--MVp-+   +IDLO+
    |       |       |      |   |    |
LEFT-WALL they smiled.v-d at each other

       LEFT-WALL      RW            ----RW-----  RW              RIGHT-WALL
 (m)   LEFT-WALL      hWV           >---WV---->  dWV             smiled.v-d
 (m)   LEFT-WALL      hWd           >---Wd-----  Wd              they
 (m)   they           Sp            ----Sp-----  S               smiled.v-d
 (m)   smiled.v-d     MV            ----MVp----  MVp             at
 (m)   at             J             ----J------  J               other
 (m)   each           IDLO          ----IDLO---  IDLO            other

            LEFT-WALL     0.000  hWd+ hWV+ RW+
                 they     0.000  Wd- Sp+
           smiled.v-d     0.000  S- dWV- @MV+
                   at     0.000  MVp- J+
                 each     0.000  IDLO+
                other     0.000  IDLO- J-
           RIGHT-WALL     0.000  RW-

As you can see, "each" and "other" are connected via IDLO+ and IDLO- connectors.

However, when I print out the full macro-expanded rule for "each" and "other" in my code, I get:

each: ((OFd+ & Dm+)) or (Ds+) or ([{@M+} & {R+ & Bs+ & {[[@M+]]}} & {@MXs+} & (Ss*s+ & {({@hCOd-} & (C- or dRJrc- or dRJlc+)) or ({@hCO-} & Wd-) or [Rn-]}) or SIs- or (Js- & ({Jk-} or {Mf+})) or Os- or [{[Bsj+]} & Xd- & (Xc+ or [[[[()]]]]) & MX-]  or [[[[()]]]]]) or (({@M+} & dSJls+) or ({[@M+]} & dSJrs-)) or (DTn+) or (E+) or (MVa- or [MVa- & EZ+]-) or (Wa-)


other: (Dmu+) or (dSJr-) or (({ND-} & {DD-} & Dmc+)) or ( (DD- & (Ds+) or (DD+) or ((Ss*s+ & {({@hCOd-} & (C- or dRJrc- or dRJlc+)) or ({@hCO-} & Wd-) or [Rn-]}) or SIs- or (Js- & ({Jk-} or {Mf+})) or Os- or [{[Bsj+]} & Xd- & (Xc+ or [[[[()]]]]) & MX-]  or [[[[()]]]]) or (({@M+} & dSJls+) or ({[@M+]} & dSJrs-))


IDLO is not there at all. Similarly, when I Ctrl-F "IDLO" in the 4.0.dict file, nothing comes up.

Any idea on what I am missing / how I can fix this?

Thanks,
Vignav

Amir Plivatsky

unread,
Aug 6, 2020, 10:45:17 AM8/6/20
to link-grammar
Hi Vignav,

Amir

Paul McQuesten

unread,
Aug 7, 2020, 12:20:17 PM8/7/20
to link-grammar
The links to abisoft.com are not secure (http, vice https). This is an annoyance in a modern browser.
Linas, can you fix https://abisoft.com

Vignav Ramesh

unread,
Aug 7, 2020, 1:03:55 PM8/7/20
to link-g...@googlegroups.com
Thanks Amir! 

Vignav 

On Aug 6, 2020, at 7:45 AM, Amir Plivatsky <ami...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "link-grammar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to link-grammar...@googlegroups.com.

Linas Vepstas

unread,
Aug 7, 2020, 6:12:05 PM8/7/20
to link-grammar
Hi Paul,

I let the domain owners know ... where do you see "abisoft.com"? Everything should say "abisource.com", which does work for me.

--linas

On Fri, Aug 7, 2020 at 11:20 AM Paul McQuesten <mcqu...@gmail.com> wrote:
The links to abisoft.com are not secure (http, vice https). This is an annoyance in a modern browser.
Linas, can you fix https://abisoft.com

Paul McQuesten

unread,
Aug 8, 2020, 8:02:10 AM8/8/20
to link-grammar
First: Oops! I was wrong. The insecure domain is abisource.com (not abisoft.com), in this  message:
"Hi Vignav,

Something is weird. When I click the link directly, Chrome goes to insecure "http://abisource.com".

When I copy the link I get this:

Could be a configuration problem in my browser??

The "abisource.com" link in your message yields (for me) "https://www.abisource.com/"

Linas Vepstas

unread,
Aug 8, 2020, 2:07:19 PM8/8/20
to link-grammar
What's the actual problem?  I clicked through all of the links you posted in the email, and they all work... are you getting some error message? What's the error message?

--linas

--
You received this message because you are subscribed to the Google Groups "link-grammar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to link-grammar...@googlegroups.com.

Vitaly Bogdanov

unread,
Aug 8, 2020, 2:49:02 PM8/8/20
to link-grammar
I see a warning about weak encryption on my Firefox:

Screenshot_2020-08-08_21-47-32.png

Best regards,
Vitaly
суббота, 8 августа 2020 г. в 21:07:19 UTC+3, linasv...@gmail.com:

Linas Vepstas

unread,
Aug 8, 2020, 4:57:48 PM8/8/20
to link-grammar
thanks I forwarded to #abiword on gimpnet IRC. -- linas

Reply all
Reply to author
Forward
0 new messages