GithubHelp home page GithubHelp logo

ranelpadon / ngram-type Goto Github PK

View Code? Open in Web Editor NEW
192.0 6.0 34.0 1.03 MB

Touch typing trainer using N-grams as data source, with options to customize the auto-generated lessons and specify the minimum typing performance needed. There are sound/color effects as well.

JavaScript 94.71% HTML 4.67% CSS 0.62%
ngram touch-typing lesson-generator colemak qwerty dvorak vue amphetype norman monkeytype

ngram-type's Introduction

Ngram Type

About

I learned Touch Typing and Colemak DH keyboard layout from scratch to improve my typing speed/accuracy/comfort. The journey included training with Ngrams dataset. Ngram refers to sequence/grouping of characters, and they're usually ranked to describe the common ones. Historically, ngrams are used in Crytography to decrypt messages. Nowadays, they have many applications, for classifying spam messages, as auto-completion or spell-checking tool, etc. Technically, Ngrams are words also, and vice versa.

In Josh Kaufman's The First 20 Hours book (one of his personal challenges is to learn Colemak in 20 hours in which he succeeded), he used ngrams mostly as well as practice dataset:

Human languages, including English, follow a power law curve called Zipf’s law: a very small set of words makes up the vast majority of actual usage. Based on an analysis of The Brown Corpus (1964), a 1 million-word collection of 500 modern English documents, only 135 words account for 50 percent of all English usage. The word "the" itself accounts for 7.5 percent, while "of" accounts for 3.5 percent.

Hence, Ngrams are practical and valuable training data. The better you're able to type these sequences of characters, the faster you'll be able to type in general. However, there's no free online typing website that integrates ngrams. And the typing tests on various websites are usually based on common English words. This project aims to provide a training ground for boosting typing speed/accuracy by focusing your performance in small and controlled phrases/chunks. Perfect training after all required perfect training on small set of data.

This Ngram Type project name was inspired by Amphetype and MonkeyType. I've ported some of the ideas in the Amphetype also into this project.

Features

  • Data source could be chosen, based on the most common ngrams/words. Source settings' are independent with each other: lesson generator and minimum performance settings are set for each data source.
  • Custom data source could be inputted using the Custom link.
  • Lessons could be customized and generated on-the-fly by varying the Scope, Combination, and Repetition settings; you'll immediately see the effect on the generated lesson. Old lessons on the same data source selected will be overridden once you update these settings. Once you completed the lessons, the data will start again at the beginning, but will be re-shuffled.
  • The minimum WPM/Accuracy required could be adjusted depending on your skill level, could be updated even at the mid-part of the lessons. You could not proceed to next lesson unless you have met those minimum performance. Average WPM refers to the average of all the WPMs in the current round of lessons that passed the threshold, which will be reset every round of lesson, so that old/historical averages will not affect the new ones. Average WPM is then a good indicator of your current speed which could be used for adjusting the performance thresholds in the next round of lessons.
  • Has sound effects: correct key, wrong key, or failed the minimum WPM/Accuracy set.
  • Has color indicator if you typed a wrong key.
  • Timer will start/stop depending in your typing activity. It's included just for tracking.
  • Settings are saved in your browser, and will be auto-loaded when you revisit/reload the page.

Sample Lessons

Using the Top 50 Words as sample source, you could have sample lessons/patterns like this:

  • Setting: Combination=1, Repetition=3

    • Output: the the the
  • Setting: Combination=2, Repetition=3

    • Output: the and the and the and
  • Setting: Combination=3, Repetition=3

    • Output: the and of the and of the and of
  • Setting: Combination=3, Repetition=1

    • Output: the and of
  • Setting: Combination=3, Repetition=2

    • Output: the and of the and of

Effective Practice

The ultimate aim of Ngram Type is to have good typing performance in real-life scenarios, or in typing sites like Monkey Type/10 Fast Fingers. To excel in these contexts, need to practice with Repetition=1 and Combination=max where max usually is between 20-40. That's what I did also before since I really want to improve my Monkey Type performance. Monkey Type has similar settings to that of Repetition=1 and Combination=200 (i.e. using the Top 200 English words). But of course, having Combination=200 in Ngram Type is not realistic, even athletes practice mostly in short bursts/sessions instead of full game.

So, here's one good training pattern (increasing Combination, and decreasing Repetition through time):

