# Path: feet/config.py
# class RedisConfiguration(Configuration):
# class ServerConfiguration(Configuration):
# class MecabConfiguration(Configuration):
# class FeetConfiguration(Configuration):
#     CONF_PATHS = [
#         "/etc/feet.yaml",  # System configuration
#         os.path.expanduser("~/.feet.yaml"),  # User specific config
#         os.path.abspath("conf/feet.yaml"),  # Local configuration
#     ]
# 
# Path: feet/utils/decorators.py
# def memoized(fget):
#     """
#     Return a property attribute for new-style classes that only calls its
#     getter on the first access. The result is stored and on subsequent
#     accesses is returned, preventing the need to call the getter any more.
#     https://github.com/estebistec/python-memoized-property
#     """
#     attr_name = '_{0}'.format(fget.__name__)
# 
#     @wraps(fget)
#     def fget_memoized(self):
#         if not hasattr(self, attr_name):
#             setattr(self, attr_name, fget(self))
#         return getattr(self, attr_name)
# 
#     return property(fget_memoized)
# 
# Path: feet/utils/singleton.py
# class SingletonMetaClass(type):
#     """
#     Usage:
#         class bar(object):
#             __metaclass__ = SingletonMetaClass
#     """
#     def __init__(cls, name, bases, dict):
#         super(SingletonMetaClass, cls)\
#             .__init__(name, bases, dict)
#         original_new = cls.__new__
# 
#         def my_new(cls, *args, **kwds):
#             if cls.instance is None:
#                 cls.instance = original_new(cls, *args, **kwds)
#             return cls.instance
#         cls.instance = None
#         cls.__new__ = staticmethod(my_new)
# 
# Path: feet/utils/logger.py
# class LoggingMixin(object):
#     """
#     Mix in to classes that need their own logging object!
#     """
# 
#     @property
#     def logger(self):
#         """
#         Instantiates and returns a ServiceLogger instance
#         """
#         if not hasattr(self, '_logger') or not self._logger:
#             self._logger = ServiceLogger()
#         return self._logger


import MeCab
import re
from datetime import datetime
from feet.config import settings
from dateparser import parse
from feet.utils.decorators import memoized
from feet.utils.singleton import SingletonMetaClass
from feet.utils.logger import LoggingMixin

    @memoized
    def mecab(self):
        self.logger.warning('Initialize Mecab')
        return MeCab.Tagger('-d %s' % settings.mecab.mecabdict)

    def word_tokenize(self, content, with_separators=True):
        if content is None:
            return None
        output = []
        node = self.mecab.parseToNode(content)
        while node:
            features = node.feature.split(',')
            self.logger.debug('%s %s %s' % (node.surface, features[0],
                                            features[1]))
            if node.surface != '':
                if features[0] == F1_SEPARATOR:
                    if with_separators:
                        output.append(node.surface)
                else:
                    output.append(node.surface)
            node = node.next
        return output

    def sent_tokenize(self, content):
        if content is None:
            return []
        node = self.mecab.parseToNode(content)
        separators = []
        while node:

# Path: feet/config.py
# class RedisConfiguration(Configuration):
# class ServerConfiguration(Configuration):
# class MecabConfiguration(Configuration):
# class FeetConfiguration(Configuration):
#     CONF_PATHS = [
#         "/etc/feet.yaml",  # System configuration
#         os.path.expanduser("~/.feet.yaml"),  # User specific config
#         os.path.abspath("conf/feet.yaml"),  # Local configuration
#     ]
# 
# Path: feet/utils/decorators.py
# def memoized(fget):
#     """
#     Return a property attribute for new-style classes that only calls its
#     getter on the first access. The result is stored and on subsequent
#     accesses is returned, preventing the need to call the getter any more.
#     https://github.com/estebistec/python-memoized-property
#     """
#     attr_name = '_{0}'.format(fget.__name__)
# 
#     @wraps(fget)
#     def fget_memoized(self):
#         if not hasattr(self, attr_name):
#             setattr(self, attr_name, fget(self))
#         return getattr(self, attr_name)
# 
#     return property(fget_memoized)
# 
# Path: feet/utils/singleton.py
# class SingletonMetaClass(type):
#     """
#     Usage:
#         class bar(object):
#             __metaclass__ = SingletonMetaClass
#     """
#     def __init__(cls, name, bases, dict):
#         super(SingletonMetaClass, cls)\
#             .__init__(name, bases, dict)
#         original_new = cls.__new__
# 
#         def my_new(cls, *args, **kwds):
#             if cls.instance is None:
#                 cls.instance = original_new(cls, *args, **kwds)
#             return cls.instance
#         cls.instance = None
#         cls.__new__ = staticmethod(my_new)
# 
# Path: feet/utils/logger.py
# class LoggingMixin(object):
#     """
#     Mix in to classes that need their own logging object!
#     """
# 
#     @property
#     def logger(self):
#         """
#         Instantiates and returns a ServiceLogger instance
#         """
#         if not hasattr(self, '_logger') or not self._logger:
#             self._logger = ServiceLogger()
#         return self._logger


# Path: feet/entities/jptools.py
import MeCab
import re
from datetime import datetime
from feet.config import settings
from dateparser import parse
from feet.utils.decorators import memoized
from feet.utils.singleton import SingletonMetaClass
from feet.utils.logger import LoggingMixin


    @memoized
    def mecab(self):
        self.logger.warning('Initialize Mecab')
        return MeCab.Tagger('-d %s' % settings.mecab.mecabdict)

    def word_tokenize(self, content, with_separators=True):
        if content is None:
            return None
        output = []
        node = self.mecab.parseToNode(content)
        while node:
            features = node.feature.split(',')
            self.logger.debug('%s %s %s' % (node.surface, features[0],
                                            features[1]))
            if node.surface != '':
                if features[0] == F1_SEPARATOR:
                    if with_separators:
                        output.append(node.surface)
                else:
                    output.append(node.surface)
            node = node.next
        return output

    def sent_tokenize(self, content):
        if content is None:
            return []
        node = self.mecab.parseToNode(content)
        separators = []
        while node:

            features = node.feature.split(',')