Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (txtWord.Text.Length == 0)
            {
                MessageBox.Show("أدخل الكلمة المطلوب إضافتها في حقل الكلمة", "أدخل كلمة",
                                MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.RtlReading);
                return;
            }
            if (!Tashkeel.CheckTashkeel(Tashkeel.Remove(txtWord.Text), txtDiacritics.Text))
            {
                MessageBox.Show("التشكيل المدخل غير متوافق مع حروف الكلمة، يرجى التأكد من التشكيل", "خطأ في التشكيل",
                                MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.RtlReading);
                return;
            }
            Analyzer.con.Open();
            OleDbCommand com = new OleDbCommand();

            com.Connection  = Analyzer.con;
            com.CommandText = "select count(word) from ArabizedWords where word = '" + txtWord.Text + "'";
            byte Result = byte.Parse(com.ExecuteScalar().ToString());

            if (Result > 0)
            {
                MessageBox.Show("الكلمة المدخلة موجودة بالفعل ضمن ذاكرة التعلم!", "كلمة موجودة",
                                MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.RtlReading);
                return;
            }
            com.CommandText = string.Format("Insert into ArabizedWords values('{0}','{1}','{2}',{3})", Tashkeel.Remove(txtWord.Text), txtDiacritics.Text, WordMeaning, WordClass);
            com.ExecuteNonQuery();
            Analyzer.con.Close();
            DialogResult = true;
            Close();
        }
Ejemplo n.º 2
0
        private void btnAuto_Click(object sender, RoutedEventArgs e)
        {
            string Word = Tashkeel.Remove(txtWord.Text);

            txtDiacritics.Text = Tashkeel.Guess(Word);
            txtWord.Text       = Tashkeel.SetTashkeel(Word, txtDiacritics.Text);
        }
Ejemplo n.º 3
0
        private void txtOut_SelectionChanged(object sender, RoutedEventArgs e)
        {
            btnDetails.IsEnabled = true;
            btnModify.IsEnabled  = false;
            if (txtOut.SelectionLength == 0)
            {
                lstPossibilities.Items.Clear();
                SelectedWordIndex = -1;
                return;
            }
            int temp;
            List <ArabicWord> prevWords = Analyzer.ExtractArabicWords(txtOut.Text.Substring(0, txtOut.SelectionStart), out temp);

            SelectedWordIndex = (prevWords.Count > 0) ? prevWords.Count - 1 : 0;//عدد الكلمات السابقة باستثناء نهاية الجملة
            if (Analyzer.ArabicWords[SelectedWordIndex].word == "EOS")
            {
                SelectedWordIndex++;
            }
            lstPossibilities.Items.Clear();
            //إذا لم تكن الكلمة منتقاة بشكل صحيح لا تعدل
            if (SelectedWordIndex == Analyzer.ArabicWords.Count || Tashkeel.Remove(txtOut.SelectedText.Trim()) != Analyzer.ArabicWords[SelectedWordIndex].word)
            {
                return;
            }

            for (int i = 0; i < Analyzer.AllWordsInfo[SelectedWordIndex].Count; i++)
            {
                lstPossibilities.Items.Add(Analyzer.AllWordsInfo[SelectedWordIndex][i]);
            }
            txtAnalysis.Text     = "Analysis: " + Interpreter.MeaningOf(Analyzer.AllWordsInfo[SelectedWordIndex][0].Meaning);
            btnModify.IsEnabled  = true;
            btnDetails.IsEnabled = true;
        }
Ejemplo n.º 4
0
 private void txtDiacritics_LostFocus(object sender, RoutedEventArgs e)
 {
     txtWord.Text = Tashkeel.SetTashkeel(Tashkeel.Remove(txtWord.Text), txtDiacritics.Text);
 }