Repetition=3, Combination=3
Repetition=3, Combination=4
...
Repetition=3, Combination=10

---

Repetition=2, Combination=3
Repetition=2, Combination=4
...
Repetition=2, Combination=10

---

Repetition=1, Combination=3
Repetition=1, Combination=4
...
Repetition=1, Combination=10

Then, increase the Speed threshold on each round (each set of Repetition and Combination) based on your running average speed, or once you feel that the current set becomes easy/comfortable for you. Likewise, you could also aim up to Combination=15 or Combination=20 instead of Combination=10 only. This guarantees building good muscle memory and continual progress.

Increasing Combination and decreasing Repetition (which re-shuffles the data ordering as well) makes the exercise harder, which your muscle will adapt eventually. You should start mastering the Bigrams/Trigrams first since they are the building blocks of the English words, so you could have good performance even in Top 1000 words. Although most typing sites only test for Top 200 words. But training those Bigrams/Trigrams really well is a good investment. And if you always aim for 100% Accuracy at the expense of speed, eventually your speed will catch up since you will build "good" muscle memory and correcting mistakes is costly. Likewise, if you have low accuracy, you will build a "bad" muscle memory.

You could start with Top 50 bigrams/trigrams/tetragrams/words first. Then, move to Top 100, Top 150, and Top 200 as your performance improves.

Hosted Version

You could access the online version using GitHub Pages:

Translations

ngram-type's People

Contributors

debashisbiswas avatar edmundlam avatar ibash avatar m4p avatar ranelpadon avatar thatsweetdoja avatar udayvir-singh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ngram-type's Issues

No keyboard input

Hi! I was trying to practice with the website, but the keyboard input is not being recognised. Also, I think the white bar is covering text (see the screenshot)...

Screenshot 2022-01-25 at 16 27 00

Time counter starts too soon for WPM calculation

Hi ranelpadon,

I really like this practice tool and use it regularly. Thank you very much for this!

It seems to me that sometimes the WPM is calculated over a too long period of time resulting in a very low WPM. I noticed that this especially happens if I wasn't typing anything but just waiting some seconds or minutes. I think it should wait until I start typing and count from the first downstroke of a key, right? Most of the times this works but in some occasions not.

Edit: Oh, I think I accidentally hit space after every sequence as a habit thus starting the counter for the new sequence. Seems not to be a problem with the code. Could you make it start counting from a visible character? :)

WPM is inaccurate sometimes

Sometimes the WPM is inaccurate. Reloading the website doesn't help.
https://youtu.be/JP0CoyJm2F8
In this video I'm type 1535 letters in about 30 seconds (from 0:02 to 0:33), so my WPM should be 150, but it's reading as 173. If it's raw WPM, then at 97% accuracy, my raw WPM should be maybe 154ish.

I use Brave browser on Microsoft. This has been happening here for since maybe two weeks. Sometimes the WPM seems accurate, especially when I first open it that day; but then when I open it again or leave the tab and come back, the WPM is way too high.

Error calculating accuracy

Settings:

  • Bigrams
  • Top 200
  • Combination: 3
  • Repetition: 3
  • WPM: 100
  • Accuracy: 100

Seemingly random times I will get an extremely high speed, but not 100% accuracy, even though I'm making sure to get 100% accuracy and I'm definitely not typing as fast as it says (e.g. 300 WPM and 84% accuracy).

Disallow typing space if it's the first character

I tend to always press space after every word during normal typing, or after each ngram while using this site, and after completing an ngram when the cursor automatically resets I tend to press space by default. When doing this, after the end of the last ngram, you'll incorrectly enter a space at the start of the next set. This isn't necessarily a behavior that I think should be disincentivized, so I propose disallowing space being entered if it's the first character.

Pause timer button

I've been having a blast (both in fun and in wpm :D), but one thing that's been bothering me is the fact that the timer in the top-left corner is unpausable. I feel that this would be a pretty easy feature to implement. It would obviously unpause when the user starts typing again.

Support key mapping

It would be great if the app can support key mapping, so that it can simulate colemak-dh on a qwerty keyboard.

Ideal combination/repetition settings?

Thanks for building this tool, I've found it really useful :)

Do you have any thoughts on what the best settings for Combination and Repetition are?

