Skip to content

Commit

Permalink
comparison of usage stats of a selected word among all poets #471
Browse files Browse the repository at this point in the history
  • Loading branch information
hrmoh committed Mar 4, 2025
1 parent 988e923 commit 5711ef8
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
31 changes: 30 additions & 1 deletion RMuseum/Controllers/GanjoorController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4348,6 +4348,11 @@ public async Task<IActionResult> GetCategoryWordCountsAsync(int catId, string te
return Ok(pagedResult.Result.Items);
}

/// <summary>
/// category words summary
/// </summary>
/// <param name="catId"></param>
/// <returns></returns>
[HttpGet]
[Route("wordsums/{catId}")]
[AllowAnonymous]
Expand All @@ -4363,8 +4368,32 @@ public async Task<IActionResult> GetCategoryWordCountSummaryAsync(int catId)
return Ok(res.Result);
}

/// <summary>
/// comparison of word counts for poets
/// </summary>
/// <param name="term"></param>
/// <param name="paging"></param>
/// <returns></returns>
[HttpGet]
[Route("wordcounts/bypoet")]
[AllowAnonymous]
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable<PoetOrCatWordStat>))]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]

public async Task<IActionResult> GetCategoryWordCountsByPoetsAsync(string term, [FromQuery] PagingParameterModel paging)
{
var pagedResult = await _ganjoorService.GetCategoryWordCountsByPoetsAsync(term, paging);
if (!string.IsNullOrEmpty(pagedResult.ExceptionString))
return BadRequest(pagedResult.ExceptionString);

// Paging Header
HttpContext.Response.Headers.Append("paging-headers", JsonConvert.SerializeObject(pagedResult.Result.PagingMeta));

return Ok(pagedResult.Result.Items);
}





/*
/// <summary>
Expand Down
23 changes: 23 additions & 0 deletions RMuseum/RMuseum.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2338,6 +2338,21 @@
<param name="paging"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.GanjoorController.GetCategoryWordCountSummaryAsync(System.Int32)">
<summary>
category words summary
</summary>
<param name="catId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.GanjoorController.GetCategoryWordCountsByPoetsAsync(System.String,RSecurityBackend.Models.Generic.PagingParameterModel)">
<summary>
comparison of word counts for poets
</summary>
<param name="term"></param>
<param name="paging"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.GanjoorController.GetTajikPoetsAsync">
<summary>
tajik poets
Expand Down Expand Up @@ -17452,6 +17467,14 @@
<param name="catId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.GetCategoryWordCountsByPoetsAsync(System.String,RSecurityBackend.Models.Generic.PagingParameterModel)">
<summary>
comparison of word counts for poets
</summary>
<param name="term"></param>
<param name="paging"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.TajikImportFromSqlite(System.Int32,System.String)">
<summary>
tajik import from sqlite
Expand Down
8 changes: 8 additions & 0 deletions RMuseum/Services/IGanjoorService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,14 @@ Task<RServiceResult<GanjoorPoemSectionCorrectionViewModel>> ModeratePoemSectionC
/// <returns></returns>
Task<RServiceResult<CategoryWordCountSummary>> GetCategoryWordCountSummaryAsync(int catId);

/// <summary>
/// comparison of word counts for poets
/// </summary>
/// <param name="term"></param>
/// <param name="paging"></param>
/// <returns></returns>
Task<RServiceResult<(PaginationMetadata PagingMeta, PoetOrCatWordStat[] Items)>> GetCategoryWordCountsByPoetsAsync(string term, PagingParameterModel paging);

/// <summary>
/// tajik import from sqlite
/// </summary>
Expand Down

0 comments on commit 5711ef8

Please sign in to comment.