Ejemplo n.º 5
0
        public AnalysisDetails(WordInfo word)
        {
            InitializeComponent();
            txtWord.Text     = word.ToString();
            txtTemplate.Text = word.Template;
            txtRoot.Text     = word.Root.Root;

            txtRootCompatibility.Text = (word.Root.IsCompatible) ? "متوافق" : "غير مؤكد";
            txtDerivative.Text        = word.Root.DerivationType.ToString().Replace('_', ' ');
            txtPrefix.Text            = word.Prefix.Text;
            if (word.Prefix.Meaning.Length > 0)
            {
                txtPrefix.Text += "؛ " + Interpreter.MeaningOf(word.Prefix.Meaning);
            }
            txtSuffix.Text = word.Suffix.Text;
            if (word.Suffix.Meaning.Length > 0)
            {
                txtSuffix.Text += "؛ " + Interpreter.MeaningOf(word.Suffix.Meaning);
            }
            txtMeaning.Text = Interpreter.MeaningOf(word.Meaning) + " " + Interpreter.MeaningOf(word.SpecialClass);
            if (word.Word == "الله" && word.Meaning == "N211")
            {
                txtMeaning.Text += "(لفظ الجلالة الله)";
            }

            if (word.Interpretations != null && word.Interpretations.Count > 0)
            {
                txtInterpretation.Text = word.Interpretations[0].Description;
            }
            string M2;

            M1 = word.Meaning;
            if (M1.StartsWith("V2"))
            {
                txtInterpretation.Text = "فعل مضارع مرفوع بالضمه";
            }

            string word2 = Tashkeel.Remove(word.Word);

            if (word2 == "كان")
            {
                txtInterpretation.Text = "فعل ماض ناقص مبني على الفتح";
            }
            if (word2 == "إن")
            {
                txtInterpretation.Text = ".حرف توكيد ونصب، مبني على الفتح ، لا محل له من الإعراب ";
            }
            if (txtPrefix.Text.StartsWith("و"))
            {
                txtInterpretation.Text += "معطوف ";
            }
            if (word2.StartsWith("ت"))
            {
                txtPrefix.Text = "ت";
            }

            if ((word2 == "من") || (word2 == "على") || (word2 == "الى") || (word2 == "إلى") || (word2 == "فى") || (word2 == "حتى") || (word2 == "عدا") ||
                (word2 == "الى") || (word2 == "لعل") || (word2 == "متى") || (word2 == "كى") || (word2 == "منذ"))
            {
                txtInterpretation.Text = "حرف جر";
            }
            if ((word2 == "لم") || (word2 == "لما") || (txtPrefix.Text.StartsWith("ل")) || (word2 == "لا") || (word.Word == "إنْ"))
            {
                txtInterpretation.Text = " جازمة ، حرف، مبني على السكون، لا محل له من الإعراب";
            }

            if (txtPrefix.Text.StartsWith("ب") || txtPrefix.Text.StartsWith("ك") || txtPrefix.Text.StartsWith("ف") || (word2 == "الى"))
            {
                txtInterpretation.Text = "اسم مجرور بالكسره";
            }



            for (int i = 1; i < Analyzer.ArabicWords.Count - 1; i++)
            {
                M2 = Analyzer.AllWordsInfo[i][0].Word;
                if (M2 == word.Word && M2 != "كان")
                {
                    M1 = Analyzer.AllWordsInfo[i - 1][0].Meaning; M2 = word.Meaning;
                    if (M1.StartsWith("N") && M2.StartsWith("V"))
                    {
                        txtInterpretation.Text = "جمله فعليه فى محل رفع خبر المبتدأ";
                    }
                }

                M2 = Analyzer.AllWordsInfo[i][0].Word;
                if (M2 == word.Word)
                {
                    M1 = Analyzer.AllWordsInfo[i - 1][0].Meaning; M2 = word.Meaning;
                    if (M1.StartsWith("N1") && M2.StartsWith("N2"))
                    {
                        txtInterpretation.Text = "مضاف اليه مجرور بالكسرة";
                    }
                }

                M2 = Analyzer.AllWordsInfo[i][0].Word;
                if (M2 == word.Word)
                {
                    M1 = Analyzer.AllWordsInfo[i - 1][0].Meaning; M2 = word.Meaning;
                    if (M1.StartsWith("T1") && M2.StartsWith("N"))
                    {
                        txtInterpretation.Text = "إسم مجرور بالكسرة";
                    }
                }

                M2 = Analyzer.AllWordsInfo[i][0].Word;
                if (M2 == word.Word)
                {
                    M1 = Analyzer.AllWordsInfo[i - 1][0].Meaning;   M2 = word.Meaning;
                    if (M1 == "V113111" && M2.StartsWith("N"))
                    {
                        txtInterpretation.Text = "إسم" + " " + Tashkeel.Remove(Analyzer.AllWordsInfo[i - 1][0].Word) + " " + "مرفوع بالضمة ";
                    }
                }

                M2 = Analyzer.AllWordsInfo[i][0].Word;
                if (M2 == word.Word && i > 1)
                {
                    M1 = Analyzer.AllWordsInfo[i - 2][0].Meaning; M2 = word.Meaning;
                    if (M1 == "V113111" && M2.StartsWith("N"))
                    {
                        txtInterpretation.Text = "خبر" + " " + Tashkeel.Remove(Analyzer.AllWordsInfo[i - 2][0].Word) + " " + "منصوب بالفتحة ";
                    }
                }



                M2 = Analyzer.AllWordsInfo[i][0].Word;
                if (M2 == word.Word)
                {
                    M1 = Analyzer.AllWordsInfo[i - 1][0].Meaning; M2 = word.Meaning;

                    if (M1 == "T3" && M2.StartsWith("V2"))
                    {
                        txtInterpretation.Text = " .فعل مضارع مجزوم وعلامة جزمه السكون الظاهرة على آخره ";

                        txtWord.Text = txtWord.Text.Replace(txtWord.Text.Substring(txtWord.Text.Length - 1), "ْ");

                        if (txtWord.Text.EndsWith("نْ") && txtWord.Text.Length > 6)
                        {
                            txtWord.Text           = txtWord.Text.Substring(0, txtWord.Text.Length - 2);
                            txtInterpretation.Text = " .فعل مضارع مجزوم وعلامة جزمه حذف النون لأنه من الأفعال الخمسة والألف في محل رفع فاعل ";
                        }

                        if (txtWord.Text.EndsWith("يْ"))
                        {
                            txtWord.Text           = txtWord.Text.Substring(0, txtWord.Text.Length - 2);
                            txtInterpretation.Text = " . فعل مضارع مجزوم وعلامة جزمه حذف حرف العلة من آخره. ";
                        }
                    }
                }
            }

            if (txtInterpretation.Text.Contains("منصوب") && !txtWord.Text.EndsWith("َ") && !txtWord.Text.EndsWith("ً") && !word2.EndsWith("ا") && !word2.EndsWith("و") && !word2.EndsWith("ى") && !word2.EndsWith("ه"))
            {
                txtWord.Text = txtWord.Text.Replace(txtWord.Text.Substring(txtWord.Text.Length - 1), "َ");
            }

            if (txtInterpretation.Text.Contains("مرفوع") && !txtWord.Text.EndsWith("ُ") && !txtWord.Text.EndsWith("ٌ") && !word2.EndsWith("ا") && !word2.EndsWith("و") && !word2.EndsWith("ى") && !word2.EndsWith("ه"))
            {
                txtWord.Text = txtWord.Text.Replace(txtWord.Text.Substring(txtWord.Text.Length - 1), "ُ");
            }

            if (txtInterpretation.Text.Contains("مجرور") && !txtWord.Text.EndsWith("ِ") && !txtWord.Text.EndsWith("ٍ") && !word2.EndsWith("ا") && !word2.EndsWith("ى") && !word2.EndsWith("و") && !word2.EndsWith("ه"))
            {
                txtWord.Text = txtWord.Text.Replace(txtWord.Text.Substring(txtWord.Text.Length - 1), "ِ");
            }

            //txtInterpretation.Text = word.Meaning;
        }
