NUMBER_MAP = {
'A': 1, 'Q': 1, 'I': 1, 'J': 1, 'Y': 1,
'B': 2, 'K': 2, 'R': 2,
'C': 3, 'G': 3, 'L': 3, 'S': 3,
'D': 4, 'M': 4, 'T': 4,
'E': 5, 'H': 5, 'N': 5, 'X': 5,
'U': 6, 'V': 6, 'W': 6,
'O': 7, 'Z': 7,
'F': 8, 'P': 8
}
```text
```python
# get names from anthropic
def get_names_from_llm(inputs: Dict, api_key: str) -> List[Tuple[str, str]]:
url = "https://api.anthropic.com/v1/messages"
headers = {
"Content-Type": "application/json",
"x-api-key": api_key,
"anthropic-version": "2023-06-01"
}
prompt = f"""As a learned Hindu astrologer and numerologist with deep knowledge of Tamil culture and spirituality, Generate 20 Tamil {inputs['gender'].lower()} names that:
1. Must start with or contain initials: {inputs['initials']}
2. {"Start with prefix " + inputs['prefix'] if inputs['prefix'] else ""}
3. {"Are related to deities: " + ", ".join(inputs['deities']) if inputs['deities'] else ""}
4. When calculated using numerology (including initials in calculation), sum should be one of: {', '.join(map(str, inputs['numerology']))}
Format: Names only, one per line. Do not include initials in the names.
"""
data = {
"messages": [{"role": "user", "content": prompt}],
"model": "claude-3-opus-20240229",
"max_tokens": 500,
"temperature": 0.9
}
try:
<PARSE RESPONSES TO GET NAMES>
return filtered_names[:10]
except Exception as e:
print(f"{Fore.RED}Error generating names: {str(e)}{Style.RESET_ALL}")
return []
```text
```python
# always print reference table
def print_reference_table():
print(f"\n{Fore.CYAN}Numerology Reference Table:{Style.RESET_ALL}")
print(f"{Fore.YELLOW}" + "-" * 40 + f"{Style.RESET_ALL}")
number_groups = {}
for letter, number in NUMBER_MAP.items():
if number not in number_groups:
number_groups[number] = []
number_groups[number].append(letter)
for number in sorted(number_groups.keys()):
letters = ' '.join(sorted(number_groups[number]))
print(f"{Fore.GREEN}Number {number}: {Fore.WHITE}{letters}{Style.RESET_ALL}")
print(f"{Fore.YELLOW}" + "-" * 40 + f"{Style.RESET_ALL}")
# for each name in result calculate final number
def get_number(letter: str) -> int:
return NUMBER_MAP.get(letter.upper(), 0)
def calculate_numerology(name: str) -> int:
return sum(get_number(char) for char in name if char.isalpha())
```text
```python
# additionaly get name insights frmo anthropic
def get_name_insights(name: str, gender: str) -> str:
url = "https://api.anthropic.com/v1/messages"
headers = {
"Content-Type": "application/json",
"x-api-key": os.getenv('ANTHROPIC_API_KEY'),
"anthropic-version": "2023-06-01"
}
prompt = f"""As a learned Hindu astrologer and numerologist with deep knowledge of Tamil culture and spirituality, provide insights about the name '{name}'. Include:
1. Etymology and meaning of each word/component
2. Connection to deities or spiritual concepts
3. Cultural significance in Tamil tradition
4. Any special numerological significance of the letters/sounds
5. Positive attributes and energies associated with the name
6. If used, which famous Tamil figures or saints had this name
7. Regional variations or similar names
Format your response in a spiritual and insightful way, as a Tamil elder would explain."""
data = {
"messages": [{"role": "user", "content": prompt}],
"model": "claude-3-opus-20240229",
"max_tokens": 1000,
"temperature": 0.7
}
try:
response = requests.post(url, headers=headers, json=data)
response.raise_for_status()
response_json = response.json()
content = response_json.get('content', [])
if isinstance(content, list) and len(content) > 0:
return content[0].get('text', '')
return "Could not generate insights for this name."
except Exception as e:
return f"Error generating insights: {str(e)}"
def display_results(name_pairs: List[Tuple[str, str]], target_nums: List[int], gender: str) -> None:
while True:
print(f"\n{Fore.CYAN}Name Analysis{Style.RESET_ALL}")
print(f"{Fore.YELLOW}" + "-" * 70 + f"{Style.RESET_ALL}")
print(f"{Fore.GREEN}{'#':<3} {'Base Name':<20} {'Full Name':<25} {'Numerology':<8} {'Target'}{Style.RESET_ALL}")
print(f"{Fore.YELLOW}" + "-" * 70 + f"{Style.RESET_ALL}")
for idx, (base_name, full_name) in enumerate(name_pairs, 1):
num = calculate_numerology(full_name)
matches = f"{Fore.GREEN}✓{Style.RESET_ALL}" if num in target_nums else f"{Fore.RED}✗{Style.RESET_ALL}"
print(f"{Fore.CYAN}{idx:<3} {Fore.WHITE}{base_name:<20} {full_name:<25} {num:<8} {matches}")
print(f"\n{Fore.CYAN}Options:{Style.RESET_ALL}")
print(f"{Fore.GREEN}1-N: {Fore.WHITE}Select name for detailed analysis{Style.RESET_ALL}")
print(f"{Fore.GREEN}E: {Fore.WHITE}Explain name meaning and significance{Style.RESET_ALL}")
print(f"{Fore.GREEN}R: {Fore.WHITE}Show reference table{Style.RESET_ALL}")
print(f"{Fore.GREEN}Q: {Fore.WHITE}Quit{Style.RESET_ALL}")
choice = input(f"\n{Fore.YELLOW}Enter choice: {Style.RESET_ALL}").upper()
if choice == 'Q':
break
elif choice == 'R':
print_reference_table()
elif choice.isdigit() and 1 <= int(choice) <= len(name_pairs):
show_detailed_analysis(name_pairs[int(choice)-1][1])
elif choice == 'E':
idx = int(input(f"{Fore.YELLOW}Enter name number to explain: {Style.RESET_ALL}"))
if 1 <= idx <= len(name_pairs):
print(f"\n{Fore.CYAN}Analyzing name significance...{Style.RESET_ALL}")
insights = get_name_insights(name_pairs[idx-1][1], gender)
print(f"\n{Fore.GREEN}Divine Insights:{Style.RESET_ALL}")
print(f"{Fore.WHITE}{insights}{Style.RESET_ALL}")
input(f"\n{Fore.YELLOW}Press Enter to continue...{Style.RESET_ALL}")
else:
print(f"{Fore.RED}Invalid choice!{Style.RESET_ALL}")
```text
Usage
```shell
./generate.py