"""Ayat Search"""


from urduhack.preprocessing import remove_punctuation, replace_numbers
from urduhack.tokenization.words import fix_join_words
from urduhack import normalize

import pandas as pd
import json

# df = pd.read_csv("/Users/muhammadfahid/PycharmProjects/Islam-360/ahsanulbayan.db.csv")
# ALL_AYATS = {}
# with open("search_queries.txt", "r") as in_file:
#     for query in in_file:
#         query = query.strip()
#         ayat_num = []
#         for index, row in df.iterrows():
#             if isinstance(row['translation'], str):
#                 translation = row['translation'].strip()
#                 translation = replace_numbers(remove_punctuation(fix_join_words(normalize(translation))))
#                 if query in translation:
#                     ayat_num.append(row["Unnamed: 0"])
#         ALL_AYATS[query] = ayat_num
#         print(ALL_AYATS)
#
# with open("queries_to_ayat.json", "w") as out_json:
#     json.dump(ALL_AYATS, out_json, ensure_ascii=False, indent=4)

with open("queries_to_ayat.json", "r") as f:
    queries = json.load(f)

for query, value in queries.items():
    print(query, value)

"""Ayat Search"""


from urduhack.preprocessing import remove_punctuation, replace_numbers
from urduhack.tokenization.words import fix_join_words
from urduhack import normalize

import pandas as pd
import json

# df = pd.read_csv("/Users/muhammadfahid/PycharmProjects/Islam-360/ahsanulbayan.db.csv")
# ALL_AYATS = {}
# with open("search_queries.txt", "r") as in_file:
#     for query in in_file:
#         query = query.strip()
#         ayat_num = []
#         for index, row in df.iterrows():
#             if isinstance(row['translation'], str):
#                 translation = row['translation'].strip()
#                 translation = replace_numbers(remove_punctuation(fix_join_words(normalize(translation))))
#                 if query in translation:
#                     ayat_num.append(row["Unnamed: 0"])
#         ALL_AYATS[query] = ayat_num
#         print(ALL_AYATS)
#
# with open("queries_to_ayat.json", "w") as out_json:
#     json.dump(ALL_AYATS, out_json, ensure_ascii=False, indent=4)

with open("queries_to_ayat.json", "r") as f:
    queries = json.load(f)

for query, value in queries.items():
    print(query, value)

Ayat Search # df = pd.read_csv("/Users/muhammadfahid/PycharmProjects/Islam-360/ahsanulbayan.db.csv") # ALL_AYATS = {} # with open("search_queries.txt", "r") as in_file: #     for query in in_file: #         query = query.strip() #         ayat_num = [] #         for index, row in df.iterrows(): #             if isinstance(row['translation'], str): #                 translation = row['translation'].strip() #                 translation = replace_numbers(remove_punctuation(fix_join_words(normalize(translation)))) #                 if query in translation: #                     ayat_num.append(row["Unnamed: 0"]) #         ALL_AYATS[query] = ayat_num #         print(ALL_AYATS) # # with open("queries_to_ayat.json", "w") as out_json: #     json.dump(ALL_AYATS, out_json, ensure_ascii=False, indent=4)