Ejemplo n.º 6
0
        public AllDetails()
        {
            InitializeComponent();

            AnalysisDetails Details;



            int i = 0;

            if (i < Analyzer.ArabicWords.Count - 1)
            {
                selectedWord = Analyzer.AllWordsInfo[i][0];

                Details = new AnalysisDetails(selectedWord);

                word1.Text  = Details.txtWord.Text;
                suf1.Text   = Details.txtSuffix.Text;
                pre1.Text   = Details.txtPrefix.Text;
                root1.Text  = Details.txtRoot.Text;
                parse1.Text = Details.txtInterpretation.Text;
                pat1.Text   = Details.txtTemplate.Text;

                i++;
                string word = Tashkeel.Remove(word1.Text);
                if (word == "كان")
                {
                    parse1.Text = "فعل ماض ناقص مبني على الفتح";
                }
                if (word == "إن")
                {
                    parse1.Text = "حرف توكيد ونصب";
                }
                if (pre1.Text.StartsWith("و"))
                {
                    parse1.Text += "معطوف ";
                }
                if (word.StartsWith("ت"))
                {
                    pre1.Text = "ت";
                }
            }

            if (i < Analyzer.ArabicWords.Count - 1)
            {
                selectedWord = Analyzer.AllWordsInfo[i][0];

                Details     = new AnalysisDetails(selectedWord);
                word2.Text  = Details.txtWord.Text;
                suf2.Text   = Details.txtSuffix.Text;
                pre2.Text   = Details.txtPrefix.Text;
                root2.Text  = Details.txtRoot.Text;
                parse2.Text = Details.txtInterpretation.Text;
                pat2.Text   = Details.txtTemplate.Text;

                i++;
            }
            if (i < Analyzer.ArabicWords.Count - 1)
            {
                selectedWord = Analyzer.AllWordsInfo[i][0];

                Details = new AnalysisDetails(selectedWord);

                word3.Text  = Details.txtWord.Text;
                suf3.Text   = Details.txtSuffix.Text;
                pre3.Text   = Details.txtPrefix.Text;
                root3.Text  = Details.txtRoot.Text;
                parse3.Text = Details.txtInterpretation.Text;
                pat3.Text   = Details.txtTemplate.Text;

                i++;
            }

            if (i < Analyzer.ArabicWords.Count - 1)
            {
                selectedWord = Analyzer.AllWordsInfo[i][0];

                Details = new AnalysisDetails(selectedWord);

                word4.Text  = Details.txtWord.Text;
                suf4.Text   = Details.txtSuffix.Text;
                pre4.Text   = Details.txtPrefix.Text;
                root4.Text  = Details.txtRoot.Text;
                parse4.Text = Details.txtInterpretation.Text;
                pat4.Text   = Details.txtTemplate.Text;

                i++;
            }
            if (i < Analyzer.ArabicWords.Count - 1)
            {
                selectedWord = Analyzer.AllWordsInfo[i][0];

                Details = new AnalysisDetails(selectedWord);

                word5.Text  = Details.txtWord.Text;
                suf5.Text   = Details.txtSuffix.Text;
                pre5.Text   = Details.txtPrefix.Text;
                root5.Text  = Details.txtRoot.Text;
                parse5.Text = Details.txtInterpretation.Text;
                pat5.Text   = Details.txtTemplate.Text;
            }
            if (i < Analyzer.ArabicWords.Count - 1)
            {
                selectedWord = Analyzer.AllWordsInfo[i][0];

                Details = new AnalysisDetails(selectedWord);

                word6.Text  = Details.txtWord.Text;
                suf6.Text   = Details.txtSuffix.Text;
                pre6.Text   = Details.txtPrefix.Text;
                root6.Text  = Details.txtRoot.Text;
                parse6.Text = Details.txtInterpretation.Text;
                pat6.Text   = Details.txtTemplate.Text;
            }
            if (i < Analyzer.ArabicWords.Count - 1)
            {
                selectedWord = Analyzer.AllWordsInfo[i][0];

                Details = new AnalysisDetails(selectedWord);

                word7.Text  = Details.txtWord.Text;
                suf7.Text   = Details.txtSuffix.Text;
                pre7.Text   = Details.txtPrefix.Text;
                root7.Text  = Details.txtRoot.Text;
                parse7.Text = Details.txtInterpretation.Text;
                pat7.Text   = Details.txtTemplate.Text;
            }
            if (i < Analyzer.ArabicWords.Count - 1)
            {
                selectedWord = Analyzer.AllWordsInfo[i][0];

                Details = new AnalysisDetails(selectedWord);

                word8.Text  = Details.txtWord.Text;
                suf8.Text   = Details.txtSuffix.Text;
                pre8.Text   = Details.txtPrefix.Text;
                root8.Text  = Details.txtRoot.Text;
                parse8.Text = Details.txtInterpretation.Text;
                pat8.Text   = Details.txtTemplate.Text;
            }
            string M1 = Analyzer.AllWordsInfo[0][0].Meaning;
            string M2 = Analyzer.AllWordsInfo[1][0].Meaning;

            if (M1.StartsWith("V") && M2 == ("N222112"))
            {
                word2.BackColor = Color.Red;
            }
            if (M1.StartsWith("V2"))
            {
                parse1.Text = "فعل مضارع مرفوع بالضمه";
            }
            if (M1.StartsWith("N") && M2.StartsWith("V"))
            {
                parse2.Text = "جمله فعليه فى محل رفع خبر المبتدأ";
            }
        }
Ejemplo n.º 7
0
 private void btnRemoveDiacrits_Click(object sender, RoutedEventArgs e)
 {
     txtOriginal.Text = Tashkeel.Remove(txtOriginal.Text);
 }