# Path: sanskrit_parser/util/lexical_lookup.py
# class LexicalLookup(object):
# 
#     __metaclass__ = abc.ABCMeta
# 
#     @abc.abstractmethod
#     def valid(self, word):
#         """ Return True if word is a valid pada """
# 
#     @abc.abstractmethod
#     def get_tags(self, word, tmap=True):
#         """ Return lexical tags of word """
# 
#     @staticmethod
#     def getArgs():
#         """
#           Argparse routine.
#           Returns args variable
#         """
#         # Parser Setup
#         parser = ArgumentParser(description='Interface to INRIA XML database')
#         # Input Encoding (autodetect by default)
#         parser.add_argument('--input-encoding', type=str, default=None)
#         parser.add_argument('--loglevel', type=str, default="info",
#                             help="logging level. Can be any level supported by logging module")
#         parser.add_argument('--no-map-tags', dest='map_tags',
#                             action='store_false')
# 
#         parser.add_argument('word', nargs='?', type=str,
#                             default=None,
#                             help="Word to look up")
# 
#         return parser.parse_args()
# 
#     def main(self, args):
#         if args.input_encoding is None:
#             ie = None
#         else:
#             ie = SCHEMES[args.input_encoding]
# 
#         word_in = SanskritImmutableString(args.word,
#                                           encoding=ie).canonical()
#         print("Getting tags for", word_in)
#         tags = self.get_tags(word_in, tmap=args.map_tags)
#         if tags is not None:
#             for tag in tags:
#                 print(tag)
# 
# Path: sanskrit_parser/base/sanskrit_base.py
# class SanskritImmutableString(SanskritString):
#     """ Immutable version of SanskritString
#     """
#     def __init__(self, thing=None, encoding=None, unicode_encoding='utf-8'):
#         super().__init__(thing, encoding, unicode_encoding)
# 
#     def __hash__(self):
#         return hash(str(self))
# 
#     def __eq__(self, other):
#         return str(self) == str(other)
# 
#     def __ne__(self, other):
#         return str(self) != str(other)
# 
# DEVANAGARI = sanscript.DEVANAGARI
# 
# SLP1 = sanscript.SLP1
# 
# Path: sanskrit_parser/util/data_manager.py
# def data_file_path(filename):
#     file_manager = ExitStack()
#     atexit.register(file_manager.close)
#     ref = importlib_resources.files('sanskrit_parser') / 'data' / filename
#     path = file_manager.enter_context(
#         importlib_resources.as_file(ref))
#     return str(path)


import logging
import sanskrit_util.analyze
import sanskrit_util.context
from sanskrit_util.schema import Nominal, Indeclinable, Verb, Gerund, Infinitive, ParticipleStem
from sanskrit_parser.util.lexical_lookup import LexicalLookup
from sanskrit_parser.base.sanskrit_base import SanskritImmutableString, DEVANAGARI, SLP1
from sanskrit_parser.util.data_manager import data_file_path
        else:
            tagset.add(SanskritImmutableString(self.vacanam[obj.number_id - 1], DEVANAGARI))
            tagset.add(SanskritImmutableString(self.vibhakti[obj.case_id - 1], DEVANAGARI))
        stem = obj.stem
        if type(stem) == ParticipleStem:
            mode = stem.mode.abbr
            voice = stem.voice.abbr
            for t in self.kRdanta[(mode, voice)]:
                tagset.add(SanskritImmutableString(t, SLP1))
        return (SanskritImmutableString(stem.name, SLP1), tagset)

    def map_verb(self, obj):
        tagset = set()
        newobj = self.refresh(obj)
        tagset.add(SanskritImmutableString(self.lakAra[newobj.mode.id - 1], DEVANAGARI))
        tagset.add(SanskritImmutableString(self.pada_prayoga[newobj.voice.id - 1], DEVANAGARI))
        tagset.add(SanskritImmutableString(self.puruSha[newobj.person.id - 1], DEVANAGARI))
        tagset.add(SanskritImmutableString(self.vacanam[newobj.number.id - 1], DEVANAGARI))
        return (SanskritImmutableString(newobj.root.name, SLP1), tagset)

    def map_tags(self, tags):
        out = []
        for t in tags:
            if type(t) == Nominal:
                otags = self.map_nominal(t)
                if otags not in out:
                    out.append(otags)
            elif type(t) == Verb:
                out.append(self.map_verb(t))
            elif type(t) == Indeclinable:

