@@ -65,7 +65,7 @@ def get_complete_verse_counts() -> Dict[str, Counter]:
6565 df = df .set_index ("book" )
6666 for book , counts in verse_counts .items ():
6767 for chapter , count in counts .items ():
68- df .loc [book ][ chapter ] = count
68+ df .loc [book , chapter ] = count
6969 df .to_csv (complete_counts_path )
7070
7171 return verse_counts
@@ -131,9 +131,10 @@ def collect_verse_counts(
131131 LOGGER .info (f"Processing { project_name } " )
132132
133133 verse_counts = defaultdict (list )
134- with open (SIL_NLP_ENV .assets_dir / "vref.txt" , "r" , encoding = "utf-8" ) as vref_file , extract_file_name .open (
135- "r" , encoding = "utf-8"
136- ) as extract_file :
134+ with (
135+ open (SIL_NLP_ENV .assets_dir / "vref.txt" , "r" , encoding = "utf-8" ) as vref_file ,
136+ extract_file_name .open ("r" , encoding = "utf-8" ) as extract_file ,
137+ ):
137138 cur_book = None
138139 for vref , verse in zip (vref_file , extract_file ):
139140 if verse != "\n " :
@@ -147,8 +148,8 @@ def collect_verse_counts(
147148 for book , chapter_counts in verse_counts .items ():
148149 book_count = sum (chapter_counts .values ())
149150 complete_book_count = sum (complete_verse_counts [book ].values ())
150- verse_counts_df .loc [project_name ][ book ] = book_count
151- verse_percentages_df .loc [project_name ][ book ] = 100 * round (book_count / complete_book_count , 3 )
151+ verse_counts_df .loc [project_name , book ] = book_count
152+ verse_percentages_df .loc [project_name , book ] = 100 * round (book_count / complete_book_count , 3 )
152153 if book_count < complete_book_count and book_count > 0 :
153154 partially_complete_books .append (book )
154155
@@ -163,7 +164,7 @@ def collect_verse_counts(
163164 df = df .set_index ("book" )
164165 for book in partially_complete_books :
165166 for chapter , complete_count in complete_verse_counts [book ].items ():
166- df .loc [book ][ chapter ] = 100 * round (verse_counts [book ][chapter ] / complete_count , 3 )
167+ df .loc [book , chapter ] = 100 * round (verse_counts [book ][chapter ] / complete_count , 3 )
167168 df .to_csv (partial_books_path / f"{ project_name } .csv" )
168169
169170 # Add overall counts
0 commit comments