"""
Expanded Concept Network - 100+ concepts for deep understanding
"""
from semantic_processor import SemanticProcessor

def load_expanded_concepts():
    """Load comprehensive concept network"""
    processor = SemanticProcessor()
    
    # Science concepts
    science_concepts = {
        "physics": {
            "related": ["science", "mathematics", "nature"],
            "properties": ["studies_matter", "studies_energy", "uses_equations"],
            "examples": ["gravity", "motion", "electricity"]
        },
        "chemistry": {
            "related": ["science", "atoms", "molecules"],
            "properties": ["studies_substances", "studies_reactions"],
            "examples": ["water", "oxygen", "carbon"]
        },
        "biology": {
            "related": ["science", "life", "organisms"],
            "properties": ["studies_living_things", "studies_cells"],
            "examples": ["plants", "animals", "bacteria"]
        }
    }
    
    # Technology concepts
    tech_concepts = {
        "computer": {
            "related": ["technology", "machine", "device"],
            "properties": ["processes_data", "runs_programs", "has_memory"],
            "examples": ["laptop", "server", "smartphone"]
        },
        "internet": {
            "related": ["network", "technology", "communication"],
            "properties": ["connects_computers", "global_network"],
            "examples": ["web", "email", "social_media"]
        },
        "artificial_intelligence": {
            "related": ["computer", "learning", "technology"],
            "properties": ["learns_patterns", "makes_decisions", "improves"],
            "examples": ["machine_learning", "neural_networks", "robots"]
        }
    }
    
    # Abstract concepts
    abstract_concepts = {
        "time": {
            "related": ["measurement", "change", "sequence"],
            "properties": ["flows_forward", "measurable", "continuous"],
            "examples": ["past", "present", "future"]
        },
        "space": {
            "related": ["dimension", "volume", "distance"],
            "properties": ["three_dimensional", "measurable", "contains_objects"],
            "examples": ["room", "universe", "area"]
        },
        "causality": {
            "related": ["cause", "effect", "relationship"],
            "properties": ["cause_precedes_effect", "deterministic"],
            "examples": ["fire_causes_heat", "rain_causes_wet"]
        },
        "logic": {
            "related": ["reasoning", "thinking", "rules"],
            "properties": ["follows_rules", "systematic", "consistent"],
            "examples": ["if_then", "and", "or"]
        }
    }
    
    # Social concepts
    social_concepts = {
        "friendship": {
            "related": ["relationship", "trust", "affection"],
            "properties": ["mutual", "voluntary", "supportive"],
            "examples": ["best_friend", "companion", "buddy"]
        },
        "emotion": {
            "related": ["feeling", "psychology", "human"],
            "properties": ["subjective", "internal_state", "affects_behavior"],
            "examples": ["happiness", "sadness", "anger"]
        },
        "communication": {
            "related": ["language", "interaction", "social"],
            "properties": ["transfers_information", "requires_sender_receiver"],
            "examples": ["speaking", "writing", "gesturing"]
        }
    }
    
    # Natural world
    nature_concepts = {
        "plant": {
            "related": ["organism", "life", "nature"],
            "properties": ["photosynthesizes", "has_roots", "grows"],
            "examples": ["tree", "flower", "grass"]
        },
        "water": {
            "related": ["liquid", "substance", "essential"],
            "properties": ["flows", "transparent", "necessary_for_life"],
            "examples": ["ocean", "rain", "river"]
        },
        "weather": {
            "related": ["atmosphere", "climate", "nature"],
            "properties": ["changes", "affects_environment", "predictable"],
            "examples": ["rain", "snow", "sunshine"]
        }
    }
    
    # Add all concepts
    all_concepts = {**science_concepts, **tech_concepts, **abstract_concepts, 
                   **social_concepts, **nature_concepts}
    
    for concept, data in all_concepts.items():
        processor.add_concept(concept, data)
    
    return processor

if __name__ == "__main__":
    print("EXPANDING SEMANTIC NETWORK")
    
    processor = load_expanded_concepts()
    
    print(f"\n✅ Loaded {len(processor.concept_graph)} concepts")
    
    # Test understanding
    print("\n🧠 Testing expanded understanding:")
    
    test_concepts = ["physics", "artificial_intelligence", "time", "emotion"]
    for concept in test_concepts:
        result = processor.understand_concept(concept)
        if result["understood"]:
            print(f"   ✅ {concept}: {len(result['related_concepts'])} relations")
    
    print("\n✅ SEMANTIC NETWORK EXPANDED")
