• 沒有找到結果。

Chapter 2 Background 6

3.1 Preliminaries

In the section we will define the notation of controlling commands. First We were inspired by Phrase Structure Grammar (PSG),that is a grammatical notion presented by Chomsky in Syntactic Structures (1957) to represent the structure in language phrases.[20] Based on PSG, we could decompose the sentence to noun-phrase as NP and verb-phrase as VP. In general, the VP will contain NP and verbs and the NP will contain nouns.

Further, we define some notation . (Table 3.1) We define the device that receive user's command is dominated device (Cx). And general noun (N ) often means the operated-state of dominated device. User's commands map to the behavior (bxi) of the dominated device. The subscript x is corresponding to the operated device (Cx). The subscript i is a index means order of behaviors. The subscript x is corresponding to the operated component (Cx). We define the description as Dx that includes adj and Loc.

Table 3.1: Notation of Cluster

Table 3.2: Notation of Set

And we define the set of notation. (Table 3.2) As mentioned PSG, the structure of the sentence is often drawn out as a parse tree, shown in Figure 3.1. Due to the parse tree, we can obtain the structure of sentence easily. Give a example "Turn on the red TV in the room and

Turn on the red TV in the room

go to channel 36". As mentioned, we can disassemble the sentence to several parts by PSG.

First, the sentence will be taken apart to two V Psaccording to the verbs "Turn on" and "go to". Second, the V Psare taken apart to several segments. (Table 3.3)

3.2 Definition of Task

We define a task including three slots, as Cx, bxi and Dx. A task would represent an imperative machine control command, including the elements we define before. The user's sentence would be transformed through semantics parsing, and the task generator, we introduce in next section, would generate the task with the result.

A task should include Cxor bxi at least, for example , a Cx could compose a task. The composition of a task is limited for three elements, but the number of bxi and Dxis not limited.

A task would include more than one behavior (bx), for an example, task = {

tv,turn on,go to the channel 36,bedroom}. The mentioned task means the operated device tv would receive more than one command, as turn on and go to channel 36.

But, the situation about missing information would happen unexpectedly, for an example, task = {tv,bedroom}. The mentioned task is lack of behaviors, the sub-model in Section 3.3 could analysis the task, and deal with the missing information in the task.

3.3 Block Diagram

Abbreviation In the section we discuss out block diagram in REM, and the architecture of the model we proposed is according to OAA [2]. All sub-models in the model are agents that be responsible for different function based on the theory of distributed agents. So, every agent is responsible for of the task. Here is the block diagram, as shown in Figure. 3.2.

We would introduce function of the sub-models in REM, and flow chart of the sub-models.

Component Sub-model The facilitator receives the tagged word and dispatching a part of the task to the suitable agent according to the label. The tagged words as information of the

Task Generator

component including descriptions are stored in memory, and the facilitator sends the words to the component sub-model. The component sub-model fills actual command in instruction file.

There is a component mapping table to support component sub-model mapped the user's command to actual instruction. The component sub-model can handle the unknown device according to some rules. For example, if we want to add a new TV in system, the NLTK can identify the word "TV" and the word "TV" has a device type code, then the component sub-model can update the component mapping table. The component sub-model will analysis the description of the device ,including the location and some additional feature of device. The description help the component sub-model find the exact device. For example, there are more than one TV in the house but in different room, as bedroom or living room. The component sub-model would find the exact device according to description in user's command. And all

descriptions of device still have mapping code of actual instruction in the component mapping table.

Behavior Sub-model The tagged words as instructions of the device will be stored in memory, and the facilitator sends the words to behavior sub-model. The behavior sub-model fills actual command in instruction file. There still is a behavior mapping table to support the behavior sub-model mapped the user's commands to actual instructions. The behavior

sub-model can identify the whether user's command is suitable for device or not. For example, we can't let TV dry clothes, because the command "Dry" should belong to washer. And the behavior sub-model fills a set of instructions in command file in order according to the sequence of user's command. The behavior sub-model also can build some relationship between new behavior and device.

