Nice one, Adam!

I'm liking the constraints paradigm because it follows the real-world domain, conceived of as an inverse pyramid:

Not all claims are expressed in a Wikipedia, and of those
       Not all claims are codified in Wikidata, and of those
              Not all claims are "salient", given our topic of interest, and of those,
                     Not all claims are yet expressible as natural language output, and of those,
                            Not all claims are expressible in the target language, and of those,
                                   Natural language generation filters apply for sense, volume...
                                           Funnelled into rendering:
                                                    "I sat at my desk, stared into the garden and thought '42 will do'                      .                                                             I typed it out. End of story." Douglas Adams (Q42)

Do you have a link for that OU paper [1]?

Best regards,
Al.
On Sunday, 26 July 2020, <abstract-wikipedia-request@lists.wikimedia.org> wrote:
Send Abstract-Wikipedia mailing list submissions to
        abstract-wikipedia@lists.wikimedia.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.wikimedia.org/mailman/listinfo/abstract-wikipedia
or, via email, send a message with subject or body 'help' to
        abstract-wikipedia-request@lists.wikimedia.org

You can reach the person managing the list at
        abstract-wikipedia-owner@lists.wikimedia.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Abstract-Wikipedia digest..."


Today's Topics:

   1. Re: Conjugation and Declension Functions (Adam Sobieski)


----------------------------------------------------------------------

Message: 1
Date: Sun, 26 Jul 2020 15:38:35 +0000
From: Adam Sobieski <adamsobieski@hotmail.com>
To: "General public mailing list for the discussion of Abstract
        Wikipedia (aka Wikilambda)" <abstract-wikipedia@lists.wikimedia.org>
Subject: Re: [Abstract-wikipedia] Conjugation and Declension Functions
Message-ID:
        <CH2PR12MB41847550B85B34171077395FC5750@CH2PR12MB4184.namprd12.prod.outlook.com>

Content-Type: text/plain; charset="windows-1252"

We could also view the matter as being one of specifying a set of constraints [1][2] with which to describe a desired sentence.

That is, the syntactic sugar:

(1) hit<voice::active, tense::past, aspect::perfective, mood::indicative>(context, [ {role: ‘agent’, value: Bobby}, {role: ‘patient’, value: ball}, {role: ‘instrument’, value: bat} ]);

