class CwCardUtils::DecklistParser::ArchetypeDetector
Public: Detects deck archetypes and color/tribe labels. 日本語: デッキのアーキタイプと色/部族ラベルを検出します。
Attributes
Public Class Methods
Source
# File lib/cw_card_utils/decklist_parser/archetype_detector.rb, line 15 def initialize(deck) @deck = deck @format = deck.format.to_s.downcase # :standard, :edh, etc. @tribe = deck.tribe&.capitalize # e.g., "Cat" @colors = resolve_color_identity(deck) @tag_counts = Hash.new(0) @tag_ratios = {} count_tags calculate_ratios end
Public: Initialize with a deck. 日本語: デッキで初期化します。
@param deck [CwCardUtils::DecklistParser::Deck] @return [void]
Public Instance Methods
Source
# File lib/cw_card_utils/decklist_parser/archetype_detector.rb, line 41 def detect archetype = detect_archetype color_label = resolve_color_label(colors) tribe_label = tribe ? " #{tribe} Tribal" : "" archetype_label = " #{archetype.to_s.capitalize}" [color_label, tribe_label, archetype_label].join.strip.squeeze(" ") end
Public: Full label, e.g., “Azorius Cat Tribal Midrange”. 日本語: 例 “Azorius Cat Tribal Midrange” のような完全ラベルを返します。
Intent (EN): Converts detected color identity, dominant tribe, and archetype into a concise human-readable label. Color comes from identity resolution, tribe from majority subtype, and archetype from heuristics over tag counts/ratios and average CMC.
意図 (JA): 検出した色アイデンティティ、優勢トライブ、アーキタイプを人が読みやすい短いラベルへ変換します。色はアイデンティティ解決、トライブは多数派サブタイプ、アーキタイプはタグ頻度/比率と平均 CMC のヒューリスティックから決定します。
@return [String]