Missing Information Sub-model The missing information sub-model handles the lack of the user's command. There are several possible scenarios. First, all information of user

command is integral, the missing information sub-model will not do anything. Second, there is lack of information, the missing information sub-model adds some instruction based on user preference. Because the user preference includes location and costumed set of user.

The missing information sub-model can find the exact device with the location of user if user did not give the completed information of device. For example, user is in the bedroom and user want to turn on the TV in the room. But the user may just say "Turn on the TV". The missing information sub-model will find the TV in the bedroom according to the location of user.

And we design the mapping table with relationship between bxi and Cxi.

Component Mapping Table The component mapping table helps component sub-model fill the actual instruction in command file. We design the component mapping table with three columns. device ID location ID feature ID

The first is device type with two fences, the second is location with two fences and the last is feature with four fences. The feature column can be costumed by user or programmer.

For example, the feature column can be the brand of device,color of device or more details of device, even be combination of brand and color. The component sub-model should maintain the mapping table. As mentioned above, the component sub-model updates the mapping table by some logical rules.

Behaviour Mapping Table The behavior mapping table will help behavior sub-model fill the actual instruction in instruction file. The behavior mapping table has three columns.

device ID state ID parameter weight

The first is device type with two fences, the second is state of device with two fences and the last is parameter with four fences. The parameter column is the follow-up parameters of the user command. The last column is weight of the device, based on the users trends.

For example, the user may watch the channel 73. The TV will receive the instruction of changing channel and the number 73 is the follow-up parameter of the command. The weight of TV would increase when the task include the Cx TV.

The behavior sub-model should maintain the mapping table. As mentioned above, the behavior sub-model updates the mapping table by some logical rules.

In fact, the three sub-models can handle most scenery in missing information of tasks. And we add some user information in system to enhance the usability of the proposed sub-models.

3.4 Flow Chart

Flow Chart We apply finite state machine to major flow with the task generator determines determining weather the Cx, Dxand bxi in the sentence or not, and with the missing

information sub-model, behavior sub-model and component sub-model, as show in Figure. 3.3 The notation [!] means the element is non-existent in sentence.

At first, we check Cx and Dx whether in sentence, and then check the bxi. If there is not any Cx , Dx or bxiin sentence, the Behavior sub-model and the comPonent sub-model handle the lack of information. If user provides complete information in sentence, the Missing Information Sub-model handle the new elements.

Cx,Dx,

Overview As mentioned component, there is a overview of the dialogue flow that composed by those components, as Figure. 3.4. At beginning, the Natural Language ToolKit decomposes the sentence to several parts and give the words simple tags. And the task generator stores the useful words by the mentioned tags by some string manipulation. The component sub-model, the behavior sub-model and the missing information sub-model process respective task

synchronously. The component sub-model and the behavior sub-model find the corresponding command form the mapping tables. Updating the mapping table is for the behavior sub-model and the task generator. The missing information sub-model add missing information in

command file according to user profile preference.

Task Generator A flow of task generator is Figure. 3.5 Then there is the task generator inspects whether a new device Cxin user command. The purpose of task generator is to generate a task. At first, task generator checks he device Cxwhether in dataset. If there is a new device, the task generator will register the device in dataset. There is a logical rule to add new device. For example, if the last device type id is 1000 and the new device type will be 1001.

Another function of task generator is checking if the behavior bxi and Dxis in user command. But the task generator does not update the behavior mapping table.

Component Sub-model There is a flow of the component sub-model as show in Figure. 3.6.

The component sub-model checks whether the device Cxand the description of the device Dx is in user command. If there is no device Cx, component sub-model will ignore the device type column in command file. And then, the component sub-model examines the description Dx

weather is in the dataset. If there are new descriptions, the component sub-model registers the new description in dataset. There still is a logical rule to add new description of device. If

