private void WriteVerse(CorpusVerse corpusVerse) { var words = new List <AnalysisWordVM>(); foreach (var word in corpusVerse.Words) { var analysisWordParts = word.Parts .Select(x => new AnalysisWordPartVM( root: x.Root, type: x.TypeCode, form: x.Form, description: x.TypeDescription, decorators: x.Decorators.Select(d => d.Trim()))); var analysisWord = new AnalysisWordVM( wordNumber: word.Index, english: word.English, buckwalter: word.Buckwalter, wordParts: analysisWordParts); words.Add(analysisWord); } var verseAnalysis = new VerseAnalysisVM( chapterNumber: corpusVerse.Reference.Chapter, verseNumber: corpusVerse.Reference.Verse, words: words); VerseAnalysisWriteRepository.Write(verseAnalysis); }
public Analysis_Verse(int chapter, int verse) { QuranVerseHelper.Clip( chapter: ref chapter, verse: ref verse ); this.Chapter = SharedData.Document.QuranDocument[chapter]; this.Verse = SharedData.Document.CorpusDocument[chapter, verse]; }
void ReadVerseWords(XElement verseNode, CorpusVerse corpusVerse) { var wordNodes = verseNode .Element("words") .Elements("word") .ToList(); for (int index = 0; index < wordNodes.Count; index++) { XElement currentWordNode = wordNodes[index]; ReadVerseWord( wordNode: currentWordNode, corpusVerse: corpusVerse, index: index ); } }
void ReadVerse(Tuple <int, XElement> verse) { int chapterIndex = verse.Item1; XElement verseNode = verse.Item2; int verseIndex = int.Parse(verseNode.Attribute("index").Value); string arabicText = verseNode.Element("arabicText").Value; var reference = new VerseReference( chapter: verse.Item1, verse: verseIndex ); var corpusVerse = new CorpusVerse( reference: reference, arabicText: arabicText ); Document.AddVerse(corpusVerse); ReadVerseWords(verseNode, corpusVerse); }
void ReadVerseWord(XElement wordNode, CorpusVerse corpusVerse, int index) { string buckwalter = wordNode.Element("buckwalter").Value; string english = wordNode.Element("english").Value; var reference = new MultiPartReference( new string[] { corpusVerse.Reference.Chapter.ToString(), corpusVerse.Reference.Verse.ToString(), (index + 1).ToString() } ); var corpusVerseWord = new CorpusVerseWord( index: index + 1, buckwalter: buckwalter, english: english ); corpusVerse.AddWord(corpusVerseWord); ReadWordParts(wordNode, corpusVerseWord); }