Well doing word-by-word presentation with a variable number of words
between trials really is not very basic at all. Seems to me that I
tackled this issue for a project here some years ago, but I cannot put
my finger on it just now. But here is another idea off the top of my
head ...
You could make one List with one row for each trial. The List would
have enough columns for the longest sentence, with column names like
"Word1", "Word2", etc., plus whatever other columns you need for the
trials. As Michiel suggested, you could use a key string such as "***"
to mark the end of the sentence, or use a column to supply the number of
words in each sentence.
Then you would have to use some InLine code to actually run a loop to
present the words for each trial. You could construct the loop using
good-old GoTo, or use a Do-Loop or For-Next structure.
E.g., using a trial Procedure structured as
- TrialSetupCode
- WordLoopBeginLabel
- WordSetupCode
- WordSlide
- WordLoopCode
- WordLoopExitLabel
TrialSetupCode does
Dim wordCount as Integer
Dim xWord as String
WordSetupCode does
wordCount = wordCount + 1
xWord = c.GetAttrib("Word" + wordCount)
If xWord = "***" Then GoTo WordLoopExitLabel
c.SetAttrib "Word", c.GetAttrib("Word" + wordCount)
WordSlide presents the word using the attribute [Word]. Then
WordLoopCode simply does
GoTo WordLoopBeginLabel
This is just a basic sketch of the idea. You could instead base the
loop on the provided number of words in the sentence, or surround
WordSlide with InLine code that does a Do-Loop or a For-Next, etc. And
I did not address outputting a signal/marker/trigger for the target word
yet.
Of course, splitting up 200 sentences into their component words for
each row still takes a lot of effort. Alternatively, you could use a
single column to hold the entire sentence text string for each trial.
Then you would have to use some extensive InLine code to parse out the
words on the fly and present them. If you want to go that route, look
into string handling functions such as Mid$, Item$, Word$, WordCount,
etc. Browse through the E-Basic Help for more info on these and more.
Good luck!
-- David McFarlane
On 2022-08-24 Wed 2:31 PM, Veranika Puhacheuskaya wrote:
> Hi Michiel, thanks for sending me your experiment! It may be not a great
> idea to have a varying number of words per sentence when you do EEG, but
> when you have >200 natural sentences, it's just not physically possible
> ;) If there wasn't, it wouldn't be a problem in the first place and
> there is a super elegant way of doing it without any custom coding :)
> Anyway, having 200 lists sounds like an enormous amount of work to be
> honest, and I am starting to have a feeling that I will have to use
> E-Basic to somehow solve the problem and use spaces in between words as
> a separator to do a word-by-word display. I will thoroughly examine your
> code to see whether I can use bits and pieces from it somehow to speed
> up the process. Thanks a lot for your help!
>
> On Tuesday, August 23, 2022 at 5:37:47 a.m. UTC-6
michie...@helsinki.fi
> wrote:
>
> Hi Veranika,____
>
> I’ll do my best, but it’s not so easy to explain in a few sentences
> :) Basically, the idea is that there’s 1 column, CatSentence, (or
> even 1 list) per sentence, with each word in a different row. Put it
> as a nested list in the blocklist. Then, the triallist can say
> /where/ the sentence comes from, say with an attribute called
> [Sentence], saying Cat in trial 1. In the TrialList, add another
> list, SubTrialList (let’s say it has 8 words, so 8 rows) to show
> each word with an attribute Word. In SubTrialList, add a procedure
> (WordProc) and add a textdisplay TheWord* to say [Word]. Now you
> could say in SubTrialList, row 1 [CatSentence:0] and row 2
> [CatSentence:1], and it will show 1 word at a time. BUT, even
> cleverer, would be to refer dynamically to the list CatSentence, by
> referring to the attribute [Sentence] within it:
> [[Sentence]Sentence:0] for row 1, [[Sentence]Sentence:1] for row 2. ____
>
> But what to do if there’s more or fewer words per sentence? (perhaps
> not a great idea if you do EEG). The simplest way would be to add a
> codeword: TheEnd at the end of the cat sentence. Then just BEFORE
> TheWord, put an inline, and after TheWord, put a goto flag, Skipper.
> The inline can say____
>
> __ __
>
> If c.getattrib (“Word”) = “TheEnd” then goto Skipper____
>
> __ __
>
> Done!____
>
> I also attached an experiment that does it slightly less elegantly
> by code, maybe it helps!____
>
> Best,____
>
> Michiel____
>
> __ __
>
> *Anyone else read Transmetropolitan?____
>
> __ __
>
> *From:*
e-p...@googlegroups.com <
e-p...@googlegroups.com> *On Behalf
> Of *Veranika Puhacheuskaya
> *Sent:* 22 August 2022 23:27
> *To:* E-Prime <
e-p...@googlegroups.com>
> *Subject:* Re: Written word-by-word presentation with EEG triggers____
>
> __ __
>
> Hi Michiel, thanks a lot for your detailed answer! If you do have
> some examples somewhere for 2), I would really appreciate it! I am
> honestly a real noob in E-Prime (having used jsPsych and PsychoPy
> only my whole life), so the programming language of E-Prime
> (E-Basic?) is Greek to me. So all my sentences would just form a
> giant column with one word per row in the first list and then I will
> have another list which would be something like:
> N Sentence ____
>
> 1 [CatSentence:0] [CatSentence:1] [CatSentence:2]
> [CatSentence:3] [CatSentence:4] [CatSentence:5]
> 2 [CatSentence:6] [CatSentence:7] [CatSentence:8]
> 3 [CatSentence:9] [CatSentence:10] [CatSentence:11]
> [CatSentence:12] [CatSentence:13] [CatSentence:14]
> 4 etc etc etc ?
> How would I make it show one word at a time if they are all in one
> column? Via custom code? Would it then be different from writing
> custom code so that it takes a sentence and shows it word-by-word
> using spaces as a separator (this seems like an obvious solution but
> I just don't know any E-Basic so I wasn't able to figure it out so
> far..) Sorry if I misunderstood you! And then of course I also have
> to send triggers from the target word, which makes it all even worse...
>
> ____
>
> On Monday, August 22, 2022 at 1:59:42 p.m. UTC-6
>
michie...@helsinki.fi wrote:____
>
> Hi Veranika,____
>
> I have done this every now and then, and as far as I know, there
> are three ways, and it’s probably best to combine some elements
> from each:____
>
> 1. Have lists load from text files rather than hard-code them;____
> 2. Use colon syntax to refer to the row, rather than use
> different columns. I.e. If you have one list ‘CatList’ with
> the sentence (e.g. a nested list) “The cat is a
> medium-sized, usually furry mammal” as an attribute
> (CatSentence), put 1 word per row: Row 1: The, Row 2: cat,
> etc. In your trial, add another list for just showing all
> words within the sentence, one at a time. The trick is to
> use this list and reference the specific row sequentially,
> which you do by colon syntax. For example: [CatSentence:0]
> will refer to row 1, The, [CatSentence:1] to row 2, cat. Let
> me know if you can’t figure it out further – I have a few
> examples somewhere. ____
> 3. Write the list from scratch using code, read up on the
> examples provided in the help on the List objects. OK, so
> it’s not a way to do it /without /writing code, obviously,
> but this is usually the simpler way to get it done!____
>
> Hope that helps!____
>
> Best,____
>
> Michiel____
>
> ____
>
> *From:*
e-p...@googlegroups.com <
e-p...@googlegroups.com> *On
> Behalf Of *Veranika Puhacheuskaya
> *Sent:* 22 August 2022 21:49
> *To:* E-Prime <
e-p...@googlegroups.com>
> *Subject:* Written word-by-word presentation with EEG triggers____
>
> ____
>
> Hi all,____
>
> This is likely a very basic question but I can't for some reason
> wrap my head around it. I will be running my first EEG
> experiment soon (E-Prime 3.0 + BioSemi) and need to send codes
> to the trigger interface when the target word is displayed
> (always the last word in the sentence). However, I can't figure
> out how to do a word-by-word presentation in the first place
> that because all my sentences have a different number of words
> in them. If I split my sentences into different columns in my
> source file, the target words would not be in the same column.
> Is there any way to do it without writing custom code? Has
> anyone dealt with the same problem? Thanks!____