Example #1
0
File: Vocab.cs Project: a170811/IWE
 public Vocab(Vocab v)
 {
     m_list    = new List <string>(v.m_list);
     m_dict    = new Dictionary <string, int>(v.m_dict);
     m_fLocked = v.m_fLocked;
     m_iUnk    = v.m_iUnk;
 }
Example #2
0
        public static List <Dictionary <int, double> > StrFreq2IdFreq(List <Dictionary <string, double> > strFeqList, Vocab v, int pos)
        {
            List <Dictionary <int, double> > ans = new List <Dictionary <int, double> >(strFeqList.Count);
            int id;

            foreach (var inpDict in strFeqList)
            {
                Dictionary <int, double> dict = new Dictionary <int, double>();
                foreach (var kvp in inpDict)
                {
                    if ((id = v[kvp.Key]) >= 0)
                    {
                        dict[id + pos] = kvp.Value;
                    }
                }
                ans.Add(dict);
            }
            return(ans);
        }