Skip to content

Commit f3a0101

Browse files
author
Yanan Wang
committed
Add cache for load data
1 parent 739441d commit f3a0101

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/Plugins/BotSharp.Plugin.FuzzySharp/Services/TextAnalysisService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public async Task<TextAnalysisResponse> AnalyzeTextAsync(TextAnalysisRequest req
3838
var tokens = TextTokenizer.Tokenize(request.Text);
3939

4040
// Load vocabulary
41+
// TODO: read the vocabulary from GSMP in Onebrain
4142
var vocabulary = await _vocabularyService.LoadVocabularyAsync(request.VocabularyFolderName);
4243

4344
// Load domain term mapping

src/Plugins/BotSharp.Plugin.FuzzySharp/Services/VocabularyService.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using BotSharp.Abstraction.FuzzSharp;
2+
using BotSharp.Core.Infrastructures;
23
using CsvHelper;
34
using CsvHelper.Configuration;
45
using Microsoft.Extensions.Logging;
@@ -16,6 +17,7 @@ public VocabularyService(ILogger<VocabularyService> logger)
1617
_logger = logger;
1718
}
1819

20+
[SharpCache(60)]
1921
public async Task<Dictionary<string, HashSet<string>>> LoadVocabularyAsync(string? foldername)
2022
{
2123
var vocabulary = new Dictionary<string, HashSet<string>>();
@@ -50,6 +52,7 @@ public async Task<Dictionary<string, HashSet<string>>> LoadVocabularyAsync(strin
5052
return vocabulary;
5153
}
5254

55+
[SharpCache(60)]
5356
public async Task<Dictionary<string, (string DbPath, string CanonicalForm)>> LoadDomainTermMappingAsync(string? filename)
5457
{
5558
var result = new Dictionary<string, (string DbPath, string CanonicalForm)>();

0 commit comments

Comments
 (0)