Sanjeev Verma

                                                                                                                        LING 306

                                                                                                                        Final Project

 

Web-based Cognitive Network Modeler

 

Overview

This program is a Java applet that draws cognitive network segments and simulates the passing of activation through from high-level concepts to low-level constructs such as phonemes.  The network segment is constructed by passing arguments to the applet that describe the structure of the segment.  Once the applet is loaded, the user can edit the layout of the model or simulate activation.  The instructions for interacting with and creating network segments are contained in the next two sections.

 

User Interface

The user interface consists of three parts (from top to bottom): the output display, the network diagram, and the control bar.

The output display shows the text generated by the network. For example, if the network is constructing the word “went”, the output bar will display ‘w’, ‘we’, ‘wen’, and ‘went’ as each part is activated.

The network diagram shows the network segment in graphical form.  The nodes that are represented are ordered and, unordered and, ordered or, unordered or, empty, text, and phoneme.  The and, or, and empty nodes are colored black, and function exactly as in the textbook.  Text nodes are colored blue and represent the top level of the diagram.  Phonemes are colored green and represent the bottom level.  Note that phoneme nodes do not always have to represent phonemes—they are simply the lowest level of the network segment.  The contents of the output window is drawn from these low-level nodes.  All nodes turn red when activated.

Nodes are connected by edges, which are simply black lines.  Edges may have labels (if they represent a nection that can be named); this name is drawn to the side as in the textbook.  Edges also turn red when activated.

The control bar contains several buttons and check boxes that allow the user to interact with the modeler.  The “Pass Activation” and “Clear Activation” buttons are fairly self-explanatory—they pass activation one step and clear all active nodes, respectively.  The “Print” button outputs a textual representation to the Java Console.  The use of this will be explained later.

The two check boxes allow the user to choose how they want the diagram to respond to their mouse actions.  By default, no mode is chosen—the diagram does nothing when clicked.  “Edit Mode” allows the user to drag nodes around the display window to rearrange the graph.  When in “Activate Mode”, the user can click on a node to activate it.  The user can only activate top-level or bottom-level nodes—ands and ors can only be activated by clicking the “Pass Activation” button.  Note that “Activate Mode” and “Edit Mode” can both be selected, which causes both actions to happen when a node is clicked.

 

HTML Interface

The applet is initialized by including a statement like the following in HTML code:

<applet codebase="." code="Graph.class" width=600 height=600>

      <param name=nodes value=nodes description>

      <param name=edges value=edges description>

</applet>

The width and height arguments specify the window size of the applet.

The nodes parameter specifies the structure of each node.  It is a list of nodes separated by commas and enclosed in double quotes: node1,node2,node3.  Each node takes the following form: type:name[(location)].  Type is one of the following:

Type

Description

 

Type

Description

toplevel

Top-level concept

 

duo

Downward unordered or

phoneme

Low-level phoneme

 

doo

Downward ordered or

empty

Empty realization

 

uua

Upward unordered and

text

A simple text box

 

uoa

Upward ordered and

uuo

Upward unordered or

 

dua

Downward unordered and

uoo

Upward ordered or

 

doa

Downward ordered and

Name is simply a string that will be used to identify the node later.  Location is optional; it is a pair of numbers that specifies the x- and y-coordinates of the node on in the display window.  The nodes can be listed in any order with the exception of phoneme nodes.  They must be input in the order that the output is to be displayed.  For example, if the network segment is to spell “went”, the phoneme nodes must be listed in the order ‘w’, ‘e’, ‘n’, ‘t’.

The edges parameter tells the applet how to connect the nodes.  It is a list of edges separated by commas and enclosed in double quotes: edge1,edge2,edge3.  Each edge is of the form name1->name2[:label].  Name1 and name2 are the names of the ‘from’ node and the ‘to’ node, respectively—the edge goes from name1 to name2.  Label is optional; it is simply text that will be displayed next to the edge.  For unordered nodes, the order in which their edges are listed is unimportant.  For ordered nodes, however, edges will be connected in the order that they are listed.  For ordered ors, the default connection should be listed before the optional connection.

A word on positioning: it is difficult to guess the correct coordinates for each node when first inputting a network segment.  If the coordinates are left off, the applet will assign them randomly.  This creates a jumble on the screen, but the nodes can be rearranged using “Edit Mode”.  Once the nodes are arranged correctly, the user can click the “Print” button to output the structure (including the current coordinates) to the Java Console.  From there, the user can copy the string into their HTML and the network diagram will be correctly constructed thereafter.