Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 1,044 Bytes
cf957e4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
"""
Utility functions for the Emoji Mashup application.
"""
import logging
# Configure logging
def setup_logging():
"""Configure application logging."""
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
return logging.getLogger(__name__)
# Initialize logger
logger = setup_logging()
def kitchen_txt_to_dict(filepath):
"""Convert emoji kitchen text file to dictionary.
Args:
filepath: Path to the emoji kitchen text file
Returns:
Dictionary mapping emojis to descriptions
"""
emoji_dict = {}
try:
with open(filepath, 'r', encoding='utf-8') as f:
for line in f:
parts = line.strip().split(' ', 1)
if len(parts) == 2:
emoji, desc = parts
emoji_dict[emoji] = desc
return emoji_dict
except Exception as e:
logger.error(f"Error loading emoji dictionary from {filepath}: {e}")
return {} |