<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist> <dict> <key>question_format</key> <string>edu.usc.ict.npc.editor.model.processor.text.TextProcessorProvider</string> <key>recordingQuestions</key> <false/> <key>answer_format</key> <string>edu.usc.ict.npc.editor.model.processor.text.TextProcessorProvider</string> <key>answers</key> <array> <dict> <key>text</key> <string>I'm sorry but i didn't understand what you said. try rephrasing it.</string> <key>ID</key> <string>Anybody-1</string> <key>tokens</key> <array> <integer>32</integer> <integer>23</integer> </array> <key>modified</key> <date>2010-01-15T11:16:39Z</date> </dict> <dict> <key>text</key> <string>hello, how may i help you today?</string> <key>speaker</key> <integer>0</integer> <key>ID</key> <string>Anybody-2</string> <key>tokens</key> <array> <integer>32</integer> </array> <key>modified</key> <date>2010-01-15T13:26:46Z</date> </dict> <dict> <key>text</key> <string>no problem</string> <key>speaker</key> <integer>0</integer> <key>ID</key> <string>Anybody-3</string> <key>tokens</key> <array> <integer>32</integer> </array> <key>modified</key> <date>2010-01-15T13:34:59Z</date> </dict> <dict> <key>text</key> <string>bye</string> <key>speaker</key> <integer>0</integer> <key>ID</key> <string>Anybody-4</string> <key>tokens</key> <array> <integer>32</integer> </array> <key>modified</key> <date>2010-01-15T13:35:28Z</date> </dict> <dict> <key>text</key> <string>Ok. Do you have cavities?</string> <key>speaker</key> <integer>0</integer> <key>ID</key> <string>Anybody-5</string> <key>tokens</key> <array> <integer>32</integer> <integer>12</integer> </array> <key>modified</key> <date>2010-01-15T13:35:51Z</date> </dict> <dict> <key>text</key> <string>are you diabetic?</string> <key>speaker</key> <integer>1</integer> <key>ID</key> <string>Anybody-6</string> <key>tokens</key> <array> <integer>32</integer> <integer>14</integer> </array> <key>modified</key> <date>2010-01-15T13:50:35Z</date> </dict> <dict> <key>text</key> <string>for you we will make only xylitol sweetened cakes. Is it ok?</string> <key>speaker</key> <integer>1</integer> <key>ID</key> <string>Anybody-7</string> <key>tokens</key> <array> <integer>32</integer> <integer>13</integer> </array> <key>modified</key> <date>2010-01-15T13:50:43Z</date> </dict> <dict> <key>text</key> <string>for you we will make only xylitol sweetened cakes. Is it ok?</string> <key>speaker</key> <integer>3</integer> <key>ID</key> <string>Anybody-16</string> <key>tokens</key> <array> <integer>32</integer> <integer>13</integer> </array> <key>modified</key> <date>2010-01-15T14:40:27Z</date> </dict> <dict> <key>text</key> <string>sorry about that, thanks you for visiting us. Come back anytime.</string> <key>speaker</key> <integer>2</integer> <key>ID</key> <string>Anybody-8</string> <key>tokens</key> <array> <integer>32</integer> <integer>11</integer> </array> <key>modified</key> <date>2010-01-15T13:51:06Z</date> </dict> <dict> <key>text</key> <string>what cake would you like? we can make sponge cakes and cheese cakes.</string> <key>speaker</key> <integer>2</integer> <key>ID</key> <string>Anybody-9</string> <key>tokens</key> <array> <integer>32</integer> <integer>15</integer> </array> <key>modified</key> <date>2010-01-15T13:51:25Z</date> </dict> <dict> <key>text</key> <string>what cake would you like? we can make sponge cakes and cheese cakes.</string> <key>speaker</key> <integer>3</integer> <key>ID</key> <string>Anybody-17</string> <key>tokens</key> <array> <integer>32</integer> <integer>15</integer> </array> <key>modified</key> <date>2010-01-15T14:43:24Z</date> </dict> <dict> <key>text</key> <string>What flavor? for sponge cakes we have chocolate and amaretto.</string> <key>speaker</key> <integer>4</integer> <key>ID</key> <string>Anybody-10</string> <key>tokens</key> <array> <integer>32</integer> <integer>16</integer> </array> <key>modified</key> <date>2010-01-15T13:52:13Z</date> </dict> <dict> <key>text</key> <string>what flavor? for cheese cakes we have chocolate and lemon.</string> <key>speaker</key> <integer>4</integer> <key>ID</key> <string>Anybody-11</string> <key>tokens</key> <array> <integer>32</integer> <integer>17</integer> </array> <key>modified</key> <date>2010-01-15T13:52:53Z</date> </dict> <dict> <key>text</key> <string>Your chocolate sponge cake will be ready in 2 hours</string> <key>speaker</key> <integer>5</integer> <key>ID</key> <string>Anybody-12</string> <key>tokens</key> <array> <integer>32</integer> <integer>11</integer> </array> <key>modified</key> <date>2010-01-15T13:53:22Z</date> </dict> <dict> <key>text</key> <string>Your amaretto sponge cake will be ready in 2 hours</string> <key>speaker</key> <integer>5</integer> <key>ID</key> <string>Anybody-13</string> <key>tokens</key> <array> <integer>32</integer> <integer>11</integer> </array> <key>modified</key> <date>2010-01-15T13:53:46Z</date> </dict> <dict> <key>text</key> <string>Your lemon cheese cake will be ready in 1 hour</string> <key>speaker</key> <integer>6</integer> <key>ID</key> <string>Anybody-14</string> <key>tokens</key> <array> <integer>32</integer> <integer>11</integer> </array> <key>modified</key> <date>2010-01-15T13:54:02Z</date> </dict> <dict> <key>text</key> <string>Your chocolate cheesecake will be ready in 1 hour</string> <key>speaker</key> <integer>6</integer> <key>ID</key> <string>Anybody-15</string> <key>tokens</key> <array> <integer>32</integer> <integer>11</integer> </array> <key>modified</key> <date>2010-01-15T13:54:16Z</date> </dict> </array> <key>questions</key> <array> <dict> <key>text</key> <string>Hi</string> <key>ID</key> <string>Anybody-1</string> <key>modified</key> <date>2010-01-15T13:26:30Z</date> </dict> <dict> <key>text</key> <string>thank you</string> <key>ID</key> <string>Anybody-2</string> <key>modified</key> <date>2010-01-15T13:34:52Z</date> </dict> <dict> <key>text</key> <string>bye</string> <key>ID</key> <string>Anybody-3</string> <key>modified</key> <date>2010-01-15T13:35:22Z</date> </dict> <dict> <key>text</key> <string>I want a cake</string> <key>ID</key> <string>Anybody-4</string> <key>modified</key> <date>2010-01-15T13:35:44Z</date> </dict> <dict> <key>text</key> <string>sponge</string> <key>ID</key> <string>Anybody-7</string> <key>modified</key> <date>2010-01-15T14:45:28Z</date> </dict> <dict> <key>text</key> <string>sponge cake</string> <key>ID</key> <string>Anybody-8</string> <key>modified</key> <date>2010-01-15T14:45:37Z</date> </dict> <dict> <key>text</key> <string>cheese</string> <key>ID</key> <string>Anybody-9</string> <key>modified</key> <date>2010-01-15T14:45:43Z</date> </dict> <dict> <key>text</key> <string>cheese cake</string> <key>ID</key> <string>Anybody-10</string> <key>modified</key> <date>2010-01-15T14:45:49Z</date> </dict> <dict> <key>text</key> <string>chocolate</string> <key>ID</key> <string>Anybody-11</string> <key>modified</key> <date>2010-01-15T14:47:35Z</date> </dict> <dict> <key>text</key> <string>lemon</string> <key>ID</key> <string>Anybody-12</string> <key>modified</key> <date>2010-01-15T14:47:41Z</date> </dict> <dict> <key>text</key> <string>amaretto</string> <key>ID</key> <string>Anybody-13</string> <key>modified</key> <date>2010-01-15T14:47:45Z</date> </dict> <dict> <key>text</key> <string>yes</string> <key>ID</key> <string>Anybody-5</string> <key>modified</key> <date>2010-01-15T14:32:46Z</date> </dict> <dict> <key>text</key> <string>no</string> <key>ID</key> <string>Anybody-6</string> <key>modified</key> <date>2010-01-15T14:35:10Z</date> </dict> </array> <key>speakers</key> <array> <dict> <key>lastName</key> <string>vendor</string> <key>class</key> <string>edu.usc.ict.npc.editor.model.Person</string> <key>firstName</key> <string>cake</string> </dict> <dict> <key>lastName</key> <string>cavities</string> <key>class</key> <string>edu.usc.ict.npc.editor.model.Person</string> <key>firstName</key> <string> </string> </dict> <dict> <key>lastName</key> <string>xylitol</string> <key>class</key> <string>edu.usc.ict.npc.editor.model.Person</string> <key>firstName</key> <string> </string> </dict> <dict> <key>lastName</key> <string>diabetes</string> <key>class</key> <string>edu.usc.ict.npc.editor.model.Person</string> <key>firstName</key> <string> </string> </dict> <dict> <key>lastName</key> <string>type</string> <key>class</key> <string>edu.usc.ict.npc.editor.model.Person</string> <key>firstName</key> <string>cake</string> </dict> <dict> <key>lastName</key> <string>cake flavor</string> <key>class</key> <string>edu.usc.ict.npc.editor.model.Person</string> <key>firstName</key> <string>sponge</string> </dict> <dict> <key>lastName</key> <string>cake flavor</string> <key>class</key> <string>edu.usc.ict.npc.editor.model.Person</string> <key>firstName</key> <string>cheese</string> </dict> </array> <key>searcherSessions</key> <array> <dict> <key>param</key> <string>0.49709331642481164 0.8808003061324292 0.0010 0.29699850649249976 -1.8058107495307922</string> <key>aid</key> <integer>0</integer> </dict> <dict> <key>param</key> <string>0.8999999741398543 0.999999997563973 0.8999999741398543 0.8999999741398543 -1.3085108697414398</string> <key>aid</key> <integer>1</integer> </dict> <dict> <key>param</key> <string>0.8999999742585771 0.9999999977072687 0.8999999742585771 0.8999999742585771 -1.8693622946739197</string> <key>aid</key> <integer>2</integer> </dict> <dict> <key>param</key> <string>0.8999999744960228 0.9999999979938601 0.8999999744960228 0.25626726307281056 -2.20221483707428</string> <key>aid</key> <integer>3</integer> </dict> <dict> <key>param</key> <string>0.8620503530637958 0.9868696224315091 0.8997486643292193 0.8999999744960228 -2.254442572593689</string> <key>aid</key> <integer>4</integer> </dict> <dict> <key>param</key> <string>0.8302989202626794 0.9999900475280482 0.9390583245956934 0.07150816877095045 -1.7507293820381165</string> <key>aid</key> <integer>6</integer> </dict> <dict> <key>param</key> <string>0.5524046787378987 0.9999653615962392 0.0023938026832204563 0.00903824405943711 -2.0552018880844116</string> <key>aid</key> <integer>5</integer> </dict> <dict> <key>param</key> <string>0.8999999761581421 1.0 0.8999999761581421 0.8999999761581421 0.0</string> </dict> </array> <key>trainingOnTestQuestions</key> <false/> <key>version</key> <integer>4</integer> <key>keepingLinkEstimatesUpdated</key> <false/> <key>map</key> <array> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>0</integer> <key>aid</key> <integer>1</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>1</integer> <key>aid</key> <integer>2</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>2</integer> <key>aid</key> <integer>3</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>3</integer> <key>aid</key> <integer>4</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>4</integer> <key>aid</key> <integer>11</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>5</integer> <key>aid</key> <integer>11</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>6</integer> <key>aid</key> <integer>12</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>7</integer> <key>aid</key> <integer>12</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>8</integer> <key>aid</key> <integer>16</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>8</integer> <key>aid</key> <integer>13</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>9</integer> <key>aid</key> <integer>15</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>10</integer> <key>aid</key> <integer>14</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>11</integer> <key>aid</key> <integer>7</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>11</integer> <key>aid</key> <integer>6</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>11</integer> <key>aid</key> <integer>9</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>12</integer> <key>aid</key> <integer>8</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>12</integer> <key>aid</key> <integer>5</integer> </dict> <dict> <key>value</key> <integer>6</integer> <key>qid</key> <integer>12</integer> <key>aid</key> <integer>10</integer> </dict> </array> <key>categories</key> <array> <dict> <key>chatEditingAllowed</key> <false/> <key>answerCategory</key> <false/> <key>classifierCategory</key> <false/> <key>readOnly</key> <true/> <key>name</key> <string>Train/Test</string> <key>ID</key> <string>train_test</string> <key>tokens</key> <array> <dict> <key>name</key> <string>Training</string> <key>ID</key> <string>train</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>name</key> <string>Test</string> <key>ID</key> <string>test</string> <key>colorAsInt</key> <integer>0</integer> </dict> </array> <key>answerEditingAllowed</key> <false/> <key>questionCategory</key> <true/> <key>questionEditingAllowed</key> <false/> <key>answerColumnVisible</key> <false/> <key>questionColumnVisible</key> <false/> </dict> <dict> <key>chatEditingAllowed</key> <false/> <key>answerCategory</key> <true/> <key>classifierCategory</key> <false/> <key>readOnly</key> <true/> <key>name</key> <string>Dialog State</string> <key>ID</key> <string>dialogState</string> <key>tokens</key> <array> <dict> <key>description</key> <string>Do not change dialog state</string> <key>name</key> <string>none</string> <key>ID</key> <string>none</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>Add tokens for undefined categories to the state, do not change the existing categories</string> <key>name</key> <string>add</string> <key>ID</key> <string>add</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>Add tokens replacing existing category values</string> <key>name</key> <string>set</string> <key>ID</key> <string>set</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>Clear dialog state and then set it to given tokens</string> <key>name</key> <string>reset</string> <key>ID</key> <string>reset</string> <key>colorAsInt</key> <integer>0</integer> </dict> </array> <key>answerEditingAllowed</key> <false/> <key>questionCategory</key> <false/> <key>questionEditingAllowed</key> <false/> <key>answerColumnVisible</key> <false/> <key>questionColumnVisible</key> <false/> </dict> <dict> <key>chatEditingAllowed</key> <false/> <key>answerCategory</key> <false/> <key>classifierCategory</key> <false/> <key>readOnly</key> <true/> <key>name</key> <string>Tone</string> <key>ID</key> <string>tone</string> <key>tokens</key> <array> <dict> <key>name</key> <string>Down</string> <key>ID</key> <string>down</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>name</key> <string>Flat</string> <key>ID</key> <string>flat</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>name</key> <string>Up</string> <key>ID</key> <string>up</string> <key>colorAsInt</key> <integer>0</integer> </dict> </array> <key>answerEditingAllowed</key> <false/> <key>questionCategory</key> <true/> <key>questionEditingAllowed</key> <false/> <key>answerColumnVisible</key> <false/> <key>questionColumnVisible</key> <false/> </dict> <dict> <key>chatEditingAllowed</key> <false/> <key>answerCategory</key> <false/> <key>classifierCategory</key> <false/> <key>readOnly</key> <true/> <key>name</key> <string>Emotion</string> <key>ID</key> <string>emotion</string> <key>tokens</key> <array> <dict> <key>name</key> <string>Neutral</string> <key>ID</key> <string>neutral</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>name</key> <string>Negative</string> <key>ID</key> <string>negative</string> <key>colorAsInt</key> <integer>0</integer> </dict> </array> <key>answerEditingAllowed</key> <false/> <key>questionCategory</key> <true/> <key>questionEditingAllowed</key> <false/> <key>answerColumnVisible</key> <false/> <key>questionColumnVisible</key> <false/> </dict> <dict> <key>chatEditingAllowed</key> <false/> <key>answerCategory</key> <true/> <key>classifierCategory</key> <true/> <key>readOnly</key> <true/> <key>name</key> <string>Toss</string> <key>ID</key> <string>toss</string> <key>tokens</key> <array> <dict> <key>description</key> <string></string> <key>name</key> <string>cake vendor</string> <key>ID</key> <string>cake vendor</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string></string> <key>name</key> <string> cavities</string> <key>ID</key> <string> cavities</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string></string> <key>name</key> <string> xylitol</string> <key>ID</key> <string> xylitol</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string></string> <key>name</key> <string> diabetes</string> <key>ID</key> <string> diabetes</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string></string> <key>name</key> <string>cake type</string> <key>ID</key> <string>cake type</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string></string> <key>name</key> <string>sponge cake flavor</string> <key>ID</key> <string>sponge cake flavor</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string></string> <key>name</key> <string>cheese cake flavor</string> <key>ID</key> <string>cheese cake flavor</string> <key>colorAsInt</key> <integer>0</integer> </dict> </array> <key>answerEditingAllowed</key> <true/> <key>questionCategory</key> <false/> <key>questionEditingAllowed</key> <false/> <key>answerColumnVisible</key> <true/> <key>questionColumnVisible</key> <false/> </dict> <dict> <key>chatEditingAllowed</key> <false/> <key>answerCategory</key> <true/> <key>classifierCategory</key> <false/> <key>readOnly</key> <false/> <key>name</key> <string>Type</string> <key>ID</key> <string>type</string> <key>tokens</key> <array> <dict> <key>description</key> <string>alternative</string> <key>name</key> <string>alternative</string> <key>ID</key> <string>alternative</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>brushoff</string> <key>name</key> <string>brushoff</string> <key>ID</key> <string>brushoff</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>conceal</string> <key>name</key> <string>conceal</string> <key>ID</key> <string>conceal</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>content</string> <key>name</key> <string>content</string> <key>ID</key> <string>content</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>delayed</string> <key>name</key> <string>delayed</string> <key>ID</key> <string>delayed</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string></string> <key>name</key> <string>opaque</string> <key>ID</key> <string>opaque</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>pre repeat</string> <key>name</key> <string>pre repeat</string> <key>ID</key> <string>pre repeat</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>repeat</string> <key>name</key> <string>repeat</string> <key>ID</key> <string>repeat</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>toss</string> <key>name</key> <string>toss</string> <key>ID</key> <string>toss</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>unknown</string> <key>name</key> <string>unknown</string> <key>ID</key> <string>unknown</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>unrelated</string> <key>name</key> <string>unrelated</string> <key>ID</key> <string>unrelated</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>opening</string> <key>name</key> <string>opening</string> <key>ID</key> <string>opening</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>closing</string> <key>name</key> <string>closing</string> <key>ID</key> <string>closing</string> <key>colorAsInt</key> <integer>0</integer> </dict> <dict> <key>description</key> <string>once</string> <key>name</key> <string>once</string> <key>ID</key> <string>once</string> <key>colorAsInt</key> <integer>0</integer> </dict> </array> <key>answerEditingAllowed</key> <true/> <key>questionCategory</key> <false/> <key>questionEditingAllowed</key> <true/> <key>answerColumnVisible</key> <true/> <key>questionColumnVisible</key> <true/> </dict> <dict> <key>chatEditingAllowed</key> <false/> <key>answerCategory</key> <true/> <key>classifierCategory</key> <false/> <key>readOnly</key> <false/> <key>name</key> <string>Speaker</string> <key>ID</key> <string>speaker</string> <key>tokens</key> <array> <dict> <key>name</key> <string>brad</string> <key>ID</key> <string>brad</string> <key>colorAsInt</key> <integer>0</integer> </dict> </array> <key>answerEditingAllowed</key> <true/> <key>questionCategory</key> <false/> <key>questionEditingAllowed</key> <true/> <key>answerColumnVisible</key> <true/> <key>questionColumnVisible</key> <true/> </dict> </array> <key>dialog_manager</key> <dict> <key>param</key> <dict> <key>useScriptFile</key> <false/> <key>storedScriptFileName</key> <string>0</string> <key>scriptText</key> <string>// ============================================================================ // dm.java // ============================================================================ // // Created by leuski on Aug 22, 2009. // Copyright (c) 2009 Anton Leuski. All rights reserved. // // ============================================================================ package edu.usc.ict.npc.editor.dialog.script.dm; import edu.usc.ict.npc.editor.dialog.script.* import java.awt.event.ActionListener import java.awt.event.ActionEvent; import javax.swing.Timer; import com.leuski.af.Application; class Global implements ActionListener { final static String kConceal = "conceal"; final static String kUnknown = "unknown"; final static String kOpaque = "opaque"; final static String kAlternative = "alternative"; final static String kRepeat = "repeat"; final static String kPrompt = "prompt"; final static String kCharacterIgnore = 'ignore'; final static Event kInitiativeTimerEvent = new Event(Event.kDispatchHint, "dm_prompt"); final static int kHistoryWindow = 10; final static double kWaitBeforePrompt = 5; // seconds Engine engine; String domainName = null; Regular regularState; State currentState; Map&lt;String,Object&gt; lastUtterance; Event lastSpeechEvent; boolean microphoneEnabled; long lastUserStartedSpeaking; long lastUserStoppedSpeaking; long lastCharacterStoppedSpeaking; long lastCharacterStartedSpeaking; Global(Engine inEngine) { engine = inEngine; } public Set getPresentCharacters() { return (Set)engine.context.presentCharacters; } public void reset() { engine.reset(); // initialize global variables here clear(); regularState = new Regular(this); enterState(regularState); } public void actionPerformed(ActionEvent e) { Timer thisTimer = (Timer)e.getSource(); if (engine.context.initiativeTimer != thisTimer) { thisTimer.stop(); return; } engine?.postEvent(kInitiativeTimerEvent); } public void clear() { engine.context.presentCharacters = new HashSet(); lastUtterance = null; lastSpeechEvent = null; Timer timer = new Timer(1000, this); // This timer will periodically trigger executor events timer.setRepeats(true); timer.start(); engine.context.initiativeTimer = timer; } public void setMicrophoneEnabled(boolean inEnabled) { if (microphoneEnabled == inEnabled) return; microphoneEnabled = inEnabled; engine.send(inEnabled ? "TO_ASR &lt;start id=\"temp\"&gt;" : "TO_ASR &lt;stop id=\"temp\"&gt;"); } public void exitState(State inTarget) { inTarget?.onexit(); engine.removeTrigger(inTarget); } public void enterState(State inTarget) { currentState = inTarget; engine.addTrigger(inTarget); inTarget?.onentry(); } public void transitionTo(State inTarget) { exitState(currentState); enterState(inTarget); } } Global global = new Global(engine); public class State implements Trigger { Global global; Engine getEngine() { return global.engine; } State(Global inGlobal) { global = inGlobal; global.setMicrophoneEnabled(true); global.setMicrophoneEnabled(false); } public boolean handle(Event event) { //Application.getLogger().warning(event.toString()); //System.out.println(event); return false; } public boolean npcBehavior_done(Event event) { global.lastCharacterStoppedSpeaking = System.currentTimeMillis(); return false; } public boolean handleToss(Event event) { global.domainName = event.utterance.toss; global.lastSpeechEvent = null; //Application.getLogger().warning("Toss to " + global.domainName); //System.out.println("Toss to " + global.domainName); return false; } public boolean npcBehavior_begin(Event event) { global.lastCharacterStartedSpeaking = System.currentTimeMillis(); if (event?.utterance?.toss) return handleToss(event); return false; } public boolean vrSpeech_start(Event event) { global.lastUserStartedSpeaking = System.currentTimeMillis(); return false; } public boolean vrSpeech_finished_speaking(Event event) { global.lastUserStoppedSpeaking = System.currentTimeMillis(); return false; } public boolean dm_prompt(Event event) { // long currentTime = System.currentTimeMillis(); // // if (global.lastCharacterStartedSpeaking &lt; global.lastCharacterStoppedSpeaking // &amp;&amp; global.lastUserStartedSpeaking &lt; global.lastUserStoppedSpeaking // &amp;&amp; (currentTime - global.lastCharacterStoppedSpeaking) &gt;= (Global.kWaitBeforePrompt * 1000)) { // // List&lt;Map&lt;String,Object&gt;&gt; answers = engine.answersForCharacter(global.domainName).findAll( { Map&lt;String,Object&gt; utterance -&gt; // utterance.type == Global.kPrompt }).toList(); // if (!answers.isEmpty()) { // Collections.shuffle(answers); // send(leastRecent(answers, Global.kHistoryWindow)); // } // } return false; } public Behavior send(Map&lt;String,Object&gt; inUtterance) { if (inUtterance != null) { if (inUtterance.script) { global.lastUtterance = null; return engine.schedule(inUtterance); } else { global.lastUtterance = inUtterance; Behavior b = engine.schedule(inUtterance); b.setLock(Behavior.kDefaultLock); return b; } } return engine.schedule(inUtterance); } protected Behavior sendRegular(Map&lt;String,Object&gt; inUtterance) { //Map&lt;String,Object&gt; b=inUtterance.clone(); //Application.getLogger().warning(b.toString()); //b.put("ID","Anybody-1"); //Application.getLogger().warning(b.toString()); return send(inUtterance); } public Map&lt;String,Object&gt; utteranceWithID(String inUtterance) { return (Map&lt;String,Object&gt;)engine.answers().find({Map&lt;String,Object&gt; utterance -&gt; utterance.ID == inUtterance}); } protected Map&lt;String,Object&gt; leastRecent(List&lt;Map&lt;String,Object&gt;&gt; inAnswers, int inDepth) { def selectedUtterance = null; def depth = -1; for(a in inAnswers) { def d = engine.seenRecently(a, inDepth); if (d &gt; depth) { depth = d; selectedUtterance = a; if (depth &gt;= inDepth) break; } } return selectedUtterance; } protected void onexit() { } protected void onentry() { } } public class Regular extends State { int offTopicCount = 0; Regular(Global inGlobal) { super(inGlobal); } public boolean handle(Event event) { if (event.event == Event.kLockEventType &amp;&amp; event?.id == Behavior.kDefaultLock) { global.setMicrophoneEnabled(engine.executor.canAcquireLock(Behavior.kDefaultLock)); return false; } else if (event.text) { return vrSpeech_asr_complete(event); } else { return super.handle(event); } } protected Behavior sendOfftopic() { ++offTopicCount; return send(randomOfftopic()); } protected Behavior sendRegular(Map&lt;String, Object&gt; inUtterance) { offTopicCount = 0; return super.sendRegular(inUtterance); } private Map&lt;String,Object&gt; randomOfftopic(String inOfftopicType) { List&lt;Map&lt;String,Object&gt;&gt; answers = engine.answersForCharacter(global.domainName).findAll( { Map&lt;String,Object&gt; utterance -&gt; utterance.type == inOfftopicType }).toList(); if (answers.isEmpty()) answers = engine.answersForCharacter(global.domainName).findAll( { Map&lt;String,Object&gt; utterance -&gt; utterance.type == Global.kOpaque || utterance.type == Global.kUnknown || utterance.type == Global.kConceal }).toList(); Collections.shuffle(answers); return leastRecent(answers, Global.kHistoryWindow); } private Map&lt;String,Object&gt; randomOfftopic() { String offTopicType = Global.kConceal; if (offTopicCount == 1) offTopicType = Global.kOpaque; else if (offTopicCount == 2) offTopicType = Global.kUnknown; return randomOfftopic(offTopicType); } public boolean vrSpeech_asr_complete(Event event) { if (!event.text || ((String)event.text).trim().length() == 0) return false; if (global.domainName == null) global.domainName = (String)event.speaker; Application.getLogger().warning(global.domainName); // if (!global.isMicrophoneEnabled()) return false; try { List&lt;Map&lt;String,Object&gt;&gt; answersCl = engine.search(global.domainName, event); //List&lt;Map&lt;String,Object&gt;&gt; answersDm = engine.answersForCharacter(global.domainName); //List&lt;String&gt; answerDnFilter=answersDm.collect( { Map&lt;String,Object&gt; u -&gt; u.ID}).toList(); //Application.getLogger().warning(answerDnFilter.toString()); //List&lt;Map&lt;String,Object&gt;&gt; answers=answersCl.findAll({Map&lt;String,Object&gt; u -&gt; answerDnFilter.contains(u.ID)}).toList(); List&lt;Map&lt;String,Object&gt;&gt; answers=answersCl; //Application.getLogger().warning(answers.toString()); if (answers.isEmpty()) { sendOfftopic(); } else { Map&lt;String,Object&gt; selectedUtterance = (Map)answers[0]; if (selectedUtterance.type == Global.kAlternative) { if (!global.lastSpeechEvent) { sendOfftopic(); } else { offTopicCount = 0; return vrSpeech_asr_complete(global.lastSpeechEvent); } return false; } if (selectedUtterance.type == Global.kRepeat) { if (!global.lastUtterance) { sendOfftopic(); } else { sendRegular(global.lastUtterance); } return false; } global.lastSpeechEvent = event; Map&lt;String,Object&gt; a=leastRecent(answers,Global.kHistoryWindow); //Application.getLogger().warning(a.get("domain")); //Application.getLogger().warning(a.toString()); sendRegular(a); } } catch (Throwable t) { t.printStackTrace(); } return false; } } global.reset(); </string> <key>scriptEngineName</key> <string>groovy</string> </dict> <key>class</key> <string>edu.usc.ict.npc.editor.dialog.script.ScriptableDialogManager</string> </dict> <key>evaluationFrameworkProvider</key> <dict> <key>class</key> <string>edu.usc.ict.npc.editor.model.EvaluationFrameworkProvider$MeanFScoreEvaluationFramework</string> </dict> <key>loggingConversations</key> <false/> </dict> </plist>