예제 #1
0
    // Create a RepFR open-stim word list from a list of repetitions and counts,
    // and a list of candidate words.
    public static StimWordList Generate(
        RepCounts rep_cnts,
        List <string> input_words,
        bool do_stim,
        double top_percent_spaced = 0.2)
    {
        var shuffled = Shuffle(input_words);

        var repeats = new List <RepWordList>();
        var singles = new RepWordList();

        var shuf = new BoundedInt(shuffled.Count,
                                  "Words required exceeded input word list size.");

        foreach (var rc in rep_cnts)
        {
            if (rc.rep == 1)
            {
                for (int i = 0; i < rc.count; i++)
                {
                    singles.Add(shuffled[shuf.i++]);
                }
            }
            else if (rc.rep > 1 && rc.count > 0)
            {
                var rep_words = new RepWordList(rc.rep);
                for (int i = 0; i < rc.count; i++)
                {
                    rep_words.Add(shuffled[shuf.i++]);
                }
                repeats.Add(rep_words);
            }
        }

        return(Generate(repeats, singles, do_stim, top_percent_spaced));
    }