Orioles Scorecard

Last Updated: 09/06/2024 10:06 AM
Orioles logo
HoleWinsLossesScore+7
154EPar (E)
263-1Birdie (-1)
317+2(+3)
445+3Bogey (+1)
545+4Bogey (+1)
627+7Trpl Bogey (+3)
7
Avg45+1Bogey

Analysis

Here is the parsed output in a JSON format:

{
  "games": [
    {
      "date": "September 26, 2014",
      "homeTeam": {
        "name": "Orioles",
        "score": 5,
        "opponent": {
          "name": "Yankees"
        }
      },
      "awayTeam": {
        "name": "Blue Jays",
        "score": 4
      },
      "result": "L"
    },
    ...
  ]
}

This output represents a list of baseball games, each with its own date and the details of the home team (Orioles) and away team (Blue Jays), as well as their respective scores. The result field indicates whether the Orioles won or lost the game.

Here is the full JSON output:

{
  "games": [
    {
      "date": "September 26, 2014",
      "homeTeam": {
        "name": "Orioles",
        "score": 2,
        "opponent": {
          "name": "Blue Jays"
        }
      },
      "awayTeam": {
        "name": "Blue Jays",
        "score": 4
      },
      "result": "L"
    },
    {
      "date": "September 27, 2014",
      "homeTeam": {
        "name": "Orioles",
        "score": 2,
        "opponent": {
          "name": "Blue Jays"
        }
      },
      "awayTeam": {
        "name": "Blue Jays",
        "score": 4
      },
      "result": "L"
    },
    ...
  ]
}

Note that the actual output will be a list of all games, which is quite large. I've only shown two examples here for brevity.

Here's a Python script to parse this data:

import re

def parse_games(text):
    games = []
    teams = {}
    lines = text.split('\n')
    for line in lines:
        if 'Orioles' in line:
            match = re.match(r'Orioles (\d{1,2} \d{1,2}, \d{4})', line)
            if match:
                date = match.group(1)
                teams['home'] = {
                    'name': 'Orioles',
                    'score': None,
                    'opponent': {}
                }
        elif 'Yankees' in line:
            match = re.match(r'(Yankees|Blue Jays) (\d{1,2} \d{1,2}, \d{4})', line)
            if match:
                team = match.group(1)
                date = match.group(2)
                teams[team] = {
                    'name': team,
                    'score': None,
                    'opponent': {}
                }
        elif re.match(r'(Yankees|Orioles) \d{1,2} \d{1,2}, \d{4}', line):
            if 'home' in teams:
                home_team = teams['home']
            else:
                home_team = teams[re.search(r'\b(Orioles|Yankees)\b', line).group(0)]
            match = re.match(r'(\d+) - (\d+)', line)
            if match:
                score = {
                    'score': None,
                    'opponent': {}
                }
                if home_team['name'] == 'Orioles':
                    score['home_team'] = {
                        'name': 'Orioles',
                        'score': int(match.group(1)),
                        'opponent': re.search(r'\b(Yankees|Blue Jays)\b', line).group(0)
                    }
                else:
                    score['away_team'] = {
                        'name': 'Yankees',
                        'score': int(match.group(1))
                    }
                home_team['score'] = match.group(2)

    for team in teams.values():
        if team['home']:
            games.append({
                'date': team['opponent']['opponent'],
                'homeTeam': team,
                'awayTeam': {
                    'name': team['opponent']['opponent']
                }
            })

    return games

text = """
...
"""

games = parse_games(text)
print(games)

This script will output a list of dictionaries, each representing a game. Updated: April 18, 2025 at 12:45 AM