stats for poems couplet counts in categories

#464
This commit is contained in:
Hamid Reza Mohammadi 2025-01-28 11:20:44 +03:30
parent f3b55100d4
commit a29168696c
6 changed files with 28 additions and 0 deletions

View File

@ -100,6 +100,11 @@ namespace RMuseum.Models.Ganjoor
/// </summary>
public string Language { get; set; }
/// <summary>
/// couplets count
/// </summary>
public int CoupletsCount { get; set; }
/// <summary>
/// top 6 related sections
/// </summary>

View File

@ -9143,6 +9143,11 @@
language, null means farsi
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.GanjoorPoemSection.CoupletsCount">
<summary>
couplets count
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.GanjoorPoemSection.Top6RelatedSections">
<summary>
top 6 related sections

View File

@ -326,6 +326,7 @@ namespace RMuseum.Services.Implementation
PoemFormat = section.PoemFormat,
};
var sectionVerses = FilterSectionVerses(sectionCopy, targetPoemVerses);
sectionCopy.CoupletsCount = sectionVerses.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count();
sectionCopy.HtmlText = PrepareHtmlText(sectionVerses);
sectionCopy.PlainText = PreparePlainText(sectionVerses);
try
@ -524,6 +525,7 @@ namespace RMuseum.Services.Implementation
PoemFormat = section.PoemFormat,
};
var sectionVerses = FilterSectionVerses(sectionCopy, targetPoemVerses);
sectionCopy.CoupletsCount = sectionVerses.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count();
sectionCopy.HtmlText = PrepareHtmlText(sectionVerses);
sectionCopy.PlainText = PreparePlainText(sectionVerses);
try

View File

@ -532,6 +532,7 @@ namespace RMuseum.Services.Implementation
PlainText = mainSection.PlainText,
PoemFormat = mainSection.PoemFormat,
};
secondMetreSection.CoupletsCount = poemVerses.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count();
_context.Add(secondMetreSection);
sections.Add(secondMetreSection);
@ -561,6 +562,7 @@ namespace RMuseum.Services.Implementation
PoemFormat = secondLevelSections.PoemFormat,
GanjoorMetreRefSectionIndex = secondMetreSection.Index,
};
newSection.CoupletsCount = poemVerses.Where(v => v.SectionIndex2 == secondLevelSections.Index && (v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1)).Count();
_context.Add(newSection);
sections.Add(newSection);

View File

@ -461,6 +461,7 @@ namespace RMuseum.Services.Implementation
bool sectionCopyBecameMasnavi = false;
var sectionCopyVerses = FilterSectionVerses(sectionCopy, verses);
sectionCopy.CoupletsCount = sectionCopyVerses.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count();
sectionCopy.HtmlText = PrepareHtmlText(sectionCopyVerses);
sectionCopy.PlainText = PreparePlainText(sectionCopyVerses);
sectionCopy.RhymeLetters = LanguageUtils.FindRhyme(sectionCopyVerses).Rhyme;
@ -539,6 +540,7 @@ namespace RMuseum.Services.Implementation
}
var relatedSectionCopyVerses = FilterSectionVerses(relatedSectionCopy, verses);
relatedSectionCopy.CoupletsCount = relatedSectionCopyVerses.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count();
relatedSectionCopy.HtmlText = PrepareHtmlText(relatedSectionCopyVerses);
relatedSectionCopy.PlainText = PreparePlainText(relatedSectionCopyVerses);
relatedSectionCopy.RhymeLetters = LanguageUtils.FindRhyme(relatedSectionCopyVerses).Rhyme;
@ -591,6 +593,7 @@ namespace RMuseum.Services.Implementation
leftVerse.SectionIndex2 = verseSection.Index;
var rl = new List<GanjoorVerse>(); rl.Add(rightVerse); rl.Add(leftVerse);
verseSection.CoupletsCount = rl.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count();
verseSection.HtmlText = PrepareHtmlText(rl);
verseSection.PlainText = PreparePlainText(rl);
verseSection.Modified = true;
@ -629,6 +632,7 @@ namespace RMuseum.Services.Implementation
leftVerse.SectionIndex2 = verseSection.Index;
var rl = new List<GanjoorVerse>(); rl.Add(rightVerse); rl.Add(leftVerse);
verseSection.CoupletsCount = rl.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count();
verseSection.HtmlText = PrepareHtmlText(rl);
verseSection.PlainText = PreparePlainText(rl);
verseSection.Modified = true;

