Zodiac Process Flow

Get the Birth Date for which Zodiac is needed.

getZodiacFlow is triggered, First and foremost the birth date for which Zodiac needs to be identified has to be found.

  • In case user has requested for his own Zodiac sign, then the Default Birthdate is used, Flow to get Day and Month is invoked.

  • Else, User is requested to provide the birth date for which Zodiac is needed. Raw speech is captured and Text is transformed to remove unnecessary words/stop words

Identification of the Day and Month from User Input

Next step is to identify the Day and Month from the User input. User can say the Birth date in any format. Below are just few examples

  • My birth date is Jun 14th 1993

  • Birth date is 14th of June 1993

  • Date of birth is 14 June

  • date is 14 06 1991

getDayMonth Function is call to get the Day and Month from user input/default birth date.

  • It uses datefinder package to find the dates from input string, once any date is identified, day and month are figured out and returned to the getZodiacFlow

matches = datefinder.find_dates(inputstring)
for identifieddate in matches:
    break

Day=identifieddate.strftime('%d')
Month = identifieddate.strftime('%B')
return Day,Month

datefinder is a python module for locating dates inside text. Use this package to extract all sorts of date like strings from a document and turn them into datetime objects. This module finds the likely datetime strings and then uses dateutil to convert to the datetime object.

Get the Zodiac Sign

Now we have the day and month for which Zodiac Sign has to be found zodiac_sign function is triggered to get Zodiac using Day and Month and zodiac/astro sign is returned.

	# checks month and date within the valid range of a specified zodiac
    if month == 'december':
        zodiac_sign_is = 'Sagittarius' if (day < 22) else 'Capricorn'
		
    elif month == 'january':
	    zodiac_sign_is = 'Capricorn' if (day < 20) else 'Aquarius'
		
    elif month == 'february':
        zodiac_sign_is = 'Aquarius' if (day < 19) else 'Pisces'
		
    elif month == 'march':
        zodiac_sign_is = 'Pisces' if (day < 21) else 'Aries'
		
    elif month == 'april':
        zodiac_sign_is = 'Aries' if (day < 20) else 'Taurus'
            
    elif month == 'may':
        zodiac_sign_is = 'Taurus' if (day < 21) else 'Gemini'
            
    elif month == 'june':
        zodiac_sign_is = 'Gemini' if (day < 21) else 'Cancer'
            
    elif month == 'july':
        zodiac_sign_is = 'Cancer' if (day < 23) else 'Leo'
            
    elif month == 'august':
        zodiac_sign_is = 'Leo' if (day < 23) else 'Virgo'
            
    elif month == 'september':
        zodiac_sign_is = 'Virgo' if (day < 23) else 'Libra'
            
    elif month == 'october':
        zodiac_sign_is = 'Libra' if (day < 23) else 'Scorpio'
            
    elif month == 'november':
        zodiac_sign_is = 'Scorpio' if (day < 22) else 'Sagittarius'

    return zodiac_sign_is

Zodiac sign is shared with Human for the requested birth date and there after control is returned to NextStep for further processing.

Last updated