# Path: scan/settings.py
# DB_URL = 'sqlite:///scan.db'
# DEBUG = True
# ROOT_PATH = path(__file__).dirname()
# REPO_PATH = ROOT_PATH.dirname()
# ENV_ROOT = REPO_PATH.dirname()
# DATA_PATH = os.path.join(REPO_PATH, "data")
# TEST_DATA_PATH = os.path.join(DATA_PATH, "test")
# MODEL_PATH = os.path.join(DATA_PATH, "models")
# SECRET_KEY = "30y^$e7henbp@#_w+z9)o9f8tovjrhoq(%vw=%#*(1-1esrh!_"
# USERNAME = "test"
# EMAIL = "test@test.com"
# PASSWORD = "test"
# SQLALCHEMY_DATABASE_URI = DB_URL
# SECURITY_REGISTERABLE = True
# SECURITY_RECOVERABLE = True
# SECURITY_SEND_REGISTER_EMAIL = False
# SECURITY_PASSWORD_HASH = "bcrypt"
# SECURITY_PASSWORD_SALT = SECRET_KEY
# BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 3600}
# BROKER_URL = 'redis://localhost:6379/3'
# CELERY_RESULT_BACKEND = 'redis://localhost:6379/3'
# CELERY_IMPORTS = ('core.tasks.tasks',)
# CACHE_TYPE = 'redis'
# CACHE_REDIS_URL = 'redis://localhost:6379/4'
# CACHE_REDIS_DB = 4
# MAX_FEATURES = 500
# MODEL_VERSION = 1
# 
# Path: core/preprocessors/base.py
# class BaseCorrector(object):
#     def __init__(self):
#         self.data = file(os.path.join(settings.DATA_PATH, "big.txt")).read()
# 
#     def words(self, text):
#         return re.findall('[a-z]+', text.lower())


import pickle
import re
import collections
import os
from scan import settings
from core.preprocessors.base import BaseCorrector

def one():
    return 1

class SpellCorrector(BaseCorrector):
    """
    Slightly adapted from Peter Norvig's spell corrector:  http://norvig.com/spell-correct.html
    """
    alphabet = 'abcdefghijklmnopqrstuvwxyz'

    def __init__(self):
        super(SpellCorrector, self).__init__()

# Path: scan/settings.py
# DB_URL = 'sqlite:///scan.db'
# DEBUG = True
# ROOT_PATH = path(__file__).dirname()
# REPO_PATH = ROOT_PATH.dirname()
# ENV_ROOT = REPO_PATH.dirname()
# DATA_PATH = os.path.join(REPO_PATH, "data")
# TEST_DATA_PATH = os.path.join(DATA_PATH, "test")
# MODEL_PATH = os.path.join(DATA_PATH, "models")
# SECRET_KEY = "30y^$e7henbp@#_w+z9)o9f8tovjrhoq(%vw=%#*(1-1esrh!_"
# USERNAME = "test"
# EMAIL = "test@test.com"
# PASSWORD = "test"
# SQLALCHEMY_DATABASE_URI = DB_URL
# SECURITY_REGISTERABLE = True
# SECURITY_RECOVERABLE = True
# SECURITY_SEND_REGISTER_EMAIL = False
# SECURITY_PASSWORD_HASH = "bcrypt"
# SECURITY_PASSWORD_SALT = SECRET_KEY
# BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 3600}
# BROKER_URL = 'redis://localhost:6379/3'
# CELERY_RESULT_BACKEND = 'redis://localhost:6379/3'
# CELERY_IMPORTS = ('core.tasks.tasks',)
# CACHE_TYPE = 'redis'
# CACHE_REDIS_URL = 'redis://localhost:6379/4'
# CACHE_REDIS_DB = 4
# MAX_FEATURES = 500
# MODEL_VERSION = 1
# 
# Path: core/preprocessors/base.py
# class BaseCorrector(object):
#     def __init__(self):
#         self.data = file(os.path.join(settings.DATA_PATH, "big.txt")).read()
# 
#     def words(self, text):
#         return re.findall('[a-z]+', text.lower())


# Path: core/preprocessors/spelling.py
import pickle
import re
import collections
import os
from scan import settings
from core.preprocessors.base import BaseCorrector


def one():
    return 1

class SpellCorrector(BaseCorrector):
    """
    Slightly adapted from Peter Norvig's spell corrector:  http://norvig.com/spell-correct.html
    """
    alphabet = 'abcdefghijklmnopqrstuvwxyz'

    def __init__(self):
        super(SpellCorrector, self).__init__()

        self.data_path = os.path.abspath(os.path.join(settings.DATA_PATH, "big.txt"))