# Path: janome/tokenizer.py
# class Token(object):
#     """
#     A Token object contains all information for a token.
#     """
# 
#     def __init__(self, node: Node, extra: Tuple = None):
#         self.node = node
#         self.extra = extra
# 
#     def __getattr__(self, name) -> Any:
#         if name == 'surface':
#             return self.node.surface
#         elif name == 'part_of_speech':
#             return self.extra[0] if self.extra else self.node.part_of_speech
#         elif name == 'infl_type':
#             return self.extra[1] if self.extra else self.node.infl_type
#         elif name == 'infl_form':
#             return self.extra[2] if self.extra else self.node.infl_form
#         elif name == 'base_form':
#             return self.extra[3] if self.extra else self.node.base_form
#         elif name == 'reading':
#             return self.extra[4] if self.extra else self.node.reading
#         elif name == 'phonetic':
#             return self.extra[5] if self.extra else self.node.phonetic
#         elif name == 'node_type':
#             return self.node.node_type
#         else:
#             None
# 
#     def __setattr__(self, name: str, value: Any) -> None:
#         # see https://stackoverflow.com/questions/61213745/typechecking-dynamically-added-attributes
#         object.__setattr__(self, name, value)
# 
#     def __str__(self):
#         return f'{self.surface}\t' \
#             f'{self.part_of_speech},{self.infl_type},{self.infl_form},{self.base_form},{self.reading},{self.phonetic}'


from abc import ABC, abstractmethod
from collections import defaultdict
from typing import Iterator, List, Dict, Tuple, Any
from .tokenizer import Token
# Copyright 2015 moco_beta
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.




class TokenFilter(ABC):
    """
    Base TokenFilter class.

    A TokenFilter modifies or transforms the input token sequence according to the rule described in apply() method.
    Subclasses must implement apply() method.

    Added in *version 0.3.4*
    """

    @abstractmethod

# Path: janome/tokenizer.py
# class Token(object):
#     """
#     A Token object contains all information for a token.
#     """
# 
#     def __init__(self, node: Node, extra: Tuple = None):
#         self.node = node
#         self.extra = extra
# 
#     def __getattr__(self, name) -> Any:
#         if name == 'surface':
#             return self.node.surface
#         elif name == 'part_of_speech':
#             return self.extra[0] if self.extra else self.node.part_of_speech
#         elif name == 'infl_type':
#             return self.extra[1] if self.extra else self.node.infl_type
#         elif name == 'infl_form':
#             return self.extra[2] if self.extra else self.node.infl_form
#         elif name == 'base_form':
#             return self.extra[3] if self.extra else self.node.base_form
#         elif name == 'reading':
#             return self.extra[4] if self.extra else self.node.reading
#         elif name == 'phonetic':
#             return self.extra[5] if self.extra else self.node.phonetic
#         elif name == 'node_type':
#             return self.node.node_type
#         else:
#             None
# 
#     def __setattr__(self, name: str, value: Any) -> None:
#         # see https://stackoverflow.com/questions/61213745/typechecking-dynamically-added-attributes
#         object.__setattr__(self, name, value)
# 
#     def __str__(self):
#         return f'{self.surface}\t' \
#             f'{self.part_of_speech},{self.infl_type},{self.infl_form},{self.base_form},{self.reading},{self.phonetic}'


# Path: janome/tokenfilter.py
from abc import ABC, abstractmethod
from collections import defaultdict
from typing import Iterator, List, Dict, Tuple, Any
from .tokenizer import Token

# Copyright 2015 moco_beta
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.




class TokenFilter(ABC):
    """
    Base TokenFilter class.

    A TokenFilter modifies or transforms the input token sequence according to the rule described in apply() method.
    Subclasses must implement apply() method.

    Added in *version 0.3.4*
    """

    @abstractmethod

    def apply(self, tokens: Iterator[Token]) -> Iterator[Any]: