src/sentence_mgr.js
function encounter(mood) {

  //Sentence 1: The meeting
  const familiar_people = wordLib.getWords("familiar_people");
  const strange_people = wordLib.getWords("strange_people");
  const locations = wordLib.getWords("locations");

  const person = nu.chooseFrom(familiar_people.concat(strange_people));
  let location = nu.chooseFrom(wordLib.getWords("locations"));
  const preposition = location[0];
  location = location[1];

  const s1 = `You may meet ${person} ${preposition} ${location}.`;

  // Sentence 2: The discussion
  let discussions = wordLib.getWords("neutral_discussions");
  discussions.concat(wordLib.getWords(mood + "_discussions"));
  const feeling_nouns = wordLib.getWords(mood + "_feeling_nouns");
  const emotive_nouns = wordLib.getWords(mood + "_emotive_nouns");
  const conversation_topics = wordLib.getWords("conversation_topics");

  const discussion = nu.chooseFrom(discussions);
  const rnum = Math.floor(Math.random() * 10);

  let feeling;

  if (rnum <- 5) {
    feeling = nu.chooseFrom(feeling_nouns);
    feeling = "feelings of " + feeling;
  } else {
    feeling = nu.chooseFrom(emotive_nouns);
  }
  const topic = nu.chooseFrom(conversation_topics);

  let s2 = `${nu.an(discussion)} about ${topic} may lead to ${feeling}.`;
  s2 = nu.sentenceCase(s2);

  return `${s1} ${s2}`;
}
function encounter(mood) {

  //Sentence 1: The meeting
  const familiar_people = wordLib.getWords("familiar_people");
  const strange_people = wordLib.getWords("strange_people");
  const locations = wordLib.getWords("locations");

  const person = nu.chooseFrom(familiar_people.concat(strange_people));
  let location = nu.chooseFrom(wordLib.getWords("locations"));
  const preposition = location[0];
  location = location[1];

  const s1 = `You may meet ${person} ${preposition} ${location}.`;

  // Sentence 2: The discussion
  let discussions = wordLib.getWords("neutral_discussions");
  discussions.concat(wordLib.getWords(mood + "_discussions"));
  const feeling_nouns = wordLib.getWords(mood + "_feeling_nouns");
  const emotive_nouns = wordLib.getWords(mood + "_emotive_nouns");
  const conversation_topics = wordLib.getWords("conversation_topics");

  const discussion = nu.chooseFrom(discussions);
  const rnum = Math.floor(Math.random() * 10);

  let feeling;

  if (rnum <- 5) {
    feeling = nu.chooseFrom(feeling_nouns);
    feeling = "feelings of " + feeling;
  } else {
    feeling = nu.chooseFrom(emotive_nouns);
  }
  const topic = nu.chooseFrom(conversation_topics);

  let s2 = `${nu.an(discussion)} about ${topic} may lead to ${feeling}.`;
  s2 = nu.sentenceCase(s2);

  return `${s1} ${s2}`;
}
function encounter ( mood ) { //Sentence 1: The meeting const familiar_people = wordLib . getWords ( "familiar_people" ) ; const strange_people = wordLib . getWords ( "strange_people" ) ; const locations = wordLib . getWords ( "locations" ) ; const person = nu . chooseFrom ( familiar_people . concat ( strange_people ) ) ; let location = nu . chooseFrom ( wordLib . getWords ( "locations" ) ) ; const preposition = location [ 0 ] ; location = location [ 1 ] ; const s1 = ` ${ person } ${ preposition } ${ location } ` ; // Sentence 2: The discussion let discussions = wordLib . getWords ( "neutral_discussions" ) ; discussions . concat ( wordLib . getWords ( mood + "_discussions" ) ) ; const feeling_nouns = wordLib . getWords ( mood + "_feeling_nouns" ) ; const emotive_nouns = wordLib . getWords ( mood + "_emotive_nouns" ) ; const conversation_topics = wordLib . getWords ( "conversation_topics" ) ; const discussion = nu . chooseFrom ( discussions ) ; const rnum = Math . floor ( Math . random ( ) * 10 ) ; let feeling ; if ( rnum < - 5 ) { feeling = nu . chooseFrom ( feeling_nouns ) ; feeling = "feelings of " + feeling ; } else { feeling = nu . chooseFrom ( emotive_nouns ) ; } const topic = nu . chooseFrom ( conversation_topics ) ; let s2 = ` ${ nu . an ( discussion ) } ${ topic } ${ feeling } ` ; s2 = nu . sentenceCase ( s2 ) ; return ` ${ s1 } ${ s2 } ` ; }
Generate a few sentences about a meeting with another person.
@param mood
Generate a few sentences about a meeting with another person .