comparison of usage stats of a selected word among all poets #471

This commit is contained in:
Hamid Reza Mohammadi 2025-03-06 12:06:12 +03:30
parent 867bd13634
commit 9db3a30d86
3 changed files with 36 additions and 8 deletions

View File

@ -41,6 +41,7 @@
window.location.href = currentUrl.toString();
}
</script>
</head>
<body>
@ -203,12 +204,16 @@
else
{
<div class="sitem" id="wordcounts-placeholder">
<a href="javascript:loadWordCountsByPoet('@Model.Query')" id="load-word-counts" class="pagebutton comments-link">
بسامد واژگان به تفکیک سخنور
<svg class="noindent-info-button" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#5f6368"><g><rect fill="none" height="24" width="24" /></g><g><g><g><path d="M7.5,4C5.57,4,4,5.57,4,7.5S5.57,11,7.5,11S11,9.43,11,7.5S9.43,4,7.5,4z M7.5,9C6.67,9,6,8.33,6,7.5S6.67,6,7.5,6 S9,6.67,9,7.5S8.33,9,7.5,9z M16.5,13c-1.93,0-3.5,1.57-3.5,3.5s1.57,3.5,3.5,3.5s3.5-1.57,3.5-3.5S18.43,13,16.5,13z M16.5,18 c-0.83,0-1.5-0.67-1.5-1.5s0.67-1.5,1.5-1.5s1.5,0.67,1.5,1.5S17.33,18,16.5,18z M5.41,20L4,18.59L18.59,4L20,5.41L5.41,20z" /></g></g></g></svg>
</a>
</div>
@if(Model.QueryIsSingleWord)
{
<div class="sitem" id="wordcounts-placeholder">
<a href="javascript:loadWordCountsByPoet('@Model.Query')" id="load-word-counts" class="pagebutton comments-link">
مشاهدهٔ بسامد واژگان «@Model.Query» به تفکیک سخنور
<svg class="noindent-info-button" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#5f6368"><g><rect fill="none" height="24" width="24" /></g><g><g><g><path d="M7.5,4C5.57,4,4,5.57,4,7.5S5.57,11,7.5,11S11,9.43,11,7.5S9.43,4,7.5,4z M7.5,9C6.67,9,6,8.33,6,7.5S6.67,6,7.5,6 S9,6.67,9,7.5S8.33,9,7.5,9z M16.5,13c-1.93,0-3.5,1.57-3.5,3.5s1.57,3.5,3.5,3.5s3.5-1.57,3.5-3.5S18.43,13,16.5,13z M16.5,18 c-0.83,0-1.5-0.67-1.5-1.5s0.67-1.5,1.5-1.5s1.5,0.67,1.5,1.5S17.33,18,16.5,18z M5.41,20L4,18.59L18.59,4L20,5.41L5.41,20z" /></g></g></g></svg>
</a>
</div>
}
for (int poemIndex = 0; poemIndex < Model.Poems.Count; poemIndex++)
{
@ -279,6 +284,14 @@
}
}
@if (Model.QueryIsSingleWord)
{
<script>
loadWordCountsByPoet('@Model.QueryDin');
</script>
}
</body>

View File

@ -13,7 +13,6 @@ using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using RMuseum.Models.Ganjoor;
using RMuseum.Models.Ganjoor.ViewModels;
using RMuseum.Services.Implementation;
using RSecurityBackend.Models.Generic;
@ -69,6 +68,14 @@ namespace GanjooRazor.Pages
public List<GanjoorPoetViewModel> Poets { get; set; }
public string Query { get; set; }
public bool QueryIsSingleWord
{
get
{
return !string.IsNullOrEmpty(Query) && Query.IndexOfAny([' ', '‌']) == -1;
}
}
public int PoetId { get; set; }
public int CatId { get; set; }
public string CatFullTitle { get; set; }
@ -153,6 +160,14 @@ namespace GanjooRazor.Pages
public bool ExactSearch { get; set; }
public string QueryDin
{
get
{
return Request.Query["s"].ApplyCorrectYeKe().Trim();
}
}
public async Task<IActionResult> OnGetAsync()
{
if (bool.Parse(Configuration["MaintenanceMode"]))

View File

@ -5,7 +5,7 @@
@if (Model.WordStats.Length > 0)
{
<p>
این واژه در مجموع @RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.WordStats.Sum(w => w.Count)) بار در گنجور ظاهر شده است که سهم هر سخنور در جدول زیر مشخص شده است.
«@Model.Term» در مجموع @RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.WordStats.Sum(w => w.Count)) بار در گنجور ظاهر شده است که سهم هر سخنور در جدول زیر مشخص شده است.
</p>
<table class="stats" id="words-stats">
<thead>