/* Text analyzer (compromise) */
var dialog = [
 'The fox hunts the egg,',
 'Do you know how old the earth is?',
 'I like gray roses',
 'Do you dream neon black and think about it?' ,
 'The opera about richard nixon visiting china',
 'Where am I?',
 'Where do I live?',
 'I like roses wherever they grow',
 'Who are you?',
 'How old are you?',
 'I want to go to the stadion. Show me the way.',
 'Please, show me the way to the stadion',
 'I am on the way',
]

var parsers = dialog.map(function (sentence) { return nlp(sentence) });


parsers[0].verbs().toNegative();
print(dialog[0],parsers[0].text());

var classification=[];
for(var i=0;i<dialog.length;i++)
classification.push([dialog[i],
      parsers[i].nouns().text(),
      parsers[i].pronouns().text(),
      parsers[i].verbs().text(),
      parsers[i].adverbs().text(),
      parsers[i].adjectives().text(),
      parsers[i].conjunctions().text(),
      parsers[i].prepositions().text()]);

Table(classification,
  ['Dialog','Nouns','Pronouns','Verbs','Adverbs','Adjectives',
   'Conjunctions','Prepositions']);

print(dialog[6],parsers[6].has('where * #Pronoun'))


parser=nlp('Where are you?'); locate=parser.has('where * #Pronoun');
person=parser.pronouns().has('I')?'You':
       parser.pronouns().has('you')?'I':
       parser.nouns().first().text();

print(locate,person);
