deveix commited on
Commit
08e69e9
·
1 Parent(s): 9c01213

add ayah and tafsir

Browse files
Files changed (1) hide show
  1. app/main.py +9 -2
app/main.py CHANGED
@@ -122,9 +122,16 @@ def get_text_by_block_number(filepath, block_numbers):
122
 
123
  for block_number, block in enumerate(blocks, 1): # Starting block numbers at 1 for human readability
124
  if block_number in block_numbers:
 
 
 
125
  # Replace single newlines within blocks with space and strip leading/trailing whitespace
126
- formatted_block = ' '.join(block.split('\n')).strip()
127
- blocks_text.append(formatted_block)
 
 
 
 
128
  if len(blocks_text) == len(block_numbers): # Stop reading once all required blocks are retrieved
129
  break
130
  return blocks_text
 
122
 
123
  for block_number, block in enumerate(blocks, 1): # Starting block numbers at 1 for human readability
124
  if block_number in block_numbers:
125
+ splitted = block.split('\n')
126
+ ayah = splitted[0]
127
+ tafsir = splitted[1]
128
  # Replace single newlines within blocks with space and strip leading/trailing whitespace
129
+ formatted_block = ' '.join(splitted).strip()
130
+ blocks_text.append({
131
+ ayah,
132
+ tafsir,
133
+ formatted_block
134
+ })
135
  if len(blocks_text) == len(block_numbers): # Stop reading once all required blocks are retrieved
136
  break
137
  return blocks_text