Figure 3.4: Overview

there is no description of device Dx, the component sub-model still ignores the device description column in command file.

Pseudo Code

Step 1 : input Cx and Dx

Step 2 : if Cx exists in component mapping table Cx → command file

else break

Step 3 : if Dx exist in component mapping table then if device column = Cx

Dx → command file else Cx → device column else

Dx → component mapping table

Behavior Sub-model There is a flow of the behavior sub-model as show in Figure. 3.7. At first, the behavior sub-model still checks the behavior of device bxiwhether is in dataset. If there is a new behaviur, the behavior sub-model registers the new behavior of device in dataset. And the behavior sub-model sets the device type column in the behavior bxi and fills the behavior bxiin command file.

On the other hand, if there is an old behavior, the behavior sub-model must check the flag FN ewC. If the flag is 1, the behavior sub-model would tag the behavior bxi to the corresponding device Cx. Behaviour sub-model judges whether the behavior from user command is logical for device Cx. If the behavior bxiis logical, behavior sub-model fills bxi in command file according to behavior mapping table. The behaviour sub-model ignores the bxi in user command, if the behaviorbxi is not logical.

Pseudo Code

Step 1 : input bx and Cx

Step 2 : if bx exists in behavior mapping table if device column = NULL

bx → behavior mapping table Cx → behavior mapping table

Missing Information Sub-model There is a flow of the missing information sub-model as show in Figure. 3.8. At first, the missing information sub-model checks the user command. If there is not device Cxin user command, the missing information sub-model fills device type ID in command file according to type ID column behavior bxi from behavior mapping table.

Then missing information sub-model examines the location in user command. If there is no location information in user command, the missing information sub-model gets location information from user profile preference. And the missing information sub-model also examines the feature information in user command, as adjective, brand information or other information describes the device Cx. But the feature information is not necessary.

Pseudo Code

3.5 Infer missing information

The mapping table would be solution for how to infer the missing information. By the relationship between Cx and bx, the behavior sub-model would infer the corresponding behaviors for the device. And so does the missing information sub-model.

The sub-models with inferring function still deduce the wrong solution, because the faulty mapping table. But by the weight column, the sub-models would refine the mapping table.

The probability of inferring the wrong solution would decrease, by refining the weight over and over.

3.6 Summary

We introduce the definition and form of tasks included notations to express users'

commands. We still defined the two mapping tables, and make a description of the sub-models in function and flowchart.

For different elements in a task, we design the corresponding sub-models to deal with different sceneries. The sub-models would check the elements in a task and missing information, and do the actions for different sceneries.

CxC { }Cx

C C  Cx

bx

Figure 3.5:Task Generator

Cx

Cx

Cx

Figure 3.6: Component Manager

b

xi

x x { }bxi

  

bxi

Cx

bxib

x

bxi

b

xi

b

xi

b

xi

b

xi

bxi

Cx

Figure 3.7:Behavior Manager

Start

Chapter 4 Implementation

In the chapter we will discuss our implementations of REM based on our proposed model.

4.1 Environment

We divide into two parts to explain how we implement. One is hardware, the other is software included the tools we applied to.

4.1.1 Hardware

In hardware, the CPU is Intel C2D E7500, it's a dual-core CPU. The RAM is 2048 MB.

And we use keyboard as input, and the output is monitor. In fact, a single-core CPU still satisfies the demand of our model.

There is a list about the hardware. (Table 4.1)

4.1.2 Software

For general environment,all tools we applied work normally on Windows XP. We have to simulate Windows XP with virtual machine. So we use VMware 3.0.1 to construct Windows

Table 4.1: Hardware List CPU Intel C2D E7500

RAM 2048MB

Input Keyboard output Monitor

Table 4.2:

XP. And the host operated system is Windows 7

The program editor is eclipse and its version is Helios Service Release 2. But there is no C/C++ compiler in eclipse. Before writing the program, we must install the compiler gcc.

