def drug_types()

in cloud9/stream.py [0:0]


def drug_types(text, drug_names=stream_config.drug_names):
    """
    Search for drug mentions (substring) in raw text of Tweet

    Parameters:
    text (str): raw text of Tweet
    
    Returns:
    contains (list): List of drug names mentioned in a Tweet
    """
    
    contains = []
    for drug in drug_names:
        if len([True for name in drug if name.lower() in text.lower()]) > 0:
            contains.append(drug[0])
    return contains