# Path: safecity/apps/locate/location_parser.py
# def strip_punctuation(text):
#     return PUNCTUATION_REGEX.sub(' ', text)
# 
# WHITESPACE_REGEX = re.compile('\s+')
# 
# Path: safecity/apps/tropo/views.py
# KEYWORDS = {
#     'JOIN': ['join', 'register'],
#     'UPDATE': ['update', 'change'],
#     'QUIT': ['quit', 'leave'],
# }


import csv
import logging
import os
import re
from optparse import make_option
from django.conf import settings
from django.core.management.base import NoArgsCommand, CommandError
from safecity.apps.locate.location_parser import strip_punctuation, WHITESPACE_REGEX
from safecity.apps.locate.models import *
from safecity.apps.tropo.views import KEYWORDS
    title = 'locate.vet_skip_words'
    help = 'Verify that no skip_words are road names or other keywords.'

    option_list = NoArgsCommand.option_list + (
        make_option('-r', '--rewrite', action='store_true', dest='rewrite',
            help='Rewrite skipwords list without problem words.'),
        )

    def handle_noargs(self, **options):
        skip_words = []
        
        with open(os.path.join(settings.DATA_DIR, 'wordlists/skipwords')) as f:
            skip_words = [word.strip() for word in f.readlines()]
            
        road_types = []
            
        with open(os.path.join(settings.DATA_DIR, 'streets/road_types.csv')) as f:
            for line in f.readlines():
                k, v = line.split(',')
                road_types.append(k)

        road_directions = []

        with open(os.path.join(settings.DATA_DIR, 'streets/road_directions.csv')) as f:
            for line in f.readlines():
                k, v = line.split(',')
                road_directions.append(k)
        
        keywords = []
                

# Path: safecity/apps/locate/location_parser.py
# def strip_punctuation(text):
#     return PUNCTUATION_REGEX.sub(' ', text)
# 
# WHITESPACE_REGEX = re.compile('\s+')
# 
# Path: safecity/apps/tropo/views.py
# KEYWORDS = {
#     'JOIN': ['join', 'register'],
#     'UPDATE': ['update', 'change'],
#     'QUIT': ['quit', 'leave'],
# }


# Path: safecity/apps/locate/management/commands/vet_skipwords.py
import csv
import logging
import os
import re
from optparse import make_option
from django.conf import settings
from django.core.management.base import NoArgsCommand, CommandError
from safecity.apps.locate.location_parser import strip_punctuation, WHITESPACE_REGEX
from safecity.apps.locate.models import *
from safecity.apps.tropo.views import KEYWORDS

    title = 'locate.vet_skip_words'
    help = 'Verify that no skip_words are road names or other keywords.'

    option_list = NoArgsCommand.option_list + (
        make_option('-r', '--rewrite', action='store_true', dest='rewrite',
            help='Rewrite skipwords list without problem words.'),
        )

    def handle_noargs(self, **options):
        skip_words = []
        
        with open(os.path.join(settings.DATA_DIR, 'wordlists/skipwords')) as f:
            skip_words = [word.strip() for word in f.readlines()]
            
        road_types = []
            
        with open(os.path.join(settings.DATA_DIR, 'streets/road_types.csv')) as f:
            for line in f.readlines():
                k, v = line.split(',')
                road_types.append(k)

        road_directions = []

        with open(os.path.join(settings.DATA_DIR, 'streets/road_directions.csv')) as f:
            for line in f.readlines():
                k, v = line.split(',')
                road_directions.append(k)
        
        keywords = []
                

        for v in KEYWORDS.values():