public static string DiacritizeWord(WordInfo Word) { StringBuilder sb = new StringBuilder(); if (Word.Prefix.WordClass.StartsWith("N2")) { if (Tashkeel.SilentLam(Word.Word[0])) { //لام شمسية Word.Prefix.Tashkeel = Word.Prefix.Tashkeel.Substring(0, Word.Prefix.Tashkeel.Length - 1) + '9'; Word.Diacritics = (char)(Word.Diacritics[0] + 3) + Word.Diacritics.Substring(1); } } sb.Append(Word.Prefix.Tashkeel); if (Word.Suffix.ConnectedLetter != "") { if (Word.Diacritics.EndsWith("#")) { Word.Diacritics = Word.Diacritics.Replace('#', (char)(Word.Suffix.ConnectedLetter[0] + 3)); } else { Word.Diacritics = Word.Diacritics.Replace('!', Word.Suffix.ConnectedLetter[0]); } } sb.Append(Word.Diacritics); sb.Append(Word.Suffix.Tashkeel); return(sb.ToString()); }
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(); }
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); }
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; }
public static List <string[]> CheckWordMask(string word, string mask, List <string> Meanings, List <string[]> Results) { OleDbCommand com = new OleDbCommand("select * from WordTemplates where Mask='" + mask + "'", Analyzer.con); OleDbDataReader dread = com.ExecuteReader(); string[] fields; while (dread.Read()) { //اختبار توافق تشكيل الوزن مع حروف الكلمة if (dread["Class"].ToString().StartsWith("V2"))//إذا كان وزن فعل مضارع { if (!Tashkeel.CheckTashkeel(word, dread[1].ToString().Substring(1))) { continue; //استثناء حرف المضارعة } } else if (!Tashkeel.CheckTashkeel(word, dread[1].ToString())) { continue; } //اختبار توافق نوع الوزن مع النوع المتوقع foreach (string M in Meanings) { string MergedMeaning; if (Interpreter.CompareMeanings(dread["Class"].ToString(), M, out MergedMeaning)) { fields = new string[8]; fields[0] = dread[0].ToString(); fields[1] = dread[1].ToString(); fields[2] = dread[2].ToString(); fields[3] = MergedMeaning; fields[4] = dread[5].ToString(); fields[5] = dread[6].ToString(); fields[6] = dread[7].ToString(); fields[7] = dread[8].ToString(); Results.Add(fields); } } } dread.Close(); return(Results); }
private void txtDiacritics_LostFocus(object sender, RoutedEventArgs e) { txtWord.Text = Tashkeel.SetTashkeel(Tashkeel.Remove(txtWord.Text), txtDiacritics.Text); }
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; }
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 = "جمله فعليه فى محل رفع خبر المبتدأ"; } }
public static string AnalyzeText(string TextToParse, ref BackgroundWorker BackGroundProcess) { //TextToParse = Tashkeel.Remove(TextToParse); Analyzer.TextToParse = TextToParse; Corrections = 0; NotRecognized = 0; ArabicWords = ExtractArabicWords(TextToParse, out Sentences); //للاحتفاظ باحتمالات النطق المختلفة لكل كلمة لأغراض التعديل AllWordsInfo = new List <List <WordInfo> >(); con.Open(); LoadInterpreterData(); for (int i = 0; i < ArabicWords.Count; i++) //التحليل الصرفي { if (ArabicWords[i].word == "EOS") //نهاية جملة { List <WordInfo> EOS = new List <WordInfo>(); EOS.Add(new WordInfo { Word = "EOS" }); AllWordsInfo.Add(EOS); continue; } List <WordInfo> NewWordInfo = ProcessWord(ArabicWords[i]); //ابدأ معالجة الكلمة الجديدة AllWordsInfo.Add(NewWordInfo); //أضف ناتج المعالجة لمعلومات الكلمات if (NewWordInfo.Count == 0) //إذا لم يجد تفسير للكلمة { NewWordInfo = Morphology.LookForForignWord(ArabicWords[i].word, NewWordInfo); //ابحث في الكلمات الأعجمية المخزنة if (NewWordInfo.Count == 0) { //فشل تفسير الكلمة والتشكيل بناء على تتابع الحروف -غالبا للكلمات الأعجمية //هذه الخوارزمية تحتاج تحسين //للتعامل مع الكلمات الأعجمية المضاف لها ألف ولام أو ياء نسب WordInfo NewWord = new WordInfo(); NewWord.Word = ArabicWords[i].word; NewWord.Diacritics = Tashkeel.Guess(ArabicWords[i].word); NewWord.Meaning = "N"; NewWordInfo.Add(NewWord); NotRecognized += 1; } } BackGroundProcess.ReportProgress((i + 1) * 100 / ArabicWords.Count);//تحديث شريط التقدم } for (int i = 0; i < ArabicWords.Count; i++) { int Longest = 0, Index = 0; List <GrammarRelation> PossibleRelations = Interpreter.StartInterpreting(i, "", 1, false); for (int PR = 0; PR < PossibleRelations.Count; PR++) { if (Longest < PossibleRelations[PR].WordsCovered) { Longest = PossibleRelations[PR].WordsCovered; Index = PR; } //Interpreter.ApplyGrammarRelation(PossibleRelations[PR]); } i += Longest; if (PossibleRelations.Count > 0) { GrammarRelation.ApplyGrammarRelation(PossibleRelations[Index]); PossibleRelations[Index].ActivateRelation(); } } con.Close(); return(GenerateOutput()); }
private static List <WordInfo> ProcessWord(ArabicWord WordToProcess) { List <WordInfo> CurrentWordInfo = new List <WordInfo>(); WordInfo NewInfo; Morphology.CheckForSpecialWord(WordToProcess, ref CurrentWordInfo); Morphology.CheckForPronoun(WordToProcess, ref CurrentWordInfo); if (FastAnalysis && CurrentWordInfo.Count > 0) //للاكتفاء باحتمالات الكلمات الخاصة وعدم البحث عن تحليل صرفي لأسماء أو أفعال { return(CurrentWordInfo); } List <WordPrefix> ValidPrefixes = WordPrefix.CheckPrefix(WordToProcess.word); List <WordSuffix> ValidSuffixes = WordSuffix.CheckSuffixes(WordToProcess.word); //المعاني الافتراضية عند عدم وجود إضافات ValidPrefixes.Add(new WordPrefix() { WordClass = "N1" }); //الأسماء نكرة ValidPrefixes.Add(new WordPrefix() { WordClass = "V1" }); //فعل ماض ValidPrefixes.Add(new WordPrefix() { WordClass = "V3" }); //فعل أمر ValidSuffixes.Add(new WordSuffix() { WordClass = "N0001" }); //اسم مذكر ValidSuffixes.Add(new WordSuffix() { WordClass = "V10311" }); //فعل ماض غائب مفرد مذكر ValidSuffixes.Add(new WordSuffix() { WordClass = "V20211" }); //فعل مضارع مخاطب مفرد مذكر ValidSuffixes.Add(new WordSuffix() { WordClass = "V201" }); //فعل مضارع متكلم ValidSuffixes.Add(new WordSuffix() { WordClass = "V2031" }); //فعل مضارع غائب مفرد ValidSuffixes.Add(new WordSuffix() { WordClass = "V30011" }); //فعل أمر مفرد مذكر List <string[]> Result = new List <string[]>(); string Stem; for (int i = 0; i < ValidPrefixes.Count; i++) { for (int j = 0; j < ValidSuffixes.Count; j++) { Result = new List <string[]>(); if (WordToProcess.word.Length <= (ValidSuffixes[j].Text.Length + ValidPrefixes[i].Text.Length)) { //طول الإضافات يغطي طول الكلمة بأكملها continue; } List <string> CompatibleAdditions = Morphology.CheckAdditionsCompatibility(ValidPrefixes[i].WordClass, ValidSuffixes[j].WordClass); if (CompatibleAdditions.Count == 0) { //إضافات غير متوافقة continue; } Stem = WordToProcess.word.Substring(ValidPrefixes[i].Text.Length, WordToProcess.word.Length - (ValidPrefixes[i].Text.Length + ValidSuffixes[j].Text.Length)); //ابحث عن الأوزان المتوافقة مع الإضافات المحددة Result = Morphology.LookForTemplate(Stem, CompatibleAdditions, Result); if (Result.Count == 0) { continue; } /* اختبار وجود جذر للكلمة متوافق مع الوزن المحدد * واختبار توافق الجذر الموجود مع هذا الوزن * يمكن الاستغناء عن بعض هذه الخطوات عند إكمال قاعدة البيانات * */ #region اختبار توافق الوزن والجذر string[] CurrentResult; ArabicRoot CurrentRoot = new ArabicRoot(); List <ArabicRoot> CheckRootResults = new List <ArabicRoot>(); for (int R = 0; R < Result.Count; R++) { CurrentResult = Result[R]; bool RootResult = Morphology.CheckRoot(Stem, CurrentResult[2], CurrentResult[4], CurrentResult[5], CurrentResult[6], CurrentResult[7], ref CurrentResult[3], ref CurrentRoot); if (!RootResult) //اختبار وجود الجذر حسب الوزن { Result.RemoveAt(R); R--; } else { if (CurrentRoot.IsCompatible) { for (int prev = 0; prev < R; prev++) { //عثر على جذر متوافق احذف كل الأوزان السابقة التي ليس لها جذور متوافقة if (!CheckRootResults[prev].IsCompatible) { Result.RemoveAt(prev); CheckRootResults.RemoveAt(prev); R--; prev--; } } CheckRootResults.Add(CurrentRoot); } else { bool AddThisOne = true; for (int prev = 0; prev < R; prev++) { if (CheckRootResults[prev].IsCompatible) { AddThisOne = false; //عثر من قبل على جذور متوافقة لها أولوية Result.RemoveAt(R--); break; } //مفاضلة الأوزان من نفس قاعدة الاشتقاق byte CompareResult = Morphology.CompareRules(CurrentResult[7], Result[prev][7]); if (CompareResult == 1) { CheckRootResults.RemoveAt(prev); Result.RemoveAt(prev--); R--; } else if (CompareResult == 2)//الوزن المضاف مسبقا أولى { AddThisOne = false; Result.RemoveAt(R--); break; } } if (AddThisOne) { CheckRootResults.Add(CurrentRoot); } } } } #endregion for (int R = 0; R < Result.Count; R++) { NewInfo = new WordInfo(); NewInfo.Word = Stem; NewInfo.Diacritics = Result[R][1]; NewInfo.Prefix = ValidPrefixes[i]; NewInfo.Suffix = ValidSuffixes[j]; Tashkeel.DiacritizeWord(NewInfo); if (!IgnoreExistingDiacritics && !CheckOriginalDiacritics(WordToProcess.Original, NewInfo.FullDiacritics)) { continue; } NewInfo.Template = Result[R][0]; NewInfo.Meaning = Result[R][3]; NewInfo.Root = CheckRootResults[R]; CurrentWordInfo.Add(NewInfo); } } } for (int W = 0; W < CurrentWordInfo.Count; W++) { if (CurrentWordInfo[W].Root.IsCompatible) { WordInfo Temp; for (int prev = W; prev > 0; prev--) { Temp = CurrentWordInfo[prev]; CurrentWordInfo[prev] = CurrentWordInfo[prev - 1]; CurrentWordInfo[prev - 1] = Temp; } } } CurrentWordInfo = RecallCorrections(WordToProcess, CurrentWordInfo); return(CurrentWordInfo); }
private void btnRemoveDiacrits_Click(object sender, RoutedEventArgs e) { txtOriginal.Text = Tashkeel.Remove(txtOriginal.Text); }
public override string ToString() { return(Tashkeel.SetTashkeel(Prefix.Text + Word + Suffix.Text, InterpretedDiacritics)); }