could be viewed as indicating a number of simultaneous constraints with regard to a desired sentence. With an expression tree model, we could form expressions for a constraint-based system while making use of objects in scope.


  1.  constraints.add(expr.equals(expr.symbol(‘verb’), expr.constant(getVerb(‘https://example.com/verb#hit’))));

The generic arguments “<voice::active, tense::past, aspect::perfective, mood::indicative>” could translate or map to:


  1.  constraints.add(expr.equals(expr.symbol(‘voice’), expr.constant(‘active’)));
  2.  constraints.add(expr.equals(expr.symbol(‘tense’), expr.constant(‘past’)));
  3.  constraints.add(expr.equals(expr.symbol(‘aspect’), expr.constant(‘perfective’)));
  4.  constraints.add(expr.equals(expr.symbol(‘mood’), expr.constant(‘indicative’)));

Next, to the array of role-adorned nouns, “[ {role: ‘agent’, value: Bobby}, {role: ‘patient’, value: ball}, {role: ‘instrument’, value: bat} ]”:


  1.  constraints.add(expr.equals(expr.property(e0, ‘role’), expr.constant(‘agent’)));
  2.  constraints.add(expr.equals(expr.property(e0, ‘value’), expr.constant(Bobby)));


  1.  constraints.add(expr.equals(expr.property(e1, ‘role’), expr.constant(‘patient’)));
  2.  constraints.add(expr.equals(expr.property(e1, ‘value’), expr.constant(ball)));


  1.  constraints.add(expr.equals(expr.property(e2, ‘role’), expr.constant(‘instrument’)));
  2.  constraints.add(expr.equals(expr.property(e2, ‘value’), expr.constant(ball)));


  1.  constraints.add(expr.holds(‘occursInSentenceBefore’, Bobby, ball));
  2.  constraints.add(expr.holds(‘occursInSentenceBefore’, ball, bat));

There exists mappings from the information in the generic function invocation (1) to rough-draft pseudocode for describing a set of constraints ((a) – (m)).

We could also add scalars as arguments when adding constraints to a set. For instance, we could add scalar arguments to (l) and (m):

constraints.add(expr.holds(‘occursInSentenceBefore’, Bobby, ball), 0.5);
constraints.add(expr.holds(‘occursInSentenceBefore’, ball, bat), 0.5);

Constraint-based approaches are both expressive and extensible. With a set of weighted constraints describing a desired output sentence, we could then invoke a sentence realizer:

realizeSentence(constraints) --> “Bobby hit the ball with the bat”


Best regards,
Adam

[1] Piwek, Paul, and Kees Van Deemter. Constraint-based natural language generation: A survey. Technical Report 2006/03, Computing Department, The Open University, 2006.
[2] https://en.wikipedia.org/wiki/Constraint_programming

From: Adam Sobieski<mailto:adamsobieski@hotmail.com>
Sent: Saturday, July 25, 2020 1:43 PM
To: General public mailing list for the discussion of Abstract Wikipedia (aka Wikilambda)<mailto:abstract-wikipedia@lists.wikimedia.org>
Subject: RE: Conjugation and Declension Functions


Thank you all for the comments and feedback thus far.



I would like to indicate that we could also utilize the expressiveness of JavaScript/TypeScript for array literals with object literal elements. In this alternative approach, arguments could be placed into an array of objects which each attach a thematic role to an argument. “Bobby”, “ball” and “bat” could be objects of type Noun, and we could pass to a function an array literal of object literals to get at the desired concepts of: (1) sequence, (2) roles, (3) values. That is rather the matter: attaching thematic roles to elements of a sequence of arguments.



To the example pseudocode:



Noun Bobby;

Noun ball;

Noun bat;



hit<voice::active, tense::past, aspect::perfective, mood::indicative>(context, [ {role: ‘agent’, value: Bobby}, {role: ‘patient’, value: ball}, {role: ‘instrument’, value: bat} ]) --> “Bobby hit the ball with the bat”

hit<voice::active, tense::past, aspect::perfective, mood::indicative>(context, [ {role: ‘agent’, value: Bobby}, {role: ‘instrument’, value: bat}, {role: ‘patient’, value: ball} ]) --> “Bobby, with the bat, hit the ball”

hit<voice::active, tense::past, aspect::perfective, mood::indicative>(context, [ {role: ‘instrument’, value: bat}, {role: ‘agent’, value: Bobby}, {role: ‘patient’, value: ball} ]) --> “With the bat, Bobby hit the ball”



or, if the grammatical arguments (voice, tense, aspect, mood) are properties of the context object:



hit(context, [ {role: ‘agent’, value: Bobby}, {role: ‘patient’, value: ball}, {role: ‘instrument’, value: bat} ]) --> “Bobby hit the ball with the bat”

hit(context, [ {role: ‘agent’, value: Bobby}, {role: ‘instrument’, value: bat}, {role: ‘patient’, value: ball} ]) --> “Bobby, with the bat, hit the ball”

hit(context, [ {role: ‘instrument’, value: bat}, {role: ‘agent’, value: Bobby}, {role: ‘patient’, value: ball} ]) --> “With the bat, Bobby hit the ball”



A downside would be that the function signatures would resemble:



hit<…>(Context, Array)



or



hit<…>(Context, Array<RoleNounPair>)



An upside would be expressiveness with which to indicate desired output paraphrases.



These topics are discussed in Building Natural Language Generation Systems by Reiter and Dale [1], in chapter 6 on Surface Realization, in section 6.8 on Bidirectional Grammars, pages 194 – 195, where the authors indicate that while “a parser might produce the same logical form for the following three sentences:



  1.  Mary gave John a ball.
  2.  Mary gave a ball to John.
  3.  John was given a ball by Mary.



“The input to a realizer, however, should explicitly provide a means of choosing among these forms; the alternative is to choose at random.” (as noted, another alternative is to select using a manual of style).



The authors also indicate that Winograd [2] provided a list of paraphrases for consideration:



  1.  Jon bought a painting for Vina.
  2.  Jon bought Vina a painting.
  3.  Vina was bought a painting by Jon.
  4.  What Jon bought Vina was a painting.
  5.  What Vina was bought by Jon was a painting.
  6.  It was a painting that Jon bought for Vina.
  7.  It was Jon that bought Vina a painting.
  8.  It was Vina that Jon bought a painting for.



On the topic of “a” or “the”, definite or indefinite noun phrases, we can note a discussion in Reiter and Dale [1], section 5.4.2, on page 145. That is another important discussion topic.



In the set of approaches under discussion, by making use of grammatical arguments (e.g. voice, tense, aspect, mood) and by placing thematic roles on elements of a sequence of arguments, we have an expressiveness beyond that of predicate calculus with which to distinguish paraphrases.





Best regards,

Adam



[1] Reiter, Ehud, and Robert Dale. Building natural language generation systems. Cambridge university press, 2000.

[2] Winograd, Terry. "Language as a cognitive process." (1983).

From: Adam Sobieski<mailto:adamsobieski@hotmail.com>
Sent: Friday, July 24, 2020 7:07 PM
To: General public mailing list for the discussion of Abstract Wikipedia (aka Wikilambda)<mailto:abstract-wikipedia@lists.wikimedia.org>
Subject: Re: [Abstract-wikipedia] Conjugation and Declension Functions

In addition to broaching the discovery, encoding and reuse of language-specific patterns, which I view as a discussion topic when comparing and contrasting approaches (see: the DRY principle [1] and the abstraction principle [2]), and indicating how conjugation and declension functions would facilitate the discovery, encoding and reuse of these patterns, I would like to share some topics which arose as I explored adding the thematic relation [3] of instrument to the agent-patient pair.

When exploring how best to add the thematic relation of instrument to the agent-patient pair (e.g. adding “using the bat” to “Bobby hit the ball”), I observed that, for the same input grammatical arguments, there was a set of possible output paraphrases:


  1.  “Bobby hit the ball using the bat”
  2.  “Bobby, using the bat, hit the ball”
  3.  “Using the bat, Bobby hit the ball”

I wondered: how might we be able to generate each?

One possibility is indicated. There could be a type for each thematic relation [3]. Then, using explicit type conversions to these types, we could have different functions for different sequences of input arguments.

That is,

hit<voice::active, tense::past, aspect::perfective, mood::indicative>(context, (Agent)Bobby, (Patient)ball, (Instrument)bat) --> “Bobby hit the ball using the bat”
hit<voice::active, tense::past, aspect::perfective, mood::indicative>(context, (Agent)Bobby, (Instrument)bat, (Patient)ball) --> “Bobby, using the bat, hit the ball”
hit<voice::active, tense::past, aspect::perfective, mood::indicative>(context, (Instrument)bat, (Agent)Bobby, (Patient)ball) --> “Using the bat, Bobby hit the ball”

or

hit<voice::active, tense::past, aspect::perfective, mood::indicative>(context, Bobby as Agent, ball as Patient, bat as Instrument) --> “Bobby hit the ball using the bat”
hit<voice::active, tense::past, aspect::perfective, mood::indicative>(context, Bobby as Agent, bat as Instrument, ball as Patient) --> “Bobby, using the bat, hit the ball”
hit<voice::active, tense::past, aspect::perfective, mood::indicative>(context, bat as Instrument, Bobby as Agent, ball as Patient) --> “Using the bat, Bobby hit the ball”

These functions could each wrap the use of patterns (as indicated in previous email) and attempt to realize output sentences utilizing the arguments in the same sequence in which they were provided. This would, however, mean that the callers of the functions would be responsible for “shuffling” the input arguments to express the desired paraphrase ((1), (2), (3)).

There are, of course, other approaches to consider and other possibilities to consider with respect to addressing the matter of outputting the example paraphrases.

Any thoughts on these topics?


Best regards,
Adam

[1] https://en.wikipedia.org/wiki/Don%27t_repeat_yourself
[2] https://en.wikipedia.org/wiki/Abstraction_principle_(computer_programming)
[3] https://en.wikipedia.org/wiki/Thematic_relation

P.S.: We could also put the grammatical arguments on the context object (context.voice, context.tense, context.aspect, context.mood, et cetera) and then make use of generic parameters for other uses.

From: Adam Sobieski<mailto:adamsobieski@hotmail.com>
Sent: Thursday, July 23, 2020 7:38 PM
To: General public mailing list for the discussion of Abstract Wikipedia (aka Wikilambda)<mailto:abstract-wikipedia@lists.wikimedia.org>
Subject: RE: Conjugation and Declension Functions


I had an idea about discovering, encoding and reusing patterns in languages that I would like to share with the group.



The following is rough-draft pseudocode for a function with which to generate sentences for the verb “to kick”. The function has generic parameters for voice and tense and parameters for context, agent and patient.



Clause kick<V, T>(Context context, Noun agent, Noun patient)

{

  switch(V)

  {

    case voice::active:

      switch(T)

      {

        case tense::past:

        case tense::present:

          return join(" ", [

            agent,

            conjugate_en(“kick”, V, T, …),

            “the”,

            patient

          ]);

        case tense::future:

          return join(" ", [

            agent,

            “will”,

            conjugate_en(“kick”, V, T, …),

            “the”,

            patient

          ]);

        …

      }

    case voice::passive:

      switch(T)

      {

        case tense::past:

          return join(" ", [

            “the”,

            patient,

            “was”,

            conjugate_en(“kick”, V, T, …),

            “by”

            agent

          ]);

        case tense::present:

          return join(" ", [

            “the”,

            patient,

            “is”,

            “being”,

            conjugate_en(“kick”, V, T, …),

            “by”

            agent

          ]);

       …

     }

  }

}



and



kick<voice::active, tense::past>(context, Bobby, ball) returns “Bobby kicked the ball”.



In English, most combinations of tense, aspect, mood and voice are expressed periphrastically, using constructions with auxiliary verbs. After implementing a number of these for similar verbs, per the above example, we would notice a pattern. That pattern could be expressed as something resembling:



Clause pattern123<V, T>(Context context, Verb verb, Noun agent, Noun patient)

{

  switch(V)

  {

    case voice::active:

      switch(T)

      {

        case tense::past:

        case tense::present:

          return join(" ", [

            agent,

            conjugate_en(verb, V, T, …),

            “the”,

            patient

          ]);

        case tense::future:

          return join(" ", [

            agent,

            “will”,

            conjugate_en(verb, V, T, …),

            “the”,

            patient

          ]);

        …

      }

    case voice::passive:

      switch(T)

      {

        case tense::past:

          return join(" ", [

            “the”,

            patient,

            “was”,

            conjugate_en(verb, V, T, …),

            “by”

            agent

          ]);

        case tense::present:

          return join(" ", [

            “the”,

            patient,

            “is”,

            “being”,

           conjugate_en(verb, V, T, …),

            “by”

            agent

          ]);

       …

     }

  }

}


We could then simply express that the verb “to kick” is an instance of pattern pattern123 with something resembling:



Clause kick<V, T>(Context context, Noun agent, Noun patient)

{

  pattern123<V, T>(context, new Verb(“kick”, …), agent, patient);

}

or


Clause kick<V, T>(Context context, Noun agent, Noun patient)

{

  pattern123<V, T>(context, getVerb(“https://…#kick”), agent, patient);

}

and this pattern could be reused for a large number of verbs.

This use of patterns should extend to scenarios where there are more parameters for other thematically-related nouns:



Clause kick<V, T>(Context context, Noun agent, Noun patient, Noun instrument)

{

  pattern1234<V, T>(context, new Verb(“kick”, …), agent, patient, instrument);

}

For English, there might be more generic parameters than those for voice and tense; we could add those for aspect and mood (e.g. pattern1234<V, T, A, M>(…)).

In conclusion, with generic programming and functions for conjugation and declension, we have expressiveness with which to discover, encode and reuse language-specific patterns.


Best regards,
Adam Sobieski



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.wikimedia.org/pipermail/abstract-wikipedia/attachments/20200726/f6c6c17f/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Abstract-Wikipedia mailing list
Abstract-Wikipedia@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/abstract-wikipedia


------------------------------

End of Abstract-Wikipedia Digest, Vol 1, Issue 90
*************************************************