File size: 1,060 Bytes
ea9ca44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import sys
import os

# Add backend to path so we can import
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../..')))

from backend.src.extraction.fallback_extractor import extract_fallback

test_cases = [
    "+91 9876543210",          # India
    "+919876543210",           # India No Space
    "9876543210",              # India Local
    "+1 212-555-0199",         # US
    "+44 7911 123456",         # UK Mobile
    "+971 50 1234567",         # UAE
    "+61 412 345 678",         # Australia
    "+49 151 12345678",        # Germany
    "+33 6 12 34 56 78",       # France
    "+81 90-1234-5678",        # Japan
    "Phone: +91 98765-43210",  # In text
    "Call me at 123-456-7890", # US Local in text
    "No phone number here"
]


print("Testing extract_fallback Phone Extraction:")
with open("test_output.txt", "w", encoding="utf-8") as f:
    for t in test_cases:
        result = extract_fallback(t)
        output_line = f"'{t}' -> {result.get('phone')}"
        print(output_line)
        f.write(output_line + "\n")