Difference between revisions of "How to Play In"

From WeizmannWiki
Jump to: navigation, search
(System model play-in)
(System model play-in)
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
== Basic play-in ==
 +
 +
To use [[Language & Concepts#Play-In|Basic play-in]], click the 'Basic Play-In' button.<br/>[[File:NL.play-in.start.png|800px|NL.play-in.start.png]]
 +
 +
Consequently, the play-in session starts. If a GUI exists it is launched, from which you can start play-in:
 +
 +
*Clicking an object in the GUI creates a diagram snippet reflecting the click.<br>
 +
*Use the Play-In toolbar to control some of the play-in operations, such as applying modality (hot/cold, monitor/execute):<br/>[[File:Playin.toolbar1.JPG|800px|Playin.toolbar1.JPG]]
 +
<br>
 +
*Once created, LSC construct properties can be modified via the properties view and the right-click menu:<br/>[[File:Properties.view.rightClickMenu.png|800px|Properties.view.rightClickMenu.png]]
 +
 
== Natural language play-in  ==
 
== Natural language play-in  ==
  
With [[PlayGo Feature List#Natural_language_play-in|natural language (NL) play-in]], you can write scenarios in natural language. For example, "When the user clicks the button, the light state turns to on". NL play-in then creates an LSC for this scenario, and inserts the corresponding entities into the [[Language & Concepts#System_Model|System Model]], if they are not there yet.  
+
With [[PlayGo Feature List#Natural_language_play-in| natural language (NL) play-in]], you can write scenarios in controlled natural language. For example, "When the user clicks the button, the light state turns to on". NL play-in then creates an LSC for this scenario, and inserts the corresponding entities into the [[Language & Concepts#System_Model|System Model]], if they are not there yet.
  
 
<br>[[Image:NL.sentence.png]]<br> <span style="color: rgb(0,0,255);"><span style="font-family: Tahoma;">NL play-in: the underlined words in the NL sentence entered by the user are translated into the LSC chart and the appropriate System Model entities.
 
<br>[[Image:NL.sentence.png]]<br> <span style="color: rgb(0,0,255);"><span style="font-family: Tahoma;">NL play-in: the underlined words in the NL sentence entered by the user are translated into the LSC chart and the appropriate System Model entities.
</span></span> <br><br>  
+
</span></span> <br><br>
  
The scenarios specified in NL have to conform to the following rules:  
+
=== NL Rules ===
 +
The scenarios specified in controlled NL have to conform to the following rules:
  
#A scenario must contain exactly one sentence.  
+
#A scenario must contain exactly one sentence.
#The sentence should contain a clear subject, verb, object and possibly adjective.These are translated into LSC constructs, such as lifelines, messages, properties and property values.  
+
#The sentence should contain a clear subject, verb, object and possibly adjective.These are translated into LSC constructs, such as lifelines, messages, properties and property values.
#Delimiters, like a comma, or words like 'then' or 'and' after each part of the sentence are important and must be included. For example:  
+
#Delimiters, like a comma, or words like 'then' or 'and' after each part of the sentence are important and must be included. For example:
##"when the user clicks the button''',''' the display text changes to Hello"  
+
##"when the user clicks the button''',''' the display text changes to Hello"
##"when the user clicks the button '''then''' the display text changes to Hello"  
+
##"when the user clicks the button '''then''' the display text changes to Hello"
#Values that are composed from more than one word should appear in double quotes. Single word values can appear without quotes. For example:  
+
#Values that are composed from more than one word should appear in double quotes. Single word values can appear without quotes. For example:
##"when the user clicks the button, the display mode changes to '''alarm'''"  
+
##"when the user clicks the button, the display mode changes to '''alarm'''"
##"when the user clicks the button, if the display mode is '''"alarm"''', the display mode changes to '''"alarm minutes"&nbsp;'''"  
+
##"when the user clicks the button, if the display mode is '''"alarm"''', the display mode changes to '''"alarm minutes"&nbsp;'''"
#Objects and methods cannot consist of more than one word (double quotes will not help here). By default, nouns are understood as objects, and verbs as methods. If there is other information from the system model, it will be integrated (e.g., if there is an object named 'walk', it can be understood as a noun or a verb). Also, non-words are by default nouns and are understood as objects or values. To use a non-word as a different construct, right click the word and set it using the right click menu. In the following example 'ReduceTemp' is not a noun, but rather a method. For the parse to recognize it, right click it, and set it to 'method'.  
+
#Objects and methods cannot consist of more than one word (double quotes will not help here). By default, nouns are understood as objects, and verbs as methods. If there is other information from the system model, it will be integrated (e.g., if there is an object named 'walk', it can be understood as a noun or a verb). Also, non-words are by default nouns and are understood as objects or values. To use a non-word as a different construct, right click the word and set it using the right click menu. In the following example 'ReduceTemp' is not a noun, but rather a method. For the parse to recognize it, right click it, and set it to 'method'.
##"when the user clicks the button, the manager '''ReduceTemp."'''  
+
##"when the user clicks the button, the manager '''ReduceTemp."'''
#Property values can be of type String, Integer or Boolean, and are inferred either automatically or by the programmer using the [[#Quick_Fix_Mechanism|quick fix]] mechanism.  
+
#Property values can be of type String, Integer or Boolean, and are inferred either automatically or by the programmer using the [[#Quick_Fix_Mechanism|quick fix]] mechanism.
#To refer to a specific object, use 'the'. To refer to a non-specific object, use 'a' or 'any'. For example:  
+
#To refer to a specific object, use 'the'. To refer to a non-specific object, use 'a' or 'any'. For example:
##"when the user clicks '''the''' A_button, the display text changes to "Button A was clicked" ". This will create a static object 'A_button'.  
+
##"when the user clicks '''the''' A_button, the display text changes to "Button A was clicked" ". This will create a static object 'A_button'.
##"when the user clicks '''a''' button, the button state changes to on". This will create a dynamic object 'button' that will bind at run time when clicked.  
+
##"when the user clicks '''a''' button, the button state changes to on". This will create a dynamic object 'button' that will bind at run time when clicked.
#If the NL refers to an object that already appears in the system model, the exact name of the object should be used, as it appears in the system model.  
+
#If the NL refers to an object that already appears in the system model, the exact name of the object should be used, as it appears in the system model.
#Two basic phrases that add LSC constructs are a property change of an object and a method call.  
+
#Two basic phrases that add LSC constructs are a property change of an object and a method call.
##A sentence that describes a property that changes should include the &lt;object name&gt;, the &lt;property name&gt; and optionally the &lt;new value&gt;. For example:  
+
##A sentence that describes a property that changes should include the &lt;object name&gt;, the &lt;property name&gt; and optionally the &lt;new value&gt;. For example:
###"when ..., the light state changes to on" &nbsp;(light.state = on).  
+
###"when ..., the light state changes to on" &nbsp;(light.state = on).
###"when ..., the display color changes to the selection color" (display.color = selection.color).  
+
###"when ..., the display color changes to the selection color" (display.color = selection.color).
###"when the light state changes, the ..." (the trigger is a change of the value to anything. light.state = *).&nbsp;  
+
###"when the light state changes, the ..." (the trigger is a change of the value to anything. light.state = *).&nbsp;
###A bad example is: "when ..., the light turns on", since "turns" is not recognized as a method. However, setting "turns" explicitly as a method, will make this sentence work, but it will generate a method call, e.g., light.turns(on), rather than the change of a property.  
+
###A bad example is: "when ..., the light turns on", since "turns" is not recognized as a method. However, setting "turns" explicitly as a method, will make this sentence work, but it will generate a method call, e.g., light.turns(on), rather than the change of a property.
##A sentence that describes a method call should include the &lt;object name&gt; and the &lt;method call&gt;. For example:  
+
##A sentence that describes a method call should include the &lt;object name&gt; and the &lt;method call&gt;. For example:
###"when ..., the panel locks" (panel.lock()).  
+
###"when ..., the panel locks" (panel.lock()).
###"when the user clicks the button, ..." (button.click() triggered by the User source object).  
+
###"when the user clicks the button, ..." (button.click() triggered by the User source object).
###"when the dispenser makes tea, ..." (dispenser.make(tea)).  
+
###"when the dispenser makes tea, ..." (dispenser.make(tea)).
 
###A bad example is: "the heater temperature increases", since the heater.temperature is a property and cannot call the increase method.
 
###A bad example is: "the heater temperature increases", since the heater.temperature is a property and cannot call the increase method.
  
<br>  
+
<br>
  
To use [[PlayGo Feature List#Natural_language_play-in|NL play-in]], [[Create an LSC project|create an LSC project]], or select an existing one, and click the 'NL Play-In' button.<br><br> [[Image:NL.play-in.start.png|800px]]<br><br>  
+
=== Interactive NL-Play-In Interface ===
 +
To use [[PlayGo Feature List#Natural_language_play-in|NL play-in]], [[Create an LSC project|create an LSC project]], or select an existing one, and click the 'NL Play-In' button.<br><br> [[Image:NL.play-in.start.png|800px]]<br><br>
  
This will cause the play-in session to start, and the 'NL Play-In' view will open. To play in, enter LSC name and the requirement: <br>[[Image:NL.play-in.view.overview.png|800px]]  
+
This will cause the play-in session to start, and the 'NL Play-In' view will open. To play in, enter the LSC name and the requirement: <br>[[Image:NL.play-in.view.overview.png|800px]]
  
*'''LSC Name''' - the name of the LSC currently being played in.  
+
*'''LSC Name''' - the name of the LSC currently being played in.
*'''Requirement Text''' - the NL sentence defining the LSC.  
+
*'''Requirement Text''' - the NL sentence defining the LSC.
*'''Add LSC''' - click this button to create the LSC when the requirement is complete.  
+
*'''Add LSC''' - click this button to create the LSC when the requirement is complete.
*'''Online Parsing''' - this is a toggle button. When selected the text is parsed after each space entered. Otherwise, the text is parsed only when pressing Enter.  
+
*'''Online Parsing''' - this is a toggle button. When selected the text is parsed after each space entered. Otherwise, the text is parsed only when pressing Enter.
 
*'''Interact Enabled''' - this is a toggle button. When selected, interaction with the application GUI is interpreted as an NL snippet&nbsp;by the Show &amp; Tell play-in module.
 
*'''Interact Enabled''' - this is a toggle button. When selected, interaction with the application GUI is interpreted as an NL snippet&nbsp;by the Show &amp; Tell play-in module.
  
<br>  
+
<br>
  
=== Quick fix mechanism  ===
+
==== Quick fix mechanism  ====
  
When NL play-in identifies problems in the requirement text, it activates a quick fix mechanism to mark them using a squiggly line and to prompt the user to fix them.&nbsp;  
+
When NL play-in identifies problems in the requirement text, it activates a quick fix mechanism to mark them using a squiggly line and to prompt the user to fix them.&nbsp;
  
A <font color="green">'''Green'''</font> squiggly line indicates a model warning or missing information. In some cases NL assigns defaults when information is missing. <br><br> [[Image:NL.model.error.png|800px]] <br><br>  
+
A <font color="green">'''green'''</font> squiggly line indicates a model warning or missing information. In some cases NL assigns defaults when information is missing. <br><br> [[Image:NL.model.error.png|800px]] <br><br>
  
To get more information on the error, hover over the underlined words with the mouse and a quickfix box will appear, describing the problem and offering possible solutions when they exist.  
+
To get more information on the error, hover over the underlined words with the mouse and a quickfix box will appear, describing the problem and offering possible solutions when they exist.
  
To select a solution, click on it and it will take effect:<br> [[Image:NL.model.error.quickFix.png|800px]] <br><br>  
+
To select a solution, click on it and it will take effect:<br> [[Image:NL.model.error.quickFix.png|800px]] <br><br>
  
A <font color="red">'''Red'''</font> squiggly line indicates an ambiguity, i.e., that there is more than one possible parse for the sentence. The user should disambiguate by selecting one of the offered possibilities. The selection can obviously have a significant effect on the created LSC. <br> <br> [[Image:NL.ambiguity.error.png|800px]]<br>  
+
A <font color="red">'''red'''</font> squiggly line indicates an ambiguity; i.e., that there is more than one possible parse for the sentence. The user should disambiguate by selecting one of the offered possibilities. The selection can obviously have a significant effect on the created LSC. <br> <br> [[Image:NL.ambiguity.error.png|800px]]<br>
  
To get more information about the error, hover over the underlined words with the mouse and a quickfix box will appear describing the problem and offering possible solutions when they exist.  
+
To get more information about the error, hover over the underlined words with the mouse and a quickfix box will appear, describing the problem and offering possible solutions when they exist.
  
To select a solution, click on it and it will take effect. If no solution appears, or if you would like a different option from those appearing in the menu, edit the text to fix it yourself:<br>  
+
To select a solution, click on it and it will take effect. If no solution appears, or if you would like a different option from those appearing in the menu, edit the text to fix it yourself:<br>
  
[[Image:Playin.view.ambigous.png|800px]]<span style="line-height: 1.5em;">&nbsp;</span><br><br>  
+
[[Image:Playin.view.ambigous.png|800px]]<span style="line-height: 1.5em;">&nbsp;</span><br><br>
  
A '''Black''' squiggly line indicates a grammatical error, which must be fixed before continuing. In most cases, this involves incorrect grammar, a missing determinant, or words that are misspelled or not-recognized. No spell checking is applied in the current implementation. In the example below, the error is caused by the unrecognized word "doubleClicks": <br><br> [[Image:NL.grammer.error.png|800px]]<br><br>  
+
A '''black''' squiggly line indicates a grammatical error, which must be fixed before continuing. In most cases, this involves incorrect grammar, a missing determinant, or words that are misspelled or not-recognized. No spell checking is applied in the current implementation. In the example below, the error is caused by the unrecognized word "doubleClicks": <br><br> [[Image:NL.grammer.error.png|800px]]<br><br>
  
To fix a grammatical error, look for the missing determinant and correct the sentence. In case of an unrecognized word, select the word by double-clicking it, then right-click it and select the relevant alternative to define and insert the word into the system model as an object, property, method or value: <br><br> [[Image:NL.grammer.error.quickFix.png|800px]]<br><br>  
+
To fix a grammatical error, look for the missing determinant and correct the sentence. In case of an unrecognized word, select the word by double-clicking it, then right-click it and select the relevant alternative to define and insert the word into the system model as an object, property, method or value: <br><br> [[Image:NL.grammer.error.quickFix.png|800px]]<br><br>
  
Once the errors are fixed, you can create the LSC by pressing ENTER, or by clicking the [[Image:NL.plus.jpg]] button at the view toolbar:  
+
Once the errors are fixed, you can create the LSC by pressing ENTER, or by clicking the [[Image:NL.plus.jpg]] button at the view toolbar:
  
[[Image:NL.play-in.view+.png]]<br>  
+
[[Image:NL.play-in.view+.png]]<br>
  
<br> Examples of requirements written in natural language, can be found [http://www.weizmann.ac.il/mediawiki/playgo/index.php/Wristwatch_Example here].
+
=== Statistical NL-Play-In Interface ===
  
== Basic play-in ==
+
In case you have a complete textual requirements document, the process of interactive NL play-in may be time consuming and tedious. Instead, PlayGo allows you to import a complete requirements document and transform it into LSCs in batch. Each sentence will be transform into a single LSC. Disambiguation decisions are made using a statistical model that is trained on previously analysed requirement documents. The statistical model is optimized based on two sources of information:
 +
*content information, i.e., the grammatical structure and lexical items used in individual requirements.
 +
*context information, i.e., the coherence of the model expressed in the complete document, as a whole.
 +
<br>
 +
The requirements document has to adhere to the following rules:
 +
*Each line contains a single sentence.
 +
*Each sentence expresses a single requirement / scenario.
 +
*All sentences obey the same grammar restrictions as in the interactive NL play-in.
 +
*The file should have the suffix '''.desc'''.
  
To use [[Language & Concepts#Play-In|Basic play-in]], click the 'Basic Play-In' button.<br> [[Image:NL.play-in.start.png|800px]]<br><br>
+
==== Uploading a requirements document ====
  
Consequently, the play-in session starts. If a GUI exists it is launched, from which you can start play-in:
+
In order to upload a requirements document follow these steps:
  
*Clicking an object in the GUI creates a diagram snippet reflecting the click.
+
#Create a textual requirements document &lt;filename&gt;.desc that adheres to the format specified above. Locate the file in your [[Getting Started with PlayGo#Create your First LSC Project|LSC project]].
*Use the Play-In toolbar to control some of the play-in operations, such as applying modality (hot/cold, monitor/execute):<br>[[Image:Playin.toolbar1.JPG|800px]]
+
#Right-click the &lt;filename&gt;.desc file and select 'Import Description'.&nbsp;
 +
#A &lt;filename&gt;.lsc files has been created under the same directory, containing a sequence of LSCs, each of which corresponds to one of the textual requirements. A system model for the entire system is created automatically.
 +
##In case a <filename>.lsc file already exists in the same directory, you will be asked whether to override its contents.
  
<br>
+
==== Tuning the statistical model ====
  
*Insert new LSC elements, such as new LSC, new Instance, Assertion, Assignment etc…<br>[[Image:Playin.toolbar2.JPG|800px]]
+
The statistical model that is used for parsing requirements document may be tuned using the LSC project properties:
  
<br>
+
#Right-click the LSC project, and select Properties->PlayGo->Play-in.
 +
#Select the StatisticalNL tab and choose a statistical grammar file:<br/>[[File:Properties.playin.statisticalNL.png]]<br/><br>
 +
#Select one of the two parsing modes:
 +
##Without context; i.e., applying the parser in a sentence-by-sentence mode.
 +
##With context; i.e., applying the parser for parsing a complete requirements document.
 +
###In case the "with context" option was selected, you can pre-define how many parse-candidates the model considers via the 'Number of candidates per requirements' box.<br/>NOTE: The number of candidates represents a tradeoff between system accuracy and parse time. The more candidates the model is allowed to consider, the higher the accuracy of the parser. However, if the number of candidates per sentence is too high, parsing performance may be negatively affected. A complete empirical investigation of this tradeoff may be found in <ref> R. Tsarfaty, E. Pogrebezky, G. Weiss, Y. Natan, S. Szekely and D. Harel, "Semantic Parsing Using Content and Context: A Case Study from Requirements Elicitation", Proc. Int. Conf. on Empirical Methods in Natural Language Processing (EMNLP), to appear, 2014.</ref>.
 +
#Click 'OK'.
  
*You may want to carry out operations on the GUI without affecting the LSC (e.g., for restoring the GUI to a state from which you want to play in). To do this, press the 'Ignore GUI Play-In' button, next to the 'Play-In Mode' drop-down button, and carry out the required operation. Once done, press the 'Ignore GUI Play-In' button again, to release it (in which case GUI operations will no longer be ignored):<br> [[Image:Playin.ignore.JPG|800px]]
+
The statistical parser uses a pre-trained grammar based on a set of manually annotated requirements. Accuracy of the statistical parser may improve if you add more training examples for the statistical model. If you have a set of LSC examples that you would like to use for re-training the statistical parser, you can do so using the 'Train' button.
  
<br>
+
See also [[How to train a model for statistical play-in]].
  
*Once created, LSC construct properties can be modified via the properties view and the right-click menu:<br> [[Image:Properties.view.rightClickMenu.png|800px]]
+
=== Learn from Examples ===
  
<br>
+
Examples of requirements written in natural language, can be found here:
  
 +
- [http://wiki.weizmann.ac.il/playgo/index.php/Wristwatch_Example Wristwatch].
 +
 +
- [http://wiki.weizmann.ac.il/playgo/index.php/Phone_Specification Phone].
 +
 +
- [http://wiki.weizmann.ac.il/playgo/index.php/Baby_Monitor_Specification Baby Monitor].
 +
 +
== Show &amp; Tell play-in  ==
 +
 +
To use [[PlayGo Feature List#Show_.26_tell_play-in|Show &amp; Tell play-in]], click the 'Show &amp; Tell Play-In' button.<br> [[Image:NL.play-in.start.png|800px]]<br><br>
 +
 +
Consequently, the play-in session starts. If a GUI exists it is launched. <br> The 'NL Play-In' view is opened with the 'Interact Enable' button selected, in order to allow interaction with the GUI: <br> [[Image:Show&Tell.png|800px]] <br><br> An interaction with the GUI (e.g., clicking a button) creates segment of NL text in the requirement text field of the 'NL Play-In' view.<br> If the interaction can be interpreted in more than one way, a squiggly line appears, indicating an error, and a quick fix dialog is displayed upon hovering. The error can be resolved using the quick fix dialog: <br>
 +
 +
[[Image:Show&tell.quickFix.png|800px]]<br><br> As in NL play-in, the LSC is created when pressing ENTER, or when clicking the [[Image:NL.plus.jpg]] button at the view toolbar.
 +
<br>
 
== System model play-in  ==
 
== System model play-in  ==
  
Line 116: Line 159:
 
*Note that you can play in from the system model also using the 'NL Play-In' and 'Show &amp; Tell Play-in' alternatives.
 
*Note that you can play in from the system model also using the 'NL Play-In' and 'Show &amp; Tell Play-in' alternatives.
  
=== Common operations  ===
+
==References==
 
+
<references/>
To add a message from the user to a system object, first make sure the 'Play-In Mode' is set to 'User'. Then, right-click a method of an object and select 'Call Message'. If the message requires input parameters, the [[Play-in view|'Play-In' view]] will open, prompting the user to add the required message parameters:<br>
+
 
+
[[Image:SystemModel.createMessage.fromUser.png|800px]] <br><br><br> To add a self message (from an object to itself), change the 'Play-In Mode' to 'System'. Then, right-click a method of an object and select 'Call Message'. If the message requires input parameters, the [[Play-in view|'Play-In' view]] will open, prompting the user to add the required message parameters:<br>
+
 
+
[[Image:Playin.systemmodel.png|800px]] <br><br><br> To add a message from one object to another, right-click the source object and select 'Call Other Object'. Then, right-click a method of the target object and select 'Call Message'. Once again, if the message requires input parameters, the [[Play-in view|'Play-In' view]] will open, prompting the user to add the required message parameters:
+
 
+
[[Image:Systemmodel.callotherobj.png|800px]] <br><br> [[Image:Systemmodel.createMessage.png|800px]] <br><br>
+

Latest revision as of 07:53, 21 December 2015

Basic play-in

To use Basic play-in, click the 'Basic Play-In' button.
NL.play-in.start.png

Consequently, the play-in session starts. If a GUI exists it is launched, from which you can start play-in:

  • Clicking an object in the GUI creates a diagram snippet reflecting the click.
  • Use the Play-In toolbar to control some of the play-in operations, such as applying modality (hot/cold, monitor/execute):
    Playin.toolbar1.JPG


  • Once created, LSC construct properties can be modified via the properties view and the right-click menu:
    Properties.view.rightClickMenu.png

Natural language play-in

With natural language (NL) play-in, you can write scenarios in controlled natural language. For example, "When the user clicks the button, the light state turns to on". NL play-in then creates an LSC for this scenario, and inserts the corresponding entities into the System Model, if they are not there yet.


NL.sentence.png
NL play-in: the underlined words in the NL sentence entered by the user are translated into the LSC chart and the appropriate System Model entities.

NL Rules

The scenarios specified in controlled NL have to conform to the following rules:

  1. A scenario must contain exactly one sentence.
  2. The sentence should contain a clear subject, verb, object and possibly adjective.These are translated into LSC constructs, such as lifelines, messages, properties and property values.
  3. Delimiters, like a comma, or words like 'then' or 'and' after each part of the sentence are important and must be included. For example:
    1. "when the user clicks the button, the display text changes to Hello"
    2. "when the user clicks the button then the display text changes to Hello"
  4. Values that are composed from more than one word should appear in double quotes. Single word values can appear without quotes. For example:
    1. "when the user clicks the button, the display mode changes to alarm"
    2. "when the user clicks the button, if the display mode is "alarm", the display mode changes to "alarm minutes" "
  5. Objects and methods cannot consist of more than one word (double quotes will not help here). By default, nouns are understood as objects, and verbs as methods. If there is other information from the system model, it will be integrated (e.g., if there is an object named 'walk', it can be understood as a noun or a verb). Also, non-words are by default nouns and are understood as objects or values. To use a non-word as a different construct, right click the word and set it using the right click menu. In the following example 'ReduceTemp' is not a noun, but rather a method. For the parse to recognize it, right click it, and set it to 'method'.
    1. "when the user clicks the button, the manager ReduceTemp."
  6. Property values can be of type String, Integer or Boolean, and are inferred either automatically or by the programmer using the quick fix mechanism.
  7. To refer to a specific object, use 'the'. To refer to a non-specific object, use 'a' or 'any'. For example:
    1. "when the user clicks the A_button, the display text changes to "Button A was clicked" ". This will create a static object 'A_button'.
    2. "when the user clicks a button, the button state changes to on". This will create a dynamic object 'button' that will bind at run time when clicked.
  8. If the NL refers to an object that already appears in the system model, the exact name of the object should be used, as it appears in the system model.
  9. Two basic phrases that add LSC constructs are a property change of an object and a method call.
    1. A sentence that describes a property that changes should include the <object name>, the <property name> and optionally the <new value>. For example:
      1. "when ..., the light state changes to on"  (light.state = on).
      2. "when ..., the display color changes to the selection color" (display.color = selection.color).
      3. "when the light state changes, the ..." (the trigger is a change of the value to anything. light.state = *). 
      4. A bad example is: "when ..., the light turns on", since "turns" is not recognized as a method. However, setting "turns" explicitly as a method, will make this sentence work, but it will generate a method call, e.g., light.turns(on), rather than the change of a property.
    2. A sentence that describes a method call should include the <object name> and the <method call>. For example:
      1. "when ..., the panel locks" (panel.lock()).
      2. "when the user clicks the button, ..." (button.click() triggered by the User source object).
      3. "when the dispenser makes tea, ..." (dispenser.make(tea)).
      4. A bad example is: "the heater temperature increases", since the heater.temperature is a property and cannot call the increase method.


Interactive NL-Play-In Interface

To use NL play-in, create an LSC project, or select an existing one, and click the 'NL Play-In' button.

NL.play-in.start.png

This will cause the play-in session to start, and the 'NL Play-In' view will open. To play in, enter the LSC name and the requirement:
NL.play-in.view.overview.png

  • LSC Name - the name of the LSC currently being played in.
  • Requirement Text - the NL sentence defining the LSC.
  • Add LSC - click this button to create the LSC when the requirement is complete.
  • Online Parsing - this is a toggle button. When selected the text is parsed after each space entered. Otherwise, the text is parsed only when pressing Enter.
  • Interact Enabled - this is a toggle button. When selected, interaction with the application GUI is interpreted as an NL snippet by the Show & Tell play-in module.


Quick fix mechanism

When NL play-in identifies problems in the requirement text, it activates a quick fix mechanism to mark them using a squiggly line and to prompt the user to fix them. 

A green squiggly line indicates a model warning or missing information. In some cases NL assigns defaults when information is missing.

NL.model.error.png

To get more information on the error, hover over the underlined words with the mouse and a quickfix box will appear, describing the problem and offering possible solutions when they exist.

To select a solution, click on it and it will take effect:
NL.model.error.quickFix.png

A red squiggly line indicates an ambiguity; i.e., that there is more than one possible parse for the sentence. The user should disambiguate by selecting one of the offered possibilities. The selection can obviously have a significant effect on the created LSC.

NL.ambiguity.error.png

To get more information about the error, hover over the underlined words with the mouse and a quickfix box will appear, describing the problem and offering possible solutions when they exist.

To select a solution, click on it and it will take effect. If no solution appears, or if you would like a different option from those appearing in the menu, edit the text to fix it yourself:

Playin.view.ambigous.png 

A black squiggly line indicates a grammatical error, which must be fixed before continuing. In most cases, this involves incorrect grammar, a missing determinant, or words that are misspelled or not-recognized. No spell checking is applied in the current implementation. In the example below, the error is caused by the unrecognized word "doubleClicks":

NL.grammer.error.png

To fix a grammatical error, look for the missing determinant and correct the sentence. In case of an unrecognized word, select the word by double-clicking it, then right-click it and select the relevant alternative to define and insert the word into the system model as an object, property, method or value:

NL.grammer.error.quickFix.png

Once the errors are fixed, you can create the LSC by pressing ENTER, or by clicking the NL.plus.jpg button at the view toolbar:

NL.play-in.view+.png

Statistical NL-Play-In Interface

In case you have a complete textual requirements document, the process of interactive NL play-in may be time consuming and tedious. Instead, PlayGo allows you to import a complete requirements document and transform it into LSCs in batch. Each sentence will be transform into a single LSC. Disambiguation decisions are made using a statistical model that is trained on previously analysed requirement documents. The statistical model is optimized based on two sources of information:

  • content information, i.e., the grammatical structure and lexical items used in individual requirements.
  • context information, i.e., the coherence of the model expressed in the complete document, as a whole.


The requirements document has to adhere to the following rules:

  • Each line contains a single sentence.
  • Each sentence expresses a single requirement / scenario.
  • All sentences obey the same grammar restrictions as in the interactive NL play-in.
  • The file should have the suffix .desc.

Uploading a requirements document

In order to upload a requirements document follow these steps:

  1. Create a textual requirements document <filename>.desc that adheres to the format specified above. Locate the file in your LSC project.
  2. Right-click the <filename>.desc file and select 'Import Description'. 
  3. A <filename>.lsc files has been created under the same directory, containing a sequence of LSCs, each of which corresponds to one of the textual requirements. A system model for the entire system is created automatically.
    1. In case a <filename>.lsc file already exists in the same directory, you will be asked whether to override its contents.

Tuning the statistical model

The statistical model that is used for parsing requirements document may be tuned using the LSC project properties:

  1. Right-click the LSC project, and select Properties->PlayGo->Play-in.
  2. Select the StatisticalNL tab and choose a statistical grammar file:
    Properties.playin.statisticalNL.png

  3. Select one of the two parsing modes:
    1. Without context; i.e., applying the parser in a sentence-by-sentence mode.
    2. With context; i.e., applying the parser for parsing a complete requirements document.
      1. In case the "with context" option was selected, you can pre-define how many parse-candidates the model considers via the 'Number of candidates per requirements' box.
        NOTE: The number of candidates represents a tradeoff between system accuracy and parse time. The more candidates the model is allowed to consider, the higher the accuracy of the parser. However, if the number of candidates per sentence is too high, parsing performance may be negatively affected. A complete empirical investigation of this tradeoff may be found in [1].
  4. Click 'OK'.

The statistical parser uses a pre-trained grammar based on a set of manually annotated requirements. Accuracy of the statistical parser may improve if you add more training examples for the statistical model. If you have a set of LSC examples that you would like to use for re-training the statistical parser, you can do so using the 'Train' button.

See also How to train a model for statistical play-in.

Learn from Examples

Examples of requirements written in natural language, can be found here:

- Wristwatch.

- Phone.

- Baby Monitor.

Show & Tell play-in

To use Show & Tell play-in, click the 'Show & Tell Play-In' button.
NL.play-in.start.png

Consequently, the play-in session starts. If a GUI exists it is launched.
The 'NL Play-In' view is opened with the 'Interact Enable' button selected, in order to allow interaction with the GUI:
Show&Tell.png

An interaction with the GUI (e.g., clicking a button) creates segment of NL text in the requirement text field of the 'NL Play-In' view.
If the interaction can be interpreted in more than one way, a squiggly line appears, indicating an error, and a quick fix dialog is displayed upon hovering. The error can be resolved using the quick fix dialog:

Show&tell.quickFix.png

As in NL play-in, the LSC is created when pressing ENTER, or when clicking the NL.plus.jpg button at the view toolbar.

System model play-in

With system model play-in, you can enter scenarios by selecting an object from the system model, right-clicking it and selecting the required operation. For example, to add an event from the user to an object, right-click the corresponding object's method and select 'Call Message'. As a result, the corresponding LSC snippet will be created:

Systemmodel.playin.png

To play in from the system model, create an LSC project, or select an existing one. In either case, the LSC project has to have a system model. If it doesn't, create a system model and click the 'Basic Play-In' button to start playing in:

BasicPlayIn.png

You will be prompted to select a specification file name and location:

SpecFile.png

  • Note that you can play in from the system model also using the 'NL Play-In' and 'Show & Tell Play-in' alternatives.

References

  1. R. Tsarfaty, E. Pogrebezky, G. Weiss, Y. Natan, S. Szekely and D. Harel, "Semantic Parsing Using Content and Context: A Case Study from Requirements Elicitation", Proc. Int. Conf. on Empirical Methods in Natural Language Processing (EMNLP), to appear, 2014.