Q:

Confusing indexing error while going line by line through some text

I'm reading in some text, line by line, and I'd like to tokenize the words and create 1-grams and 2-grams, but I think there's a problem with my indexing because I either get an index error or it'll say that the item I'm trying to modify in my dictionary doesn't exist, which is totally weird, since I wrote the code to first make the dictionary item and if it already exists, to increment a counter. 
Basically, my dictionaries are of the form (n-gram string, frequency int)
   System.IO.StreamReader lines = new System.IO.StreamReader("myfile");
    while (true)
    {
        string line = lines.ReadLine().ToLower();
        if (line == null) break;
        if (line.Trim().Length == 0) continue;
        string[] tokens = Regex.Split(line, "[^\\w']+");
        for (int i = 0; i < tokens.Count()-1; i++)
        {
            try
            {
                one_gram.Add(tokens[i], 1);
                two_gram.Add(tokens[i] + " " + tokens[i + 1], 1);
            }
            catch
            {
                one_gram[tokens[i]]++;
                two_gram[tokens[i] + " "+tokens[i + 1]]++;
            }

        }

    }

Can anyone look at my code and tell me where I went wrong? The problem seems to occur at the end of the for loop at the first line, but if I do
for(int i=0;i<tokens.Count()-3;i++)

then the error happens in the second line... but I'm not sure exactly what's causing it.
EDIT: As per suggestions, I tried using the ContainsKey method, but I still get an error near the end of the first line saying that I'm adding a Key that already exists, even though the if statements are supposed to catch that?!
for (int i = 0; i < tokens.Count()-1; i++)
{
    if (one_gram.ContainsKey(tokens[i]))
    {
        one_gram[tokens[i]]++;
    }
    if (two_gram.ContainsKey(tokens[i] + " " + tokens[i + 1]))
    {
        two_gram[tokens[i] + " " + tokens[i + 1]]++;
    }
    one_gram.Add(tokens[i], 1);
    two_gram.Add(tokens[i] + " " + tokens[i + 1], 1);
}

A:

You need to use an else (or break):
for (int i = 0; i < tokens.Count() - 1; i++)
{
    // Save yourself typing errors by creating variables to hold 
    // the key values and then you can just use the variable name
    var oneGramKey = tokens[i];
    var twoGramKey = string.Format("{0} {1}", tokens[i], tokens[i + 1]);

    if (one_gram.ContainsKey(oneGramKey))
    {
        one_gram[oneGramKey]++;
    }
    else
    {
        one_gram.Add(oneGramKey, 1);
    }

    if (two_gram.ContainsKey(twoGramKey))
    {
        two_gram[twoGramKey]++;
    }
    else
    {
         two_gram.Add(twoGramKey, 1);
    }
}

