Tokenized Text Stimulus¶
A tokenized-text stimulus is similar to the text stimulus, with additional options for manipulating the stimulus on a token-by-token basis (in most cases, a token is a word). A tokenized-text stimulus can be particularly useful for creating a self-paced reading study.
Required Properties¶
content¶
- Definition: The text to be displayed (for example, in a typical self-paced reading study, this should be a single sentence)
- Possible values: A string of text (strings are any text enclosed in quotation marks " "). If you'd like to add formatting to your string, the following HTML tags are supported:
<abbr>
,<acronym>
,<b>
,<blockquote>
,<code>
,<em>
,<i>
,<li>
,<ol>
,<strong>
,<ul>
,<p>
.
type¶
Optional Properties¶
alignment¶
backward_mask¶
Dependencies
Requires mode to be set to "masked"
- Definition: Whether tokens preceeding the active token are displayed as the mask character. If set to
true
, then tokens preceeding the active token are displayed as the mask character; if set tofalse
, then tokens preceeding the active token are displayed normally. - Possible values:
true
orfalse
- Default:
true
- See Also: forward_mask,
masked_spaces
, andmask_char
bidirectional¶
Dependencies
Requires mode to be set to "masked"
- Definition: Allows a self-paced tokenized text stimulus to go in both forward and backward directions. If set to
true
, participants can press one key to advance the tokens and another key to reverse. Reading/reaction times are recorded for each forward and backward action. - Possible values:
true
orfalse
- Default:
false
(i.e., forward self-paced only) - See also: self_paced, key_advance, and key_reverse
backward_mask¶
Dependencies
Requires mode to be set to "masked"
- Definition: Whether tokens preceeding the active token are displayed as the mask character. If set to
true
, then tokens preceeding the active token are displayed as the mask character; if set tofalse
, then tokens preceeding the active token are displayed normally. - Possible values:
true
orfalse
- Default:
true
- See Also: forward_mask, masked_spaces, and mask_char
color¶
delay¶
Info
This property is used for presenting multiple stimuli on a trial in a sequence. To implement inter-trial intervals, see the delay parameter in trial templates instead.
Warning
The delaying of multiple stimuli on a trial does NOT have a chain effect. That is, the delay of any stimulus on a trial is always relative to the onset of that trial or the end of the last stimulus acting as a barrier.
- Definition: Delay the onset of a stimulus by a certain number of seconds, relative to (1) the onset of a trial if there are no stimuli acting as barriers or (2) the end of the last stimulus acting as a barrier.
- Possible values: A number in seconds (decimals are supported)
- Default:
0
(no delay)
delimiter¶
- Definition: A character or a string that serves as the boundary for splitting content into a list of tokens
- Possible values: Any character or regex string
- Default: A single space character (i.e., " ")
Note
If the delimiter
should be interpreted as a regular expression (instead of a string), regex must be set to true
.
forward_mask¶
Dependencies
Requires mode to be set to "masked"
- Definition: If set to
true
, tokens following the active token will appear in the mask character; if set tofalse
, then tokens following the active token are invisible. - Possible values:
true
orfalse
- Default:
false
- See Also: backward_mask,
masked_spaces
, andmask_char
hint¶
Dependencies
Requires self_paced to be set to true
.
- Definition: Whether or not to display an instruction below the tokenized text stimulus on which key to press to advance in self-paced reading. The instruction will read: "Press the "[SPACE]" key to advance." If you have set key_advance to a different key, then
[SPACE]
will be replaced by the name of that key. In the case of bidirectional self-paced reading, both keys will be listed. - Possible values:
true
orfalse
- Default:
true
- See also: self_paced
{
"type": "tokenized_text",
"content": "The text in these quotation marks will be displayed.",
"self_paced": true,
"key_advance": "j",
"hint": false
}
In this example, because hint* is set to false
, no instruction will be displayed with this stimulus. If hint** were set to true
, participants would see the following instruction: "Press the "j" key to advance."
keep_delimiter¶
Info
In most cases, this setting is only useful when you are using a regex-based delimiter.
{
"type": "tokenized_text",
"content": "apple,orange,lemon,lime,banana",
"delimiter": ",",
"keep_delimiter": true
}
","
(a comma), "apple", "orange", "lemon", "lime", and "banana" will be displayed as separate tokens. Because keep_delimiter is set to true
, the comma will appear when the tokens are displayed: "apple,orange,lemon,lime,banana"
If keep_delimiter were set to false
, the tokens would be separated by a "[SPACE]": "apple orange lemon lime banana"
keep_last¶
key_advance¶
Dependencies
Requires self_paced to be set to true
.
Warning
Avoid setting the key to any Shift keys unless your participants are in a controlled lab environment. Some operating systems (e.g., Windows) associate system actions with repeated presses of Shift keys, which may interfere with experiment progress.
- Definition: The key that a participant should press to advance the presentation of a self-paced tokenized text stimulus
- Possible values: Any alphanumeric character, and one of the following keys:
"ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "ShiftLeft", "ShiftRight", "ControlLeft", "ControlRight", "AltLeft", "AltRight"
- Default: When bidirectional is
false
, the default is" "
(the space bar); when bidirectional istrue
, the default is"ArrowRight"
(the right arrow key). - See also: self_paced, key_reverse
In this example, we change the key for advancing in a self-paced reading stimulus to the letter "J".
{
"type": "tokenized_text",
"content": "The text in these quotation marks will be displayed.",
"self_paced": true,
"key_advance": "j" // change the key to the letter J key
}
key_advance_instruction¶
DEPRECATED
This feature will be removed in a future grammar update. Use hint instead.
- Definition: Whether or not to display an instruction below the tokenized text stimulus on which key to press to advance. The instruction will read: "Press the "[SPACE]" key to advance." If you have set
key_advance
to a different key, then "[SPACE]" will be replaced by that key. - Possible values:
true
orfalse
- Default:
true
{
"type": "tokenized_text",
"content": "The text in these quotation marks will be displayed.",
"self_paced": true,
"key_advance": "j",
"key_advance_instruction": false
}
false
, no instruction will be displayed with this stimulus. If key_advance_instruction were set to true
, participants would see the following instruction: "Press the "j" key to advance."
key_reverse¶
Dependencies
Requires self_paced to be set to true
. Requires bidirectional to be set to true
.
Warning
Avoid setting the key to any Shift keys unless your participants are in a controlled lab environment. Some operating systems (e.g., Windows) associate system actions with repeated presses of Shift keys, which may interfere with experiment progress.
- Definition: The key that a participant should press to reverse the presentation of a self-paced tokenized text stimulus
- Possible values: Any alphanumeric character, and one of the following keys:
"ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "ShiftLeft", "ShiftRight", "ControlLeft", "ControlRight", "AltLeft", "AltRight"
- Default:
"ArrowLeft"
(i.e., the left arrow key) - See also: self_paced, bidirectional, key_advance
{
"type": "tokenized_text",
"content": "The text in these quotation marks will be displayed.",
"self_paced": true,
"bidirectional": true,
"key_advance": "AltRight" // change the key advancing the tokens to the right Alt key
"key_reverse": "AltLeft" // change the key reversing the tokens to the left Alt key
}
mask_char¶
Dependencies
Requires mode to be set to "masked"
masked_spaces¶
Dependencies
Requires mode to be set to "masked"
{
"type": "tokenized_text",
"content": "The text in these quotation marks will be masked.",
"mode": "masked",
"masked_spaces": false
}
When the masked_spaces property is set to false
, the content "The text in these quotation marks will be masked" will be masked as follows:
### #### ## ##### ######### ##### #### ## #######
When the masked_spaces property is set to true
(its default value), it will be masked as this instead:
#################################################
That is, the spaces are masked as well, making it next to impossible to infer word boundaries.
mode¶
- Definition: The mode in which the tokenized text stimulus is displayed. Three options are possible:
"plain"
, where tokens are displayed in sequence,"masked"
, where only one active token is displayed and other tokens explicitly masked, and"singleton"
, where only one active token is displayed with all other tokens invisible. - Possible values:
"plain"
,"masked"
, and"singleton"
- Default:
"plain"
- See also:
mask_char
, forward_mask,backward_mask
,masked_spaces
parent¶
- Definition: If specified, then the properties of the specified stimulus will be inherited by this stimulus, unless a property of the same name is defined in this stimulus
- Possible values: The name of another defined stimulus
Consider a tokenized stimulus named "t_t_1":
"{
"type": "tokenized_text",
"content": "This text will be masked",
"key_advance": "j",
"mode": "masked",
"barrier": false
}
and then define a second tokenized stimulus named "t_t_2":
Here, the t_t_2 stimulus inherits the barrier and key_advance properties of t_t_1. t_t_2 does not inherit the mode property of t_t_1 because the stimulus definition of t_t_2 specifies its own mode property.regex¶
- Definition: If set to
true
, the delimiter is interpreted as a regular expression instead of a string. - Possible values:
true
orfalse
- Default:
false
- See also:
delimiter
{
"type": "tokenized_text",
"content": "We want to display each word AND each half of half-baked separately!",
"self_paced": true,
"mode": "plain",
"delimiter": "[\\s-]",
"regex": true,
"keep_delimiter": true
}
[\\s-]
is set to be a regex pattern, and it will recognize either spaces or dashes as boundaries between tokens. In the content "We want to display each word AND each half of half-baked seperately"
, every space will mark token boundaries, such that "We", "want", "to", etc. are displayed as distinct tokens. Additionally, dashes ("-") will mark boundaries, so "half" and "baked" are recognized as separate tokens.
self_paced¶
- Definition: Whether participant interaction (in the form of a key-press) must trigger the presentation of each token. If
true
, then the display of tokens in a tokenized text stimulus must be triggered by participant interaction, and reaction time for each token is recorded; iffalse
, then each tokenized text stimulus will be automatically presented. - Possible values:
true
,false
- Default:
false
- See also: bidirectional, key_advance, key_reverse, hint, speed, and token_duration
size¶
speed¶
Dependencies
Requires self_paced to be set to false
(or omitted). Overriden by token_duration if it is also set.
- Definition: The speed, in characters per second, at which a tokenized text stimulus is presented
- Possible values: A number of characters per second (i.e.,
6
) to be displayed - See Also: self_paced, token_duration
token_duration¶
Dependencies
Requires self_paced to be set to false
(or omitted). Overrides speed when both are set.
- Definition: The speed, in seconds per token, at which a tokenized text stimulus is presented
- Possible values: A number of seconds per token (i.e.
2
) to be displayed - See Also:
self_paced
,speed
Relevant Readings¶
Design Pattern: Respond at the Right Time