# Path: minette/models/wordnode.py
# class WordNode(ABC, Serializable):
#     """
#     Base class of parsed word
# 
#     Attributes
#     ----------
#     surface : str
#         Surface of word
#     part : str
#         Part of the word
#     part_detail1 : str
#         Detail1 of part
#     part_detail2 : str
#         Detail2 of part
#     part_detail3 : str
#         Detail3 of part
#     stem_type : str
#         Stem type
#     stem_form : str
#         Stem form
#     word : str
#         Word itself
#     kana : str
#         Japanese kana of the word
#     pronunciation : str
#         Pronunciation of the word
#     """
#     def __init__(self, surface, part, part_detail1, part_detail2, part_detail3,
#                  stem_type, stem_form, word, kana, pronunciation):
#         self.surface = surface
#         self.part = part
#         self.part_detail1 = part_detail1
#         self.part_detail2 = part_detail2
#         self.part_detail3 = part_detail3
#         self.stem_type = stem_type
#         self.stem_form = stem_form
#         self.word = word
#         self.kana = kana
#         self.pronunciation = pronunciation
# 
#     @classmethod
#     @abstractmethod
#     def create(cls, surface, features):
#         pass
# 
# Path: minette/tagger/base.py
# class Tagger:
#     """
#     Base class for word taggers
# 
#     Attributes
#     ----------
#     config : minette.Config
#         Configuration
#     timezone : pytz.timezone
#         Timezone
#     logger : logging.Logger
#         Logger
#     """
#     MAX_LENGTH = 1000
# 
#     def __init__(self, config=None, timezone=None, logger=None, *,
#                  max_length=MAX_LENGTH, **kwargs):
#         """
#         Parameters
#         ----------
#         config : Config, default None
#             Configuration
#         timezone : timezone, default None
#             Timezone
#         logger : Logger, default None
#             Logger
#         max_length : int, default 1000
#             Max length of the text to parse
#         """
#         self.config = config
#         self.timezone = timezone
#         self.logger = logger or getLogger(__name__)
#         self.max_length = max_length
# 
#     def validate(self, text, max_length=None):
#         if not text:
#             return False
#         elif max_length is not None:
#             if len(text) > max_length:
#                 return False
#         elif len(text) > self.max_length:
#             return False
# 
#         return True
# 
#     def parse_as_generator(self, text, max_length=None):
#         """
#         Analyze and parse text, returns Generator
# 
#         Parameters
#         ----------
#         text : str
#             Text to analyze
#         max_length : int, default None
#             Max length of the text to parse
# 
#         Returns
#         -------
#         words : Generator of minette.WordNode (empty)
#             Word nodes
#         """
#         yield from ()
# 
#     def parse(self, text, max_length=None):
#         """
#         Analyze and parse text
# 
#         Parameters
#         ----------
#         text : str
#             Text to analyze
#         max_length : int, default None
#             Max length of the text to parse
# 
#         Returns
#         -------
#         words : list of minette.WordNode (empty)
#             Word nodes
#         """
#         return [wn for wn in self.parse_as_generator(text, max_length)]


import traceback
import MeCab
from ..models import WordNode
from .base import Tagger
    Attributes
    ----------
    config : minette.Config
        Configuration
    timezone : pytz.timezone
        Timezone
    logger : logging.Logger
        Logger
    """

    def parse_as_generator(self, text, max_length=None):
        """
        Analyze and parse text using MeCab, returns Generator

        Parameters
        ----------
        text : str
            Text to analyze
        max_length : int, default 1000
            Max length of the text to parse

        Returns
        -------
        words : list of minette.tagger.mecabtagger.MeCabNode
            MeCab word nodes
        """
        if self.validate(text, max_length) is False:
            return

        try:

# Path: minette/models/wordnode.py
# class WordNode(ABC, Serializable):
#     """
#     Base class of parsed word
# 
#     Attributes
#     ----------
#     surface : str
#         Surface of word
#     part : str
#         Part of the word
#     part_detail1 : str
#         Detail1 of part
#     part_detail2 : str
#         Detail2 of part
#     part_detail3 : str
#         Detail3 of part
#     stem_type : str
#         Stem type
#     stem_form : str
#         Stem form
#     word : str
#         Word itself
#     kana : str
#         Japanese kana of the word
#     pronunciation : str
#         Pronunciation of the word
#     """
#     def __init__(self, surface, part, part_detail1, part_detail2, part_detail3,
#                  stem_type, stem_form, word, kana, pronunciation):
#         self.surface = surface
#         self.part = part
#         self.part_detail1 = part_detail1
#         self.part_detail2 = part_detail2
#         self.part_detail3 = part_detail3
#         self.stem_type = stem_type
#         self.stem_form = stem_form
#         self.word = word
#         self.kana = kana
#         self.pronunciation = pronunciation
# 
#     @classmethod
#     @abstractmethod
#     def create(cls, surface, features):
#         pass
# 
# Path: minette/tagger/base.py
# class Tagger:
#     """
#     Base class for word taggers
# 
#     Attributes
#     ----------
#     config : minette.Config
#         Configuration
#     timezone : pytz.timezone
#         Timezone
#     logger : logging.Logger
#         Logger
#     """
#     MAX_LENGTH = 1000
# 
#     def __init__(self, config=None, timezone=None, logger=None, *,
#                  max_length=MAX_LENGTH, **kwargs):
#         """
#         Parameters
#         ----------
#         config : Config, default None
#             Configuration
#         timezone : timezone, default None
#             Timezone
#         logger : Logger, default None
#             Logger
#         max_length : int, default 1000
#             Max length of the text to parse
#         """
#         self.config = config
#         self.timezone = timezone
#         self.logger = logger or getLogger(__name__)
#         self.max_length = max_length
# 
#     def validate(self, text, max_length=None):
#         if not text:
#             return False
#         elif max_length is not None:
#             if len(text) > max_length:
#                 return False
#         elif len(text) > self.max_length:
#             return False
# 
#         return True
# 
#     def parse_as_generator(self, text, max_length=None):
#         """
#         Analyze and parse text, returns Generator
# 
#         Parameters
#         ----------
#         text : str
#             Text to analyze
#         max_length : int, default None
#             Max length of the text to parse
# 
#         Returns
#         -------
#         words : Generator of minette.WordNode (empty)
#             Word nodes
#         """
#         yield from ()
# 
#     def parse(self, text, max_length=None):
#         """
#         Analyze and parse text
# 
#         Parameters
#         ----------
#         text : str
#             Text to analyze
#         max_length : int, default None
#             Max length of the text to parse
# 
#         Returns
#         -------
#         words : list of minette.WordNode (empty)
#             Word nodes
#         """
#         return [wn for wn in self.parse_as_generator(text, max_length)]


# Path: minette/tagger/mecabtagger.py
import traceback
import MeCab
from ..models import WordNode
from .base import Tagger

    Attributes
    ----------
    config : minette.Config
        Configuration
    timezone : pytz.timezone
        Timezone
    logger : logging.Logger
        Logger
    """

    def parse_as_generator(self, text, max_length=None):
        """
        Analyze and parse text using MeCab, returns Generator

        Parameters
        ----------
        text : str
            Text to analyze
        max_length : int, default 1000
            Max length of the text to parse

        Returns
        -------
        words : list of minette.tagger.mecabtagger.MeCabNode
            MeCab word nodes
        """
        if self.validate(text, max_length) is False:
            return

        try:

            m = MeCab.Tagger("-Ochasen")