3 ms·
Could this be used to generate typing lessons for programmers? One of the things lacking from many typing tools is practice typing symbols as used by programmer
by lemming 15y ago
Could this be used to generate typing lessons for programmers? One of the things lacking from many typing tools is practice typing symbols as used by programmers - I guess random code would be difficult to generate though and you'd need to specify language etc, although maybe just pasting in your github projects would be sufficient as learning material.
- stevelosh 15y agoIt works fine with code -- it basically just splits on whitespace and considers anything in the result to be a "word". The code won't make sense, and parens/brackets/etc won't be balanced, but you can definitely use it for practicing. EDIT: Here are a few drills it generated when I gave it its own source code: # Lesson generated by Typkov Lesson 1 (string/split (sanitize text) #"\s+"))) dict [w n] 0))) (rest words)))))) lessons)))) (defn sanitize [s] (-> s (string/replace \" \"))) (defn [lesson n] (let [w n] (let [initial-word (random-choice (keys dict)))) (defn markov-dict ([words] (markov-dict words) n "\n" (join-n lines)))) (defn Lesson 2 text 24) [:text "You must enter a decent amount of "])))) "G:MENU\n"))) (defn random-choice [coll] (nth coll (rand-int n))] (loop data))) (render "/" data) (not (form-valid? data))) (render "/" data) data} (t/home (:text data) (t/home (:text data) (not (second words)] Lesson 3 n] (let [initial-word (random-choice (keys dict))] (case format n] (let [w (first words) lessons (repeatedly n (partial string/join "\n")) (def \' \') (string/replace \" \"))) (defn markov-dict ([words] (markov-dict {} get-lesson [text format n] 0))) (rest choices))))))) (def join-nn (partial