# Path: sanskrit_parser/util/lexical_lookup.py
# class LexicalLookup(object):
# 
#     __metaclass__ = abc.ABCMeta
# 
#     @abc.abstractmethod
#     def valid(self, word):
#         """ Return True if word is a valid pada """
# 
#     @abc.abstractmethod
#     def get_tags(self, word, tmap=True):
#         """ Return lexical tags of word """
# 
#     @staticmethod
#     def getArgs():
#         """
#           Argparse routine.
#           Returns args variable
#         """
#         # Parser Setup
#         parser = ArgumentParser(description='Interface to INRIA XML database')
#         # Input Encoding (autodetect by default)
#         parser.add_argument('--input-encoding', type=str, default=None)
#         parser.add_argument('--loglevel', type=str, default="info",
#                             help="logging level. Can be any level supported by logging module")
#         parser.add_argument('--no-map-tags', dest='map_tags',
#                             action='store_false')
# 
#         parser.add_argument('word', nargs='?', type=str,
#                             default=None,
#                             help="Word to look up")
# 
#         return parser.parse_args()
# 
#     def main(self, args):
#         if args.input_encoding is None:
#             ie = None
#         else:
#             ie = SCHEMES[args.input_encoding]
# 
#         word_in = SanskritImmutableString(args.word,
#                                           encoding=ie).canonical()
#         print("Getting tags for", word_in)
#         tags = self.get_tags(word_in, tmap=args.map_tags)
#         if tags is not None:
#             for tag in tags:
#                 print(tag)
# 
# Path: sanskrit_parser/base/sanskrit_base.py
# class SanskritImmutableString(SanskritString):
#     """ Immutable version of SanskritString
#     """
#     def __init__(self, thing=None, encoding=None, unicode_encoding='utf-8'):
#         super().__init__(thing, encoding, unicode_encoding)
# 
#     def __hash__(self):
#         return hash(str(self))
# 
#     def __eq__(self, other):
#         return str(self) == str(other)
# 
#     def __ne__(self, other):
#         return str(self) != str(other)
# 
# DEVANAGARI = sanscript.DEVANAGARI
# 
# SLP1 = sanscript.SLP1
# 
# Path: sanskrit_parser/util/data_manager.py
# def data_file_path(filename):
#     file_manager = ExitStack()
#     atexit.register(file_manager.close)
#     ref = importlib_resources.files('sanskrit_parser') / 'data' / filename
#     path = file_manager.enter_context(
#         importlib_resources.as_file(ref))
#     return str(path)


# Path: sanskrit_parser/util/sanskrit_data_wrapper.py
import logging
import sanskrit_util.analyze
import sanskrit_util.context
from sanskrit_util.schema import Nominal, Indeclinable, Verb, Gerund, Infinitive, ParticipleStem
from sanskrit_parser.util.lexical_lookup import LexicalLookup
from sanskrit_parser.base.sanskrit_base import SanskritImmutableString, DEVANAGARI, SLP1
from sanskrit_parser.util.data_manager import data_file_path

        else:
            tagset.add(SanskritImmutableString(self.vacanam[obj.number_id - 1], DEVANAGARI))
            tagset.add(SanskritImmutableString(self.vibhakti[obj.case_id - 1], DEVANAGARI))
        stem = obj.stem
        if type(stem) == ParticipleStem:
            mode = stem.mode.abbr
            voice = stem.voice.abbr
            for t in self.kRdanta[(mode, voice)]:
                tagset.add(SanskritImmutableString(t, SLP1))
        return (SanskritImmutableString(stem.name, SLP1), tagset)

    def map_verb(self, obj):
        tagset = set()
        newobj = self.refresh(obj)
        tagset.add(SanskritImmutableString(self.lakAra[newobj.mode.id - 1], DEVANAGARI))
        tagset.add(SanskritImmutableString(self.pada_prayoga[newobj.voice.id - 1], DEVANAGARI))
        tagset.add(SanskritImmutableString(self.puruSha[newobj.person.id - 1], DEVANAGARI))
        tagset.add(SanskritImmutableString(self.vacanam[newobj.number.id - 1], DEVANAGARI))
        return (SanskritImmutableString(newobj.root.name, SLP1), tagset)

    def map_tags(self, tags):
        out = []
        for t in tags:
            if type(t) == Nominal:
                otags = self.map_nominal(t)
                if otags not in out:
                    out.append(otags)
            elif type(t) == Verb:
                out.append(self.map_verb(t))
            elif type(t) == Indeclinable:

                out.append((SanskritImmutableString(t.name, SLP1),