bartman081523 commited on
Commit
b7151e3
1 Parent(s): bb6e12a

populate db

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. gematria.db +2 -2
app.py CHANGED
@@ -187,7 +187,7 @@ def search_gematria_in_db(gematria_sum, max_words):
187
  for words, book, chapter, verse in results:
188
  # Filter by word count (including phrases with fewer words)
189
  word_count = words.count(' ') + 1 # Count spaces to get word count
190
- if word_count == word_count: # Include phrases with word count <= max_words
191
  filtered_results.append((words, book, chapter, verse))
192
  logging.debug(f"Found {len(filtered_results)} matching phrases for Gematria: {gematria_sum} after filtering.")
193
  return filtered_results
@@ -298,7 +298,7 @@ def run_app():
298
  # Pre-populate the database
299
  logging.info("Starting database population...")
300
  phrases_to_insert = [] # Collect phrases before inserting in bulk
301
- for max_phrase_length in range(1, 5): # Populate for phrases up to 5 words
302
  for gematria_sum, phrase, book, chapter, verse in tqdm(populate_database(1, 39, max_phrase_length=max_phrase_length), desc=f"Populating Database (Max Length: {max_phrase_length})"): # Books 1 to 39
303
  phrases_to_insert.append((gematria_sum, phrase, book, chapter, verse))
304
  if len(phrases_to_insert) >= 1000: # Insert in batches of 1000 for efficiency
 
187
  for words, book, chapter, verse in results:
188
  # Filter by word count (including phrases with fewer words)
189
  word_count = words.count(' ') + 1 # Count spaces to get word count
190
+ if word_count <= word_count: # Include phrases with word count <= max_words
191
  filtered_results.append((words, book, chapter, verse))
192
  logging.debug(f"Found {len(filtered_results)} matching phrases for Gematria: {gematria_sum} after filtering.")
193
  return filtered_results
 
298
  # Pre-populate the database
299
  logging.info("Starting database population...")
300
  phrases_to_insert = [] # Collect phrases before inserting in bulk
301
+ for max_phrase_length in range(1, 6): # Populate for phrases up to 5 words
302
  for gematria_sum, phrase, book, chapter, verse in tqdm(populate_database(1, 39, max_phrase_length=max_phrase_length), desc=f"Populating Database (Max Length: {max_phrase_length})"): # Books 1 to 39
303
  phrases_to_insert.append((gematria_sum, phrase, book, chapter, verse))
304
  if len(phrases_to_insert) >= 1000: # Insert in batches of 1000 for efficiency
gematria.db CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:119142f15d8437060680fd578af07edccb25b1255fa74711044b344f1f9620fc
3
- size 105299968
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:03a40767c98e5f667d5a4650979a34a51862be5244c23bf8d852d1ac4347c3ed
3
+ size 118484992