473,246 Members | 3,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 software developers and data experts.

abspell.py helps you say Hotel India -- as well as ticket locator codes ;-)

====< abspell.py >=======================================
# abspell.py v.10 20030806 17:20:23 Bengt Richter bo**@oz.net
# Use freely, so long as you accept that there is NO WARRANTY OF ANY KIND.
#
"""
Abspell translates alphanumeric strings to corresponding phonetic word codes.
(see http://www.wikipedia.org/wiki/NATO_phonetic_alphabet)

Usage: abspell.py words and or digits to translate
e.g.,
abspell.py hello abspell v.10
Results in (untranslated letters are square bracketed):
hello = Hotel Echo Lima Lima Oscar
abspell = Alpha Bravo Sierra Papa Echo Lima Lima
v.10 = Victor [.] One Zero
"""

abLetters = (
'Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel India '
'Juliet Kilo Lima Mike November Oscar Papa Quebec Romeo '
'Sierra Tango Uniform Victor Whiskey Xray Yankee Zulu'
).split()
abDigits = 'Zero One Two Three Four Five Six Seven Eight Niner'.split()

def abSpell(s):
if ' ' in s: return '\n'.join(map(abSpell, s.split()))
return ' '.join(['%10s ='%s]+map(
lambda c: c.isdigit() and abDigits[int(c)] or c.isalpha() and
abLetters[ord(c.lower())-ord('a')] or '[%s]' %c, s))

if __name__ == '__main__':
import sys
if sys.argv[1:]:
print abSpell(' '.join(sys.argv[1:]))
else:
print __doc__
================================================== =======

Regards,
Bengt Richter
Jul 18 '05 #1
0 1293

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris | last post by:
I'm wondering what is the "best" way to structure a set of info about an item, like a book or a hotel. Eg, let's say you had this info to present for each book in a collection: Title Author...
0
by: Author Tarun Tyagi | last post by:
Hi, I am a Data Recovery Specialist and Professional Data Recovery Software Developer in New Delhi. I've placed the Complete SOURCE CODE of One of my Data Recovery Software for Sale (for...
1
by: e | last post by:
I'm using forms authentication on a site. When the user logs in via the login page, the entered creds are checked against AD, and if valid, an encrypted forms authentication ticket is produced and...
0
by: Sean Patterson | last post by:
Hey all, I've followed the examples online on how to use Forms Authentication to create a ticket, assign it a role, and then intercept it in the Global.asax file to make sure it gets sucked in...
2
by: David Goodger | last post by:
Early bird registration for PyCon TX 2006 ends on December 31st, so there are only a few days LEFT. To register, please visit: http://us.pycon.org/TX2006/Registration You can still register...
2
by: kkant | last post by:
Hi , I am KKant from Bangalore, India. I have a jos to do, I have to store VB codes in a a Database (Access) table and in Run time I have to read those codes and Exute them. But I dont know how to...
0
by: Khushi | last post by:
TolMol enables shoppers to compare and find the best deal on product and service offerings from thousands of online and local sellers. In single TolMol search, shoppers can find information on...
24
by: GesterX | last post by:
First of all I'm new to this site but it certainly looks like a place that i will be visiting more often! Onto my problem. I am creating a Hotel Bussiness project in java using BlueJ The...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.