private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
        {
            // Check for old boilerplate and migrate it over if it exists.
            // This check will likely go away with the next major release.
            StringCollection oldbp = Properties.Settings.Default.boilerplate;

            if (oldbp.Count > 0)
            {
                Boilerplate bp = new Boilerplate();
                Debug.WriteLine("Found old boilerplate. Moving them over.");
                for (int i = 0; i < oldbp.Count - 1; i += 2)
                {
                    Comment c = new Comment();
                    c.Text = oldbp[i + 1];
                    bp.Dict.Add(oldbp[i], c);
                }
                Properties.Settings.Default.newboiler = bp;
                oldbp.Clear();
                Properties.Settings.Default.boilerplate = oldbp;
                Properties.Settings.Default.Save();
            }

            loadBoilerplate();
            loadSearches();

            //Languages
            Word.Languages langs = Globals.ThisAddIn.Application.Languages;
            List <Tuple <string, Word.Language> > langlist = new List <Tuple <string, Word.Language> >();

            foreach (Word.Language lang in langs)
            {
                langlist.Add(new Tuple <string, Word.Language>(lang.NameLocal, lang));
            }
            langlist.Sort((x, y) => x.Item1.CompareTo(y.Item1));
            foreach (Tuple <string, Word.Language> lang in langlist)
            {
                RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                item.Label = lang.Item1;
                item.Tag   = lang.Item2.ID;
                dd_Langs.Items.Add(item);
                if (lang.Item1 == Properties.Settings.Default.lastlang)
                {
                    dd_Langs.SelectedItem = item;
                }
            }
            uint minlen = Properties.Settings.Default.minphraselen;
            uint maxlen = Properties.Settings.Default.maxphraselen;

            edit_MinPhraseLen.Text = minlen.ToString();
            edit_MaxPhraseLen.Text = maxlen.ToString();
        }
        //public edu.stanford.nlp.parser.lexparser.LexicalizedParser lp;

        private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
        {
            loadBoilerplate();

            //Languages
            Word.Languages langs = Globals.ThisAddIn.Application.Languages;
            List <Tuple <string, Word.Language> > langlist = new List <Tuple <string, Word.Language> >();

            foreach (Word.Language lang in langs)
            {
                langlist.Add(new Tuple <string, Word.Language>(lang.NameLocal, lang));
            }
            langlist.Sort((x, y) => x.Item1.CompareTo(y.Item1));
            foreach (Tuple <string, Word.Language> lang in langlist)
            {
                RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
                item.Label = lang.Item1;
                item.Tag   = lang.Item2.ID;
                dd_Langs.Items.Add(item);
                //if (lang.Item1 == Properties.Settings.Default.Options_ProofLanguage)
                //{
                //    dd_Langs.SelectedItem = item;
                //}
            }
            uint minlen = Properties.Settings.Default.Options_PhraseLengthMin;
            uint maxlen = Properties.Settings.Default.Options_PhraseLengthMax;

            edit_MinPhraseLen.Text = minlen.ToString();
            edit_MaxPhraseLen.Text = maxlen.ToString();

            //POSTagger
            Debug.WriteLine("Loading tagger model...");
            MemoryStream _stream = new MemoryStream(Properties.Resources.posmodel);

            java.io.InputStream model = new ikvm.io.InputStreamWrapper(_stream);
            tagger = new MaxentTagger(model);
            Debug.WriteLine("Model loaded.");

            //Typed Dependencies
            //Debug.WriteLine("Loading lexical parser model...");
            //_stream = new MemoryStream(Properties.Resources.englishPCFG_ser);
            //var isw = new ikvm.io.InputStreamWrapper(_stream);
            //var gzs = new java.util.zip.GZIPInputStream(isw);
            //var ois = new java.io.ObjectInputStream(gzs);
            //lp = LexicalizedParser.loadModel(ois);
            //Debug.WriteLine("Model loaded.");
        }