I've got Combination set to 3, because that feels more realistic to me. If it's set to 1, then I tend to leave my hands on the keys that make up the ngram, rather than returning them to the home row. I think that means that I don't build the muscle memory of moving my hands to those keys.

I also have Repetition set to 3, since a lower number doesn't seem like enough to commit it to muscle memory.

I'm curious if anyone sees advantages in different settings?

If there is good reason to think that some settings are better than others, then it could be helpful to document that in the app, and set them as the defaults.

Thanks!

I discovered this tool via this YouTube video and I'm finding it really helpful as I learn Colemak DH.

Just wanted to say thanks. :)

[Feature] Dynamic WPM mode

I notice that sometimes I struggle more with certain N-grams than others. I try to dial in and practice at a speed just faster than what I consider myself to be "struggling" at, and it seems to help! What might help more is if the WPM threshold was automatically adjustable based on your average WPM, maybe even with an offset of some sort.

A good way to implement this might be a flag, that when set, automatically adjusts the WPM threshold based on your average WPM. Pair that with an offset that the user can adjust, and you get the ability to target certain specific kinds of tests that you struggle with.

Give it a checkbox and another stepper, and you have everything on the frontend necessary to control these things.

Alternative Ngram Patterns for Ngram Type?

Hey,

I hope you're well.

First, I want you to know that I greatly appreciate your Ngram Type program. I started using your little tool a few months ago to learn the basic patterns to help touch type more fluently. Presently, I have achieved that goal, now able to cruise type at around 85 wpm. So, thank you. Ngram type has been of great help to me.

Now, however, I would like to try to start typing anything at all at much higher speeds; for that, I believe I will need to learn other Ngram patterns, maybe ones from other English word lists. So, I wanted to touch base and ask if you would consider adding Ngram lists from English 1000 and 5000-word lists and perhaps look at adding a punctuation option.

Thanks and regards,

Psychoxd

App freezes when setting "combination" value

Steps to reproduce:

  1. Edit "combination" field directly to change the value to empty or any value less than 1. (this is not possible using the arrow keys, because the browser enforces that the minimum value is 1)
  2. Observe that the application freezes.

After a quick analysis, I can see that the generatePhrases function is getting stuck in an infinite loop unless this value is > 0, but I'm not sure how you'd like to solve this. Maybe stronger validation in the HTML? Let me know and I'd be happy to submit a PR.

auto space after typing the correct ngram

i love this trainer as it is already helping quite a bit, but i think it should atleast have the option of auto moving to the next ngram cause i found myself keep hitting space after every bigram or trigram in a word cause i am basically training my reflexes to automatically hit space afterwards.

Split "Custom" text on only newlines [suggestion]

My goal may be different than the intended use. I'd like to practice typing code, and it would be convenient to be able to paste code directly into the custom text. Splitting on all white space works but produces some odd character combinations. Having the option to split only on newlines would, I think, suffice for what I'm trying to do.

WPM doubles when restart line

  1. Set top 50 bigrams, combination 10, repetition 1, wpm 80, accuracy 100
  2. Slowly type all of the bigrams except the last one
  3. Pause for 15 seconds
  4. Press command backspace to delete all the text you typed
  5. Quickly type all the bigrams

The WPM should be very low, but instead it's much higher. It seems like the timer resets when the input is deleted, but the word count doesn't.

