Add Egypt locale for phone numbers
Adding Regex for Phone Numbers in EGYPT
This might actually be a good time to look at using something more general. I was able to get phonenumbers to spit out the regex(s):
import phonenumbers
from phonenumbers.phonemetadata import PhoneMetadata
metadata = PhoneMetadata.metadata_for_region("EG") # Replace "US" with the country code you need
metadata.number_format
# [NumberFormat(pattern='(\\d)(\\d{7,8})', format='\\1 \\2', leading_digits_pattern=['[23]'], national_prefix_formatting_rule='0\\1'), NumberFormat(pattern='(\\d{2})(\\d{6,7})', format='\\1 \\2', leading_digits_pattern=['1[35]|[4-6]|8[2468]|9[235-7]'], national_prefix_formatting_rule='0\\1'), NumberFormat(pattern='(\\d{3})(\\d{3})(\\d{4})', format='\\1 \\2 \\3', leading_digits_pattern=['[89]'], national_prefix_formatting_rule='0\\1'), NumberFormat(pattern='(\\d{2})(\\d{8})', format='\\1 \\2', leading_digits_pattern=['1'], national_prefix_formatting_rule='0\\1')]
Not quite sure how to combine these though.
Thank you for your contribution! You need to add the Egypt locale in this file: https://github.com/dottxt-ai/outlines/blob/289ef5d7db674fc159f56fa14f5bcf45b4e4bec2/outlines/types/locales.py#L7 so users can call:
types.locale("eg").PhoneNumber
Hi @ahmeda335! We modified the organization of the output type files in the recently released Outlines v1. locale is now a directory containing one file per country.