The rule you were taught is about letters, and letters are the wrong thing to look at. The lab holds 493 lines from three texts, each with an a or an and the word that follows.
Counted on this page, the rule that puts an before a vowel letter is right on 486 of the 493 lines, which is 98.6%. Seven lines break it. Look at what they are: a University, a utilitarian and an hour, which the play uses five times.
Why the rule was ever about letters
Most words begin with the sound their first letter suggests, and a rule about letters is easier to teach than a rule about sounds. That is the whole reason. The rule is a short way of writing the real one, and it is a good short way: 98.6% is a high score.
The rule about sounds
Change the question to the first sound of the next word, and the rule is right on all 493 lines. Nothing about the lines changed. The question changed. The same words are in the same table, and the column that said missed is empty.
The dictionary gives the sound. That is the sound of hour, which is the vowel in our, and of University, which starts as you does. Seven of these lines, and no more, are what separated the two rules here.
Three sources, one result
Switch the lab to the play, to the modern documents or to the passage from the novel. The play has 455 lines. The letter rule is right on 448 of them and the sound rule on all 455. On the modern documents both rules are right on 29 of 29, and on the passage both are right on 9 of 9. The table also sets aside ten marks that look like a but are not the word, such as (a) and a page number 21a.
The modern documents show that the two rules agree for most words. The play is where they part, and all seven lines that separate them are in it.
The whole novel, quoted
The page cannot carry the whole of Pride and Prejudice. A count made once, away from this page, over its 2,266 lines gives the letter rule 2,239 right (98.8%) and the sound rule 2,263 right (99.9%). That count is quoted here and not computed on this page. The three lines the sound rule misses are an union, twice, and an uniform. They are Austen's habit, and the habit has gone.
What the page cannot tell you
It reads one way of saying each word, the American one. In a different kind of English some words begin with a different sound, and the choice of a or an follows. The lab says so in its own words, under the numbers, and lists the 17 lines the dictionary cannot score.