[Question] Source of data (I'd love more n-grams!)

Hello!

First of all thank you so much for creating this valuable tool. It's helped me a great deal in my quest to learn colemak, potentially even saving me from giving up!

I was wondering if you could share the source you're using for n-grams of various lengths, specifically because I'm interested in expanding my training to the top 100 or 200 tri, tetra, and pentagrams.

Thanks again!

Frequency Adjusted Adjacent Words

Hello, I love ngram type, and I've been using it for awhile now, but there is something that I think could help improve the words feature even more. Whenever you use the words feature, it doesn't give any importance (or at least not much) to adjacent words that have a higher frequency of occurrence whenever we use English. For example, whenever I choose a combination of 2 and a repetition of 1, uncommon or nonsensical combinations show up repeatedly, such as "a have" or "the be". This is a pretty big opportunity cost whenever you practice and could be fixed, but is exponentially costly the more words you explore, so a limit of the ten most commonly used words in English might be something to explore for this problem.

Remove need for space

I hit a wall and have been trying to use ngram to work on parts of work. What I noticed is that the space now makes part of my muscle memory... I would be nice to remove the need for a space. I was thing waiting for small pause say 150ms, could allow one to stop at the boundaries but not have to hit space.

Notify user when caps lock is on

It would be a nice quality of life feature for Ngram Type to notify the user when they have caps lock on, like how monkeytype does.
I sometimes press the caps lock button on accident when trying to press the tab key, and don't realize it until I start to type and my letters come out in all caps.
This forces me to restart my current challenge again, which is somewhat annoying.
This could be avoided if Ngram Type were to notify users when they have caps lock active.

Subset ngrams by letter group

It would be cool to have an option to define a group of letters to subset the selection with. Thus allowing a layout agnostic way of quickly specifying a custom training for only a single hand, certain fingers, or home row keys.

Support for foreign languages

Awesome work! I already practiced n-grams on several platform with the ones I extracted from text corpora myself.

Would it be possible to have a tag in order to chose a language that specifies the respective n-grams? At least for the german language I generate and attach lists from one of the free available corpora (e.g. https://www.ids-mannheim.de/digspra/kl/projekte/methoden/derewo/#c9778 for german n-grams).

Add support for typographic symbols, like right single quotation mark (’)

Some layout do have direct access to typographic symbols, and user of such layout may prefer to use the typographic version to the ascii version.

There are other typographic symbols (like „“”«»—, accentuated uppercase letters, non breaking space, …), but I don’t think that they are used in ngram-type.

If possible I think that It would be best to accept either variant indifferently.

Pangram/Custom

Hello!

When I click on the custom link, nothing is happening. Am I supposed to get a dialogue to input text? I tried on chrome and firefox.

Practice hardest patterns

I find myself struggling in some patterns more than others, but a lot of time is spent iterating on patterns I already internalized.
It would be nice to have the tool keep track of the patterns that cause more mistakes and present them with higher frequency.
Ideally this requires an account so I understand it may be a lot of work, but maybe a cache based solution is good enough.

re-type if failed is bypassed if entire text is deleted

steps:

  1. fail to type an Ngram correctly
  2. delete everything
  3. type the whole thing correctly

Result:
A new test is generated

Expected result:
Same test regenerates due to failure.

Comment:

When I fail I have an instinct to delete everything because the test is so short anyway and I want to pass the whole thing correctly, but because I failed I still think it adds a nice touch to repeat it twice.
When I deleted everything I expected to have to repeat it twice anyway, because deleting doesn't change the fact that I failed, same way if I only delete the mistake (and not the whole text) I would still have to repeat it twice.

Add retention parameter

As I reach the desired wpm, the text is changed. I think it would be helpful to have adjustable number of consecutive run above WPM threshold.

Add selection of n-gram groups to type among the listed top 200

First of all, thank you very much for making such a useful tool in such a user-friendly manner! You've helped us typists to achieve our goals in a breeze.

Regarding my suggestion in this ticket, currently the "scope" covers the top 200 bi-, tri- and tetra-grams, which is more than plenty to play with. However, the user is unable to have a more targeted practice of a specific portion of the listed n-grams. For example, if you want to practice the last 50 listed n-grams, you have no other way but to select the top 200 and go through all of them to get the last 50 mixed somewhere in it.

Taking this into consideration, I believe it would be beneficial to add at the very least a group selection of which quarter of the list you'd like to practice. This will make it easier for users to target certain portions of the n-grams without needing to have to go through the extra load of the rest of the content of the list.

Feature Request: Auto-restart when error threshold fail

AS A keyboard learner
I WANT TO have a setting to auto-restart the current exercise when I fail the error threshold
SO THAT I don't have hit tap every time I fail

ACCEPTANCE CRITERIA

  • Setting to enable / disable auto-restart when the error level is met
  • The current sound effects play as expected
  • The text box is cleared when it fails
  • Optional: Add some effect or flashed message to indicate why the user restarted automatically

Show Layout

Thanks for ngram-type! Do you plan on having a layout shown around the typing area?

That would be great for learning new layouts.

Font

These letters look the same:

  • small l, like Lewis.
  • capital I, like Ingrid.

E.g. try "lIlllIlIIllI" in custom format.

Is it something I can modify in browser settings?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.