namespace DramaLing.Api.Models.Configuration;
///
/// 智能複習系統配置選項
///
public class SpacedRepetitionOptions
{
public const string SectionName = "SpacedRepetition";
///
/// 間隔增長係數 (基於演算法規格書)
///
public GrowthFactors GrowthFactors { get; set; } = new();
///
/// 逾期懲罰係數
///
public OverduePenalties OverduePenalties { get; set; } = new();
///
/// 記憶衰減率 (每天百分比)
///
public double MemoryDecayRate { get; set; } = 0.05;
///
/// 最大間隔天數
///
public int MaxInterval { get; set; } = 365;
///
/// A1學習者保護門檻
///
public int A1ProtectionLevel { get; set; } = 20;
///
/// 新用戶預設程度
///
public int DefaultUserLevel { get; set; } = 50;
}
///
/// 間隔增長係數配置
///
public class GrowthFactors
{
///
/// 短期間隔係數 (≤7天)
///
public double ShortTerm { get; set; } = 1.8;
///
/// 中期間隔係數 (8-30天)
///
public double MediumTerm { get; set; } = 1.4;
///
/// 長期間隔係數 (31-90天)
///
public double LongTerm { get; set; } = 1.2;
///
/// 超長期間隔係數 (>90天)
///
public double VeryLongTerm { get; set; } = 1.1;
///
/// 根據當前間隔獲取增長係數
///
/// 當前間隔天數
/// 對應的增長係數
public double GetGrowthFactor(int currentInterval)
{
return currentInterval switch
{
<= 7 => ShortTerm,
<= 30 => MediumTerm,
<= 90 => LongTerm,
_ => VeryLongTerm
};
}
}
///
/// 逾期懲罰係數配置
///
public class OverduePenalties
{
///
/// 輕度逾期係數 (1-3天)
///
public double Light { get; set; } = 0.9;
///
/// 中度逾期係數 (4-7天)
///
public double Medium { get; set; } = 0.75;
///
/// 重度逾期係數 (8-30天)
///
public double Heavy { get; set; } = 0.5;
///
/// 極度逾期係數 (>30天)
///
public double Extreme { get; set; } = 0.3;
///
/// 根據逾期天數獲取懲罰係數
///
/// 逾期天數
/// 對應的懲罰係數
public double GetPenaltyFactor(int overdueDays)
{
return overdueDays switch
{
<= 0 => 1.0, // 準時,無懲罰
<= 3 => Light, // 輕度逾期
<= 7 => Medium, // 中度逾期
<= 30 => Heavy, // 重度逾期
_ => Extreme // 極度逾期
};
}
}