public DemoForm()
        {
            // System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            InitializeComponent();
            this.m_Model = BabelModel._AllModel;

            foreach (String lang in m_Model.Keys)
            {
                object val = lang;
                try
                {
                    val = GetLanguageCulture(lang);
                }
                catch { };
                this.cbLangCompare.Items.Add(val);
                this.cbTables.Items.Add(val);
            }
            this.cbTables.SelectedIndex = 0;


            //strt
            this.cbLangCompare.Items.Add("Arabizi");
            //this.cbTables.SelectedIndex = 0;

            lvAnalyzeCharsetResult.Visible = false;//left
            lvAnalyzeWordResult.Visible    = false;
            lvAnalyzeNGramsResult.Visible  = false;
            textBox1.Visible      = false;
            tbSumWords.Visible    = false;
            tbSumTokens.Visible   = false;
            tbResult.Visible      = false;
            cbLangCompare.Visible = false;
            //label8.Text = "Type our language text here";



            List <string> entitylist = new List <string>();

            entitylist.Add("aa"); entitylist.Add("aando"); entitylist.Add("ach"); entitylist.Add("achmn"); entitylist.Add("achne");
            entitylist.Add("Akhti"); entitylist.Add("Akhtii"); entitylist.Add("ana"); entitylist.Add("andhom"); entitylist.Add("asg");
            entitylist.Add("awdi"); entitylist.Add("awdii"); entitylist.Add("axmn"); entitylist.Add("ay"); entitylist.Add("ayi");

            entitylist.Add(""); entitylist.Add(""); entitylist.Add(""); entitylist.Add(""); entitylist.Add("");
            entitylist.Add(""); entitylist.Add(""); entitylist.Add(""); entitylist.Add(""); entitylist.Add("");

            //var xlApp = new Microsoft.Office.Interop.Excel.Application();
            //var xlWorkBook = xlApp.Workbooks.Open(@"F:\work1\DialogueMaster.Babel\WinSample\file\entities.xlsx", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            //var xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
        }
Esempio n. 2
0
        public DemoForm()
        {
            // System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            InitializeComponent();
            this.m_Model = BabelModel._AllModel;

            foreach (String lang in m_Model.Keys)
            {
                object val = lang;
                try
                {
                    val = GetLanguageCulture(lang);
                }
                catch { };
                this.cbLangCompare.Items.Add(val);
                this.cbTables.Items.Add(val);
            }
            this.cbTables.SelectedIndex = 0;
        }
 /// <summary>
 /// Perform deep comparison of two model instances
 /// </summary>
 /// <param name="obj">First object to compare</param>
 /// <param name="value">Second object to compare</param>
 /// <param name="path">Location of the non-equal element found first</param>
 /// <returns>If both objects are equal</returns>
 public static bool Compare(this IBabelModel obj, IBabelModel value, out string path)
 {
     if (obj == null)
     {
         if (value == null)
         {
             path = null;
             return true;
         }
         else
         {
             path = "";
             return false;
         }
     }
     var ci = new CompareInfo { Model = value, Path = null, AreEqual = true};
     obj.RunOnChildren<CompareInfo>(CompareInternal, ci);
     path = ci.Path;
     return ci.AreEqual;
 }
Esempio n. 4
0
        LanguageController()
        {
            this.m_Model = BabelModel._AllModel;
            int i = 0;

            foreach (String lang in m_Model.Keys)
            {
                object val = lang;
                try
                {
                    val = GetLanguageCulture(lang);
                    //okjk.Add(lang, val);


                    //okjk.Values.Add(m_Model.Values[i]);
                    //var lkjlk = val.GetType();
                    //ITokenTable catTable;
                    //ITokenStats dd = new ITokenStats();

                    //foreach (var tyut in m_Model)
                    //i++;
                }
                catch { };

                int k = 0;
                foreach (var fgrt in m_Model.Values)
                {
                    if (i == k)
                    {
                        okjk.Add(lang, fgrt);
                    }
                    k++;
                }

                //var dfkjvfd = m_Model.Values[i];

                //okjk.Add(lang, m_Model.Values[i]);

                i++;
            }
        }
 private static void ValidateModel(IBabelModel obj, ValidationData vd)
 {
     var vc = new ValidationContext(obj, null, null);
     var res = new List<ValidationResult>();
     vd.IsValid = System.ComponentModel.DataAnnotations.Validator.TryValidateObject(obj, vc, res, true) & vd.IsValid;
     if(vd.Prefix.Length > 0)
     {
         foreach(var r in res)
         {
                 string[] members = (r.MemberNames == null) ? null : r.MemberNames.Select(m => vd.Prefix + "/" + m).ToArray();
                 vd.Results.Add(new ValidationResult(r.ErrorMessage, members));
         }
     }
     else
     {
         vd.Results.AddRange(res);
     }
     obj.RunOnChildren<ValidationData>(ValidateProperty, vd, false);
 }
 static object CopyInternal(string name, System.Type itemType, object data, IBabelModel result)
 {
     object newVal = CopyInternal(data);
     result.RunOnChild<object>(name, SetProperty, newVal);
     return data;
 }
 /// <summary>
 /// Perform deep comparison of two model instances
 /// </summary>
 /// <param name="obj">First object to compare</param>
 /// <param name="value">Second object to compare</param>
 /// <returns>If both objects are equal</returns>
 public static bool Compare(this IBabelModel obj, IBabelModel value)
 {
     string s;
     return Compare(obj, value, out s);
 }