Пример #1
0
 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;
 }
Пример #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);
        }