Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)

        def solve(question):
    
    tokens = re.sub(r'[^\w\d\s]', '', question).lower().split(' ')
    found = []
    
    # Body parts:
    #    'Cat, apple, finger, elephant or hospital: the body part is?' - finger
    #    'The list chin, cat, head, toe, T-shirt and hair contains how many body parts?' - four
    #    'Ant, snake and eye: how many body parts in the list?' - one
    #    'Cat, apple, finger, elephant or hospital: the body part is?' - finger
    if 'body' in tokens and ('part' in tokens or 'parts'):
        
        for i in range(len(tokens)):
            
            # Go through each token and save those that are body parts.
            if tokens[i] in parts:
                found.append(tokens[i])               
    else:
        return None
    
    if len(found) == 1:
        if 'parts' in tokens:
            return '1'
        else:
            return found[0]
    elif len(found) > 1:
        return str(len(found))
    else:
        return None
        


src/t/e/TextCaptchaBreaker-HEAD/TextCaptchaBreaker.py   TextCaptchaBreaker(Download)
                answer = NamePattern.solve(question)
            if answer is None:
                answer = BodyPartsPattern.solve(question)
            if answer is None:
                answer = DigitPattern.solve(question)