Urgent;save training results

Jul 17 at 1:20 PM
Entry newDocument =Entry.FromString("Hello there,how are you doing today?");
        Index spam = Index.CreateMemoryIndex();
        Index notspam = Index.CreateMemoryIndex();
        float accuracy;
        // train the indexes
        spam.Add(Entry.FromString("want some viagra?"));
        spam.Add(Entry.FromString("cialis can make you larger"));
        notspam.Add(Entry.FromString("Hello, how are you?"));
        notspam.Add(Entry.FromString("Did you go to the park today?"));



        Analyzer analyzer = new Analyzer();


        CategorizationResult result = analyzer.Categorize(
             newDocument,
             spam,
             notspam);


        var index = new FileIndex("kk.xml");
        index.Open();
        foreach (Entry item in spam.)
        {
            index.Add(Entry.FromString(item.ToString()));
        }

        index.Save();


        accuracy = analyzer.GetPrediction(newDocument, spam, notspam);

        switch (result)
        {
            case CategorizationResult.First:
                MessageBox.Show("Spam"+": "+ accuracy.ToString());
                break;
            case CategorizationResult.Undetermined:
                MessageBox.Show("Undecided");
                break;
            case CategorizationResult.Second:
                MessageBox.Show("Not Spam"+": "+accuracy.ToString());
                break;
        }
    }