View File

@ -337,6 +337,7 @@ namespace RMuseum.Services.Implementation
RhymeLetters = poem.RhymeLetters,
HtmlText = PrepareHtmlText(singleVerses),
PlainText = PreparePlainText(singleVerses),
CoupletsCount = singleVerses.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count(),
PoemFormat = GanjoorPoemFormat.New,
};
context.Add(mainSection);//having a main section for مثنوی inside normal text helps keep track of related versess
@ -408,6 +409,7 @@ namespace RMuseum.Services.Implementation
RhymeLetters = poem.RhymeLetters,
HtmlText = PrepareHtmlText(singleVerses),
PlainText = PreparePlainText(singleVerses),
CoupletsCount = singleVerses.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count(),
PoemFormat = GanjoorPoemFormat.New,
};
context.Add(mainSection);//having a main section for مثنوی inside normal text helps keep track of related versess
@ -454,6 +456,7 @@ namespace RMuseum.Services.Implementation
RhymeLetters = poem.RhymeLetters,
HtmlText = PrepareHtmlText(nonCommentVerses),
PlainText = PreparePlainText(nonCommentVerses),
CoupletsCount = nonCommentVerses.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count(),
PoemFormat = GanjoorPoemFormat.MultiBand,
};
if (poem.FullTitle.Contains("ترجیع"))
@ -506,6 +509,7 @@ namespace RMuseum.Services.Implementation
}
currentBandSection.RhymeLetters = LanguageUtils.FindRhyme(currentBandVerses).Rhyme;
currentBandSection.HtmlText = PrepareHtmlText(currentBandVerses);
currentBandSection.CoupletsCount = currentBandVerses.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count();
currentBandSection.PlainText = PreparePlainText(currentBandVerses);
context.Add(currentBandSection);
@ -533,6 +537,7 @@ namespace RMuseum.Services.Implementation
currentBandVerse.SectionIndex2 = currentBandSection.Index;
}
currentBandSection.RhymeLetters = LanguageUtils.FindRhyme(currentBandVerses).Rhyme;
currentBandSection.CoupletsCount = currentBandVerses.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count();
currentBandSection.HtmlText = PrepareHtmlText(currentBandVerses);
currentBandSection.PlainText = PreparePlainText(currentBandVerses);
context.Add(currentBandSection);
@ -598,6 +603,7 @@ namespace RMuseum.Services.Implementation
var rl = new List<GanjoorVerse>(); rl.Add(rightVerse); rl.Add(leftVerse);
verseSection.HtmlText = PrepareHtmlText(rl);
verseSection.PlainText = PreparePlainText(rl);
verseSection.CoupletsCount = rl.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count();
context.Add(verseSection);
}
@ -608,6 +614,7 @@ namespace RMuseum.Services.Implementation
}
bandSection.HtmlText = PrepareHtmlText(bandVerses);
bandSection.PlainText = PreparePlainText(bandVerses);
bandSection.CoupletsCount = bandVerses.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count();
context.Add(mainSection);
context.Add(bandSection);
context.UpdateRange(nonCommentVerses);
@ -628,6 +635,7 @@ namespace RMuseum.Services.Implementation
RhymeLetters = poem.RhymeLetters,
HtmlText = PrepareHtmlText(nonCommentVerses),
PlainText = PreparePlainText(nonCommentVerses),
CoupletsCount = nonCommentVerses.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count(),
PoemFormat = GanjoorPoemFormat.Unknown,
};
//checking for مثنوی phase 1
@ -689,6 +697,7 @@ namespace RMuseum.Services.Implementation
var rl = new List<GanjoorVerse>(); rl.Add(rightVerse); rl.Add(leftVerse);
verseSection.HtmlText = PrepareHtmlText(rl);
verseSection.PlainText = PreparePlainText(rl);
verseSection.CoupletsCount = rl.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count();
context.Add(verseSection);
}
@ -1069,6 +1078,7 @@ namespace RMuseum.Services.Implementation
var rl = new List<GanjoorVerse>(); rl.Add(rightVerse); rl.Add(leftVerse);
verseSection.HtmlText = PrepareHtmlText(rl);
verseSection.PlainText = PreparePlainText(rl);
verseSection.CoupletsCount = rl.Where(v => v.VersePosition == VersePosition.Left || v.VersePosition == VersePosition.CenteredVerse1).Count();
context.Add(verseSection);