protected void Page_Load(object sender, EventArgs e)
 {
     dictfile = Server.MapPath("/") + "/wn-msa-all.tab";
     stemmer = new Stemmer(wn.GetSemanticWord(dictfile).Select(p => p.Item2).ToList());
     if (!IsPostBack)
     {
         divresult.Visible = false;
         
         
     }
 }
        public List<int> GetSemanticRelation(List<string> words, int docNo, int totalDoc, out List<string> vocabList,
          out Dictionary<int, string> results, string filename, Stemmer stem)
        {
            results = new Dictionary<int, string>();
            vocabList = new List<string>();
            List<int> ids = new List<int>();
            var semantic = this.GetSemanticWord(filename);
            int count = words.Count;
            int current = 1;
            int excluded = 0;
            consoleln = 0;

            foreach (var oldword in words)
            {
                string word = stem.PerformNaziefStemming(oldword);

                var matches = semantic.Where(p => p.Item2.ToLower() == word.ToLower()); //search word in dictionary
                if (matches.Count() != 0)
                {
                    if (!stopWords.Contains(word.ToLower()))
                    {
                        matches = matches.OrderByDescending(p => p.Item3).ToList(); //select highest score in word relationship
                        var match = matches.First();
                        ids.Add(match.Item1); //add the ID
                                              //add the word to vocab list
                        vocabList.Add(match.Item2);
                        //foreach (var match in matches)
                        //{
                        //ids.Add(match.Item1); //add the ID
                        //                      //add the word to vocab list
                        //vocabList.Add(match.Item2);

                        var sem = semantic.Where(q => q.Item1 == match.Item1 && q.Item2 != match.Item2);
                        if (sem.Count() != 0)
                        {
                            int max = sem.Max(p => p.Item3);
                            if (!results.ContainsKey(match.Item1))
                                results.Add(match.Item1, match.Item2);
                        }
                        //}
                    }
                    else excluded++;
                }
                //Console.SetCursorPosition(0, consoleln);
                //Console.WriteLine("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
                //Console.SetCursorPosition(0, consoleln);
                //Console.WriteLine("STATUS: Processing words in document " + docNo + " of " + totalDoc + ": " + current + "/" + count +
                //". Excluded stop words: " + excluded);

                current++;
            }
            consoleln++;
            //this.InsertToDb(ids, docNo, results, true);
            return ids;
        }