At first, the program language of Natural Language ToolKit (NLTK) with distributions for Windows, Mac OSX and Linux is Python . So, we have to write a simple program to apply NLTK. The version of Python is 2.6 . To use the NLTK library,we need to import the head file. And the version of OAA library is 2.3.2 since June, 2007 .

The main program language we applied to complete all components is C++.

4.2 Open Agent Architecture

We would introduce the OAA in this section. We have to introduce the concept of agents at first. And then we would dig in OAA.

4.2.1 Agent-Based Model

Agent-based model is based on Artificial Intelligence (AI) and focus on dialogue system as cooperation between intelligent agents. All of these approaches for agents do focus on

"Goal" , "Solution" and "Event". "Event" means the user's request, "Goal" is the expected action for user's request and "Solution" is the actual action for user's request.

When the agents what are build-in dialogue system receive "Event", the agents would find

"Solution" and send "Goal" to another agent or user. There are not only one "Solution" for a

"Event" , and the "Solution" will change according to some parameters.

In agent-based model shows as Figure. 4.1, a small black point represents a agent with some function. The gray ellipse is the external environment, and the other ellipses in the big gray ellipse are perceived by agents. A agent is responsible for perceiving a small part of environment, that means function of agents is not strong. If there are two agents, one of them is in charge of handling what kind of home appliance user operates and the other one is responsible for searching which one to be operated.

Figure 4.1: Agent-Based Model

4.2.2 Structure of OAA

The OAA is shown as Figure. 4.2. The main component in OAA is facilitator, being responsible for distributing the task to the specified agent. All agents must register their solutions in facilitator, or the facilitator would not pass the task the the agent without

registering. The Interagent Communication Language (ICL) developed by SRI is the form of communication between agetns and he facilitator.

In 1996, the Agent Development Toolkit (ADT) [21] is proposed as a IDE. And the OAA is wide range to be applied. As Section 2 mentioned, the MIMUS applied the OAA in its architecture.

Figure 4.2: Open Agent Architecture

4.3 Structure of Proposed Mode with OAA

We introduce the structure of our model with the hybrid approach, as shown Figure 4.3.

As mentioned in Section 3, the NLP would analysis the sentence from the user. The task generator extracts the tagged word from the result form the NLP. The facilitator would pass the tagged word to the appropriate manager.

At first, we have to launch the facilitator, and we launch the component manager and the behavior manager, as shown Figure 4.4 The behavior manager registers its function in

facilitator.

There are two managers invoked in runtime. as shown Figure 4.5. Obviously, the

Figure 4.3:Structure of Proposed Model with OAA

facilitator accepts the requests of registering from the two managers.

4.4 summary

In summary, we introduce the hardware and software environment in our design We introduce the architecture of Open Agent Architecture (OAA),and how we use the structure of OAA to design and implement REM in mentioned environment.

Figure 4.4:Facilitator with One Manager

Figure 4.5: Facilitator with Two Managers

Chapter 5 Analysis

In this chapter, we would introduce the actions of REM in four case. In Section 5.2, we discuss the effect of REM in the dialogue manager with different approach.

5.1 Case Study

According the task we defined before, we list several situations about the missing information of the task. we would continue using the notation Cx, bxand Dxto composed a task.

We denote the verbs to bxi and nouns to Cxbased on our model. We list all possible cases.

I. Task with Cx II. Task without Cx

III. Task with bx IV. Task without bx

There is a table as show (Table 5.1)

We follow the definition of degree of complexity allocated to each task.[17] A simple task includes only one bxi, a complex task requires more than one bxi. On the other hand, the task what remembered the previous information is complex, as referential relations.[22][23]

We follow the definition of degree of complexity allocated to each task.[17] A simple task includes only one bxi, a complex task requires more than one bxi. On the other hand, the task what remembered the previous information is complex, as referential relations.[22][23]

相關文件