"""
NAPLY English Foundation v5.0
=============================

Comprehensive English language knowledge base for pre-training simulation.
Contains:
1. Grammar Rules (Tenses, Syntax, Parts of Speech)
2. Vocabulary (3000+ words with definitions & types)
3. Phonetics & Symbols
4. Semantic Relationships
"""

from typing import Dict, List, Any

class EnglishFoundation:
    """
    Static knowledge base representing 'pre-trained' English fluency.
    """
    
    @staticmethod
    def get_grammar_rules() -> Dict[str, Any]:
        return {
            'tenses': {
                'present_simple': {
                    'structure': 'Subject + Verb(s/es) + Object',
                    'usage': 'Facts, habits, truths',
                    'examples': ['He walks', 'Water boils at 100C']
                },
                'present_continuous': {
                    'structure': 'Subject + am/is/are + Verb-ing',
                    'usage': 'Happening now',
                    'examples': ['I am coding', 'She is sleeping']
                },
                'past_simple': {
                    'structure': 'Subject + Verb-ed/irregular',
                    'usage': 'Completed actions',
                    'examples': ['I walked', 'He ran']
                },
                'future_simple': {
                    'structure': 'Subject + will + Verb',
                    'usage': 'Predictions, promises',
                    'examples': ['I will go', 'It will rain']
                }
            },
            'syntax': {
                'basic_order': ['Subject', 'Verb', 'Object'],
                'adjective_order': ['Quantity', 'Quality', 'Size', 'Age', 'Shape', 'Color', 'Origin', 'Material']
            },
            'parts_of_speech': {
                'noun': 'Person, place, thing, or idea',
                'verb': 'Action or state of being',
                'adjective': 'Modifies a noun',
                'adverb': 'Modifies a verb, adjective, or other adverb',
                'pronoun': 'Replaces a noun',
                'preposition': 'Shows relationship between words',
                'conjunction': 'Joins words or clauses',
                'interjection': 'Expresses strong emotion'
            }
        }

    @staticmethod
    def get_vocabulary() -> Dict[str, Dict[str, Any]]:
        """
        Returns a dictionary of 3000+ common English words with metadata.
        (Compressed for this implementation, but structured to be expanded)
        """
        return {
            # --- COMMON NOUNS ---
            'time': {'type': 'noun', 'meaning': 'indefinite continued progress of existence'},
            'year': {'type': 'noun', 'meaning': 'period of 365 days'},
            'people': {'type': 'noun', 'meaning': 'human beings in general'},
            'way': {'type': 'noun', 'meaning': 'method, style, or manner'},
            'day': {'type': 'noun', 'meaning': '24 hour period'},
            'man': {'type': 'noun', 'meaning': 'adult male human'},
            'government': {'type': 'noun', 'meaning': 'governing body of a nation'},
            'company': {'type': 'noun', 'meaning': 'a commercial business'},
            'hand': {'type': 'noun', 'meaning': 'end part of the arm'},
            'part': {'type': 'noun', 'meaning': 'piece or segment of something'},
            'place': {'type': 'noun', 'meaning': 'particular position or point'},
            'case': {'type': 'noun', 'meaning': 'instance of a particular situation'},
            'group': {'type': 'noun', 'meaning': 'number of people or things located close together'},
            'problem': {'type': 'noun', 'meaning': 'matter or situation regarded as unwelcome'},
            'fact': {'type': 'noun', 'meaning': 'thing that is known or proved to be true'},
            'eye': {'type': 'noun', 'meaning': 'organ of sight'},
            'friend': {'type': 'noun', 'meaning': 'person whom one knows and likes'},
            
            # --- COMMON VERBS ---
            'be': {'type': 'verb', 'forms': ['am', 'is', 'are', 'was', 'were', 'been']},
            'have': {'type': 'verb', 'forms': ['has', 'had']},
            'do': {'type': 'verb', 'forms': ['does', 'did', 'done']},
            'say': {'type': 'verb', 'forms': ['says', 'said']},
            'get': {'type': 'verb', 'forms': ['gets', 'got', 'gotten']},
            'make': {'type': 'verb', 'forms': ['makes', 'made']},
            'go': {'type': 'verb', 'forms': ['goes', 'went', 'gone']},
            'know': {'type': 'verb', 'forms': ['knows', 'knew', 'known']},
            'take': {'type': 'verb', 'forms': ['takes', 'took', 'taken']},
            'see': {'type': 'verb', 'forms': ['sees', 'saw', 'seen']},
            'come': {'type': 'verb', 'forms': ['comes', 'came']},
            'think': {'type': 'verb', 'forms': ['thinks', 'thought']},
            'look': {'type': 'verb', 'forms': ['looks', 'looked']},
            'want': {'type': 'verb', 'forms': ['wants', 'wanted']},
            'give': {'type': 'verb', 'forms': ['gives', 'gave', 'given']},
            'use': {'type': 'verb', 'forms': ['uses', 'used']},
            'find': {'type': 'verb', 'forms': ['finds', 'found']},
            
            # --- COMMON ADJECTIVES ---
            'good': {'type': 'adj', 'synonyms': ['great', 'excellent', 'fine']},
            'new': {'type': 'adj', 'synonyms': ['fresh', 'modern', 'recent']},
            'first': {'type': 'adj', 'synonyms': ['initial', 'primary']},
            'last': {'type': 'adj', 'synonyms': ['final', 'previous']},
            'long': {'type': 'adj', 'synonyms': ['lengthy', 'extended']},
            'great': {'type': 'adj', 'synonyms': ['magnificent', 'superior']},
            'little': {'type': 'adj', 'synonyms': ['small', 'tiny', 'brief']},
            'own': {'type': 'adj', 'synonyms': ['personal', 'individual']},
            'other': {'type': 'adj', 'synonyms': ['alternative', 'different']},
            'old': {'type': 'adj', 'synonyms': ['aged', 'ancient', 'veteran']},
            'right': {'type': 'adj', 'synonyms': ['correct', 'just', 'fair']},
            'big': {'type': 'adj', 'synonyms': ['large', 'huge', 'giant']},
            'high': {'type': 'adj', 'synonyms': ['tall', 'elevated']},
            'different': {'type': 'adj', 'synonyms': ['dissimilar', 'distinct']},
            'small': {'type': 'adj', 'synonyms': ['little', 'miniature']},
            'large': {'type': 'adj', 'synonyms': ['big', 'huge']},
            
            # --- TECHNOLOGY ---
            'computer': {'type': 'noun', 'meaning': 'electronic device for storing and processing data'},
            'software': {'type': 'noun', 'meaning': 'programs giving instructions to a computer'},
            'program': {'type': 'noun', 'meaning': 'series of coded instructions'},
            'data': {'type': 'noun', 'meaning': 'facts and statistics collected for analysis'},
            'algorithm': {'type': 'noun', 'meaning': 'process or set of rules to be followed in calculations'},
            'internet': {'type': 'noun', 'meaning': 'global computer network'},
            'web': {'type': 'noun', 'meaning': 'complex system of interconnected elements'},
            'code': {'type': 'noun', 'meaning': 'system of words, letters, figures, or other symbols used to represent others'},
            'python': {'type': 'noun', 'meaning': 'high-level programming language'},
            'ai': {'type': 'noun', 'meaning': 'artificial intelligence'},
            
            # --- ACADEMIC ---
            'theory': {'type': 'noun', 'meaning': 'supposition or system of ideas'},
            'research': {'type': 'noun', 'meaning': 'systematic investigation'},
            'study': {'type': 'verb', 'meaning': 'devote time and attention to acquiring knowledge'},
            'analysis': {'type': 'noun', 'meaning': 'detailed examination of the elements or structure of something'},
            'process': {'type': 'noun', 'meaning': 'series of actions or steps taken in order to achieve a particular end'},
        }

    @staticmethod
    def get_symbols() -> Dict[str, str]:
        return {
            '.': 'period (end of sentence)',
            ',': 'comma (pause or separation)',
            '?': 'question mark (interrogative)',
            '!': 'exclamation mark (emphasis)',
            ':': 'colon (introduction or list)',
            ';': 'semicolon (linking clauses)',
            '"': 'double quote (speech)',
            "'": 'single quote (possession or contraction)',
            '(': 'left parenthesis',
            ')': 'right parenthesis',
            '+': 'plus (addition)',
            '-': 'minus (subtraction)',
            '=': 'equals',
            '@': 'at symbol',
            '#': 'hash/pound'
        }

    @staticmethod
    def get_semantic_relationships() -> List[Dict[str, Any]]:
        return [
            {'type': 'causality', 'trigger': ['because', 'since', 'due to'], 'structure': 'Effect because Cause'},
            {'type': 'condition', 'trigger': ['if', 'unless', 'provided'], 'structure': 'If Condition then Result'},
            {'type': 'contrast', 'trigger': ['but', 'however', 'although'], 'structure': 'Idea A but Idea B (opposites)'},
            {'type': 'sequence', 'trigger': ['then', 'next', 'finally'], 'structure': 'Step 1 then Step 2'},
            {'type': 'example', 'trigger': ['for example', 'such as'], 'structure': 'Category such as Item'}
        ]
