Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
rampaa committed Jan 7, 2025
1 parent 3bd9a08 commit 129ba71
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions JL.Core/Lookup/LookupUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ private static List<LookupResult> BuildEpwingYomichanResult(string kanji, Interm
return results;
}

private static ConcurrentBag<LookupResult> BuildEpwingNazekaResult(
private static List<LookupResult> BuildEpwingNazekaResult(
IDictionary<string, IntermediaryResult> epwingNazekaResults, List<Freq>? freqs, List<Freq>? dbFreqs, bool useDBForPitchDict, Dict? pitchDict)
{
IDictionary<string, Dictionary<string, List<FrequencyRecord>>>? frequencyDicts = null;
Expand All @@ -1233,8 +1233,8 @@ private static ConcurrentBag<LookupResult> BuildEpwingNazekaResult(
});

bool freqsExist = freqs is not null;
ConcurrentBag<LookupResult> results = [];
_ = Parallel.ForEach(epwingNazekaResults.Values, wordResult =>
List<LookupResult> results = [];
foreach (IntermediaryResult wordResult in epwingNazekaResults.Values)
{
bool deconjugatedWord = wordResult.Processes is not null;
int resultCount = wordResult.Results.Count;
Expand Down Expand Up @@ -1266,7 +1266,7 @@ private static ConcurrentBag<LookupResult> BuildEpwingNazekaResult(
results.Add(result);
}
}
});
}

return results;
}
Expand Down Expand Up @@ -1311,7 +1311,7 @@ private static List<LookupResult> BuildEpwingNazekaResult(string kanji, Intermed
return results;
}

private static ConcurrentBag<LookupResult> BuildCustomWordResult(
private static List<LookupResult> BuildCustomWordResult(
Dictionary<string, IntermediaryResult> customWordResults, List<Freq>? wordFreqs, List<Freq>? dbWordFreqs, bool useDBForPitchDict, Dict? pitchDict)
{
IDictionary<string, Dictionary<string, List<FrequencyRecord>>>? frequencyDicts = null;
Expand All @@ -1335,8 +1335,8 @@ private static ConcurrentBag<LookupResult> BuildCustomWordResult(
});

bool freqsExist = wordFreqs is not null;
ConcurrentBag<LookupResult> results = [];
_ = Parallel.ForEach(customWordResults.Values, wordResult =>
List<LookupResult> results = [];
foreach (IntermediaryResult wordResult in customWordResults.Values)
{
bool deconjugatedWord = wordResult.Processes is not null;
int resultCount = wordResult.Results.Count;
Expand Down Expand Up @@ -1368,12 +1368,12 @@ private static ConcurrentBag<LookupResult> BuildCustomWordResult(
results.Add(result);
}
}
});
}

return results;
}

private static ConcurrentBag<LookupResult> BuildCustomNameResult(
private static List<LookupResult> BuildCustomNameResult(
Dictionary<string, IntermediaryResult> customNameResults, bool useDBForPitchDict, Dict? pitchDict)
{
Dictionary<string, IList<IDictRecord>>? pitchAccentDict = null;
Expand All @@ -1383,8 +1383,8 @@ private static ConcurrentBag<LookupResult> BuildCustomNameResult(
pitchAccentDict = YomichanPitchAccentDBManager.GetRecordsFromDB(pitchDict!.Name, searchKeys);
}

ConcurrentBag<LookupResult> results = [];
_ = Parallel.ForEach(customNameResults.Values, customNameResult =>
List<LookupResult> results = [];
foreach (IntermediaryResult customNameResult in customNameResults.Values)
{
int freq = 0;
int resultCount = customNameResult.Results.Count;
Expand Down Expand Up @@ -1412,7 +1412,7 @@ private static ConcurrentBag<LookupResult> BuildCustomNameResult(
results.Add(result);
}
}
});
}

return results;
}
Expand Down
4 changes: 2 additions & 2 deletions JL.Core/Utilities/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public static partial class Utils
{
public static readonly Version JLVersion = new(3, 0, 0);
public static readonly string ApplicationPath = AppContext.BaseDirectory;
public static readonly string ResourcesPath = Path.Join(AppContext.BaseDirectory, "Resources");
public static readonly string ConfigPath = Path.Join(AppContext.BaseDirectory, "Config");
public static readonly string ResourcesPath = Path.Join(ApplicationPath, "Resources");
public static readonly string ConfigPath = Path.Join(ApplicationPath, "Config");
internal static StringPool StringPoolInstance => StringPool.Shared;

[GeneratedRegex(@"\d+", RegexOptions.CultureInvariant)]
Expand Down

0 comments on commit 129ba71

Please sign in to comment.