Skip to content

Commit

Permalink
refactor: restructure code towards better modular development
Browse files Browse the repository at this point in the history
  • Loading branch information
hrishikeshrt committed Mar 18, 2022
1 parent 624265e commit d256e9a
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 14 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ suggestions/

*.log
db/**
data/**
**/__pycache__/**

# Sessions
Expand Down
File renamed without changes.
File renamed without changes.
23 changes: 12 additions & 11 deletions telegram/bot.py → bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,40 @@

import tabulate

import dhatupatha
import shabdapatha
import heritage

# local
import config
import samskrit_text as skt

from utils.dhatupatha import DhatuPatha
from utils.shabdapatha import ShabdaPatha
from utils.heritage import HeritagePlatform
import utils.sanskrit_text as skt

###############################################################################
# Utilities

Dhatu = dhatupatha.DhatuPatha(
Dhatu = DhatuPatha(
config.dhatu_file,
display_keys=[
'baseindex', 'dhatu', 'aupadeshik', 'gana', 'pada', 'artha', 'karma',
'artha_english'
]
)

Shabda = shabdapatha.ShabdaPatha(config.shabda_file)
Shabda = ShabdaPatha(config.shabda_file)

if not config.hellwig_splitter_dir:
class NonSplitter:
def split(self, sentence):
return "दत्तपदस्य विग्रहं कर्तुं न शक्यते"
Vigraha = NonSplitter()
else:
import splitter
Vigraha = splitter.Splitter(config.hellwig_splitter_dir)
from utils.splitter import Splitter
Vigraha = Splitter(config.hellwig_splitter_dir)

if config.heritage_platform_dir:
Heritage = heritage.HeritagePlatform(config.heritage_platform_dir)
Heritage = HeritagePlatform(config.heritage_platform_dir)
else:
Heritage = heritage.HeritagePlatform('', method='web')
Heritage = HeritagePlatform('', method='web')

if not os.path.isdir(config.suggestion_dir):
os.makedirs(config.suggestion_dir)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions telegram/dhatupatha.py → utils/dhatupatha.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
DhatuPatha from Ashtadhyayi.com
Created on Tue Nov 3 15:09:14 2020
@author: Hrishikesh Terdalkar
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion telegram/logger.py → utils/logger.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 17 18:27:54 2019
Logger Setup
@author: Hrishikesh Terdalkar
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion telegram/shabdapatha.py → utils/shabdapatha.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
ShabdaPatha from Ashtadhyayi.com
Created on Thu Dec 10 17:35:57 2020
@author: Hrishikesh Terdalkar
Expand All @@ -9,7 +11,7 @@
import re
import json

import samskrit_text as skt
import utils.sanskrit_text as skt

###############################################################################

Expand Down
File renamed without changes.

0 comments on commit d256e9a

Please sign in to comment.