learn-discourse algorithm:

Let ld-cond1 = 
    (<ts> ^conversational-record <cr> ^private.self <self>)
    ; no one else has the turn:
  -{(<cr> ^turn <turn>)
    (<turn> ^status acquired ^speaker <> <self>)}
    ; no one else is expected to claim the turn:
  -{(<cr> ^turn <turn>)
    (<turn> ^status expected-next ^speaker <> <self>)}
    (<ts> ^dialogue-planning-model <dpm>)
   -(<dpm> ^d-move) ; I have no planned moves
    (<dpm> ^d-goal) ; I have discourse goal

Let ld-cond2 =
    (<ts> ^conversational-record <cr> ^private.self <self>)
    ; no one else has the turn:
  -{(<cr> ^turn <turn>)
    (<turn> ^status acquired ^speaker <> <self>)}
    ; no one else is expected to claim the turn:
  -{(<cr> ^turn <turn>)
    (<turn> ^status expected-next ^speaker <> <self>)}
    (<ts> ^dialogue-planning-model <dpm>)
   -(<dpm> ^d-move) ; I have no planned moves
   -(<dpm> ^d-goal) ; I have no discourse goal
    ; there is an expectation for me to respond:
    (<cr> ^expectations <exp>)
    (<exp> ^speaker <self>)

Let dpc-cond-1 =    
    (<ts> ^conversational-record <cr> ^private <priv>)
    (<priv> ^self <self>)
    ; and that no one currently has the turn:
  -{(<cr> ^turn <turn>)
    (<turn> ^status acquired)}
    ; and that no one else is expected to claim the turn:
  -{(<cr> ^turn <turn>)
    (<turn> ^status expected-next ^speaker <> <self>)}
    ; and that speaker has no planned moves:
    (<ts> ^dialogue-planning-model <dpm>)
    (<dpm> -^d-move)
    ; and has discourse goal:
    (<dpm> ^d-goal.goal { <d-goal> mb-addressee-believe} )
    ; and has no illocutionary expectations to fulfull:
  -{(<cr> ^expectations <exp> )
    (<exp> ^speaker <self> ^type illocutionary)}

Let dpc-cond-2 =               
Let dpc-cond-3 =               
Let dpc-cond-4 =                
Let dpc-cond-5 =
Let dpc-cond-6 =               
Let dpc-cond-7 =               
Let dpc-cond-8 =               
Let dpc-cond-9 =

If ld-cond1 or ld-cond2 then
   in subgoal <g1> named create-d-plan do {

   If dpc-cond-1 or dpc-cond-2 or ... dpc-cond-9 then do in <g1> {

      Copy discourse structures from Top to <g1>

      Create d-plan-constructor instance <d1>

      Do in subgoal <g2> named d-plan {

         Acquire-turn
         Achieve-d-goal
         Release-turn
         Return-results
         Build-chunks  /* builds <d1>'s implementation chunks */

         }

      Propose <d1> in supergoal of <g1>

      Build-chunks   /* builds <d1>'s proposal chunks */
      } 
   }



   

   

   
  