# Path: sesql/config.py
# CONFIG_PATH_FALLBACK = 'sesql_config'
#     CONFIG_PATH = getattr(settings, 'SESQL_CONFIG_PATH', CONFIG_PATH_FALLBACK)
#     CONFIG_PATH = CONFIG_PATH_FALLBACK
# 
# Path: sesql/fieldmap.py
# class FieldMap(object):
#     def __init__(self):
#     def all_fields(self):
#     def get_field(self, field):
#     def get_primary(self):


from sesql import config
from sesql.fieldmap import fieldmap
from GenericCache import GenericCache

    if remaining:
        pattern = "plainto_tsquery('%s', %%s)" % dictionnary
        patterns = [ pattern for word in remaining ]

        cursor = config.orm.cursor()
        cursor.execute('SELECT %s;' % (','.join(patterns)), remaining)
        row = cursor.fetchone()
        for word, value in zip(remaining, row):
            value = value.strip("'")
            values[word] = value
            _word_cache[(word, dictionnary)] = value

    return [ values[word] for word in words ]

def lemmatize(words, index = None):
    """
    Give a lemmatized version of those words

    Use the configuration for the given index, or the default one if
    index is None
    """
    if index is None:
        index = fieldmap.primary

    if index is None:
        raise ValueError, "Not index given and no primary one"

    words = [ index.marshall(word) for word in words ]


# Path: sesql/config.py
# CONFIG_PATH_FALLBACK = 'sesql_config'
#     CONFIG_PATH = getattr(settings, 'SESQL_CONFIG_PATH', CONFIG_PATH_FALLBACK)
#     CONFIG_PATH = CONFIG_PATH_FALLBACK
# 
# Path: sesql/fieldmap.py
# class FieldMap(object):
#     def __init__(self):
#     def all_fields(self):
#     def get_field(self, field):
#     def get_primary(self):


# Path: sesql/lemmatize.py
from sesql import config
from sesql.fieldmap import fieldmap
from GenericCache import GenericCache


    if remaining:
        pattern = "plainto_tsquery('%s', %%s)" % dictionnary
        patterns = [ pattern for word in remaining ]

        cursor = config.orm.cursor()
        cursor.execute('SELECT %s;' % (','.join(patterns)), remaining)
        row = cursor.fetchone()
        for word, value in zip(remaining, row):
            value = value.strip("'")
            values[word] = value
            _word_cache[(word, dictionnary)] = value

    return [ values[word] for word in words ]

def lemmatize(words, index = None):
    """
    Give a lemmatized version of those words

    Use the configuration for the given index, or the default one if
    index is None
    """
    if index is None:
        index = fieldmap.primary

    if index is None:
        raise ValueError, "Not index given and no primary one"

    words = [ index.marshall(word) for word in words ]


    index = fieldmap.get_field(index)