Spaces:
Sleeping
Sleeping
Download src/core-engine/knowledge-source.ts from luoleyuan/ziweidoushu: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/spaces/luoleyuan/ziweidoushu/resolve/main/src/core-engine/knowledge-source.ts
- Command line
-
hf download hf://spaces/luoleyuan/ziweidoushu/src/core-engine/knowledge-source.ts
-
curl -L -o knowledge-source.ts https://huggingface.co/spaces/luoleyuan/ziweidoushu/resolve/main/src/core-engine/knowledge-source.ts
1.3 kB
| import { TIANJI_DICTIONARY } from './tianji-dictionary'; | |
| import { BONUS_RULES, PENALTY_RULES, CONFLICT_RESOLUTION, ScoreRule } from './scoring-tables'; | |
| export interface AdviceItem { | |
| rule: string; | |
| content: string; | |
| } | |
| export interface ConflictRuleDef { | |
| priority: number; | |
| name: string; | |
| condition: (hasLu: boolean, hasJi: boolean, hasGoodPattern?: boolean, hasBadInteraction?: boolean) => boolean; | |
| action: string; | |
| } | |
| export interface IKnowledgeSource { | |
| getPatternAdvices(): Record<string, AdviceItem>; | |
| getSihuaAdvices(): Record<string, AdviceItem>; | |
| getStarsAdvices(): Record<string, AdviceItem>; | |
| getGeneralAdvices(): Record<string, AdviceItem>; | |
| getBonusRules(): Record<string, ScoreRule>; | |
| getPenaltyRules(): Record<string, ScoreRule>; | |
| getConflictRules(): ConflictRuleDef[]; | |
| } | |
| export class LocalKnowledgeSource implements IKnowledgeSource { | |
| getPatternAdvices() { return TIANJI_DICTIONARY.patterns; } | |
| getSihuaAdvices() { return TIANJI_DICTIONARY.sihua; } | |
| getStarsAdvices() { return TIANJI_DICTIONARY.stars; } | |
| getGeneralAdvices() { return TIANJI_DICTIONARY.general; } | |
| getBonusRules() { return BONUS_RULES; } | |
| getPenaltyRules() { return PENALTY_RULES; } | |
| getConflictRules() { return CONFLICT_RESOLUTION; } | |
| } | |
| export const knowledgeSource = new LocalKnowledgeSource(); |