mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: minor refactoring
This commit is contained in:
parent
3ed21b40a7
commit
1281c9e23b
@ -219,9 +219,13 @@ export class BlockService extends BaseService<
|
||||
|
||||
// Proceed with matching the best NLP block
|
||||
if (matchesWithPatterns.length > 0) {
|
||||
const matchedBlocks = matchesWithPatterns.map((m) => m.block);
|
||||
const matchedPatterns = matchesWithPatterns.map(
|
||||
(p) => p.matchedPattern,
|
||||
);
|
||||
block = await this.matchBestNLP(
|
||||
matchesWithPatterns.map((m) => m.block),
|
||||
matchesWithPatterns.map((p) => p.matchedPattern),
|
||||
matchedBlocks,
|
||||
matchedPatterns,
|
||||
nlp,
|
||||
nluPenaltyFactor,
|
||||
);
|
||||
@ -447,8 +451,8 @@ export class BlockService extends BaseService<
|
||||
nlpCacheMap: NlpCacheMap,
|
||||
nlpPenaltyFactor: number,
|
||||
): number {
|
||||
// Compute individual pattern scores using the cache
|
||||
if (!patterns.length) return 0;
|
||||
// Compute individual pattern scores using the cache
|
||||
const patternScores: number[] = patterns.map((pattern) => {
|
||||
const entityData = nlpCacheMap.get(pattern.entity);
|
||||
if (!entityData) return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user