import re

def tweetParse(tweetString):
    # first identify if mentor or mentee
    isMentorBool = '#mentor' in tweetString.lower()
    isMentor = 'mentor' if isMentorBool else 'mentee'
    # then identify indices of '-'s in string
    indices = [i for i, x in enumerate(tweetString) if x == "-"]
    index_1 = indices[0]
    index_2 = indices[1]
    index_3 = indices[2]
    tweetStringLength = len(tweetString)
    # slice string into substrings and make the lists into an array of values
    substring_1 = tweetString[index_1:index_2]
    substring_2 = tweetString[index_2:index_3]
    substring_3 = tweetString[index_3:tweetStringLength]
    substring_1 = toMultiStrings(substring_1)
    substring_2 = toMultiStrings(substring_2)
    substring_3 = toMultiStrings(substring_3)

    return isMentor, substring_1, substring_2, substring_3

def toMultiStrings(string):
    string = re.sub('-(.*?):', '', string)
    string = re.sub(',', '', string)
    string = string.strip()
    string = string.split()
    for str in string:
        str = str.strip()
    return string

# example tweets:
# #WomenToTech #Mentor -langs: javascript, python, haskell -skill: node.js, d3.js, jinja2 -offering: help getting started
# #WomenToTech #Mentee -langs: ruby, -skills: french, baking, SVG -seeking: help getting started
# if they have more than 3 languages change the third to 'and more' in the db
# if it contains SQL just include it as is
# we need to link to the tweet thread on the mentor list

@@ -2,16 +2,86 @@
 mport re
+%0Afrom acceptedlangs import accepted_langs_normal, accepted_langs_lower
 %0A%0Adef tw
@@ -846,97 +846,429 @@
 ng_3
-)%0A%0A    return isMentor, substring_1, substring_2, substring_3%0A%0Adef toMultiStrings(string)
+, isOffer=True)%0A    substring_1, substring_2 = checkTheLists(substring_1, substring_2)%0A    substring_3 = checkOffers(substring_3)%0A    return isMentor, substring_1, substring_2, substring_3%0A%0Adef toMultiStrings(string, isOffer=False):%0A  if isOffer:%0A    string = re.sub('-(.*?):', '', string)%0A    string = string.split(',')%0A    string = string.strip() if type(string) is str else stripString(string)%0A    return string%0A  else
 :%0A  
@@ -1409,70 +1409,1140 @@
     
-for
+return string%0A%0Adef stripString(string):%0A  for indx,
  str
+ng
  in 
+enumerate(
 string
+)
 :%0A    
-    str = str.strip()%0A    return string
+strng = strng.strip()%0A    string%5Bindx%5D = strng%0A  return string%0A%0A%0Adef checkTheLists(langstore, skillstore):%0A    langs = %5B%5D%0A    skills = %5B%5D%0A    for language in langstore:%0A        if language.lower() in accepted_langs_lower:%0A            langs.append(language)%0A        elif 'SQL' in language:%0A            langs.append(language)%0A        else:%0A            skills.append(language)%0A    if len(langs) %3E 4:%0A        langs = langs%5B:3%5D%0A        langs.append('and more...')%0A    if len(skillstore) %3C= 4:%0A        if len(skills) != 0:%0A            for skill in skills:%0A                skillstore.append(skill)%0A    if len(skillstore) %3E 4:%0A        print skillstore%0A        skillstore = skillstore%5B:3%5D%0A        skillstore.append('and more...')%0A    return langs, skillstore%0A%0Adef checkOffers(offerstore):%0A    offers = %5B%5D%0A    for offer in offerstore:%0A      if 'start' in offer:%0A        offers.append('getting started')%0A      elif 'career' in offer:%0A        offers.append('career advice')%0A      elif 'project' in offer:%0A        offers.append('project help')%0A    return offers
 %0A%0A# 

add changes to tweet parser