@@ -4371,6 +4371,11 @@ class Arguments:
4371
4371
embedding_3d = graphene .List (graphene .List (graphene .Float ))
4372
4372
perspective_name_list = graphene .List (graphene .String )
4373
4373
4374
+ dictionary_count = graphene .Int ()
4375
+ group_count = graphene .Int ()
4376
+ not_enough_count = graphene .Int ()
4377
+ transcription_count = graphene .Int ()
4378
+
4374
4379
@staticmethod
4375
4380
def get_entry_text (entry ):
4376
4381
return f"{ entry ['swadesh' ]} [ { entry ['transcription' ]} ] { entry ['translation' ]} "
@@ -4773,19 +4778,31 @@ def split_lex(lex):
4773
4778
# GC
4774
4779
del data_query
4775
4780
4781
+ group_counter = [0 ] * len (group_list )
4782
+ total_transcription_count = 0
4783
+
4776
4784
# Checking if found entries have links
4777
4785
means = collections .OrderedDict ()
4778
4786
for perspective_id , entries in entries_set .items ():
4779
4787
means [perspective_id ] = collections .defaultdict (set )
4780
4788
for group_index , group in enumerate (group_list ):
4789
+
4781
4790
# Select etymologically linked entries
4782
4791
linked = entries & group
4792
+ # Count non-empty 'linked'
4793
+ group_counter [group_index ] += (len (linked ) > 0 )
4794
+
4783
4795
for entry_id in linked :
4784
4796
result_pool [perspective_id ][entry_id ]['group' ] = group_index
4785
4797
swadesh = result_pool [perspective_id ][entry_id ]['swadesh' ]
4786
4798
# Store the correspondence: perspective { meanings(1/2/3) { etymological_groups(1.1/1.2/2.1/3.1)
4787
4799
if not result_pool [perspective_id ][entry_id ]['borrowed' ]:
4788
4800
means [perspective_id ][swadesh ].add (group_index )
4801
+ total_transcription_count += 1
4802
+
4803
+ not_enough_count = 0
4804
+ for count in group_counter :
4805
+ not_enough_count += (count < 2 )
4789
4806
4790
4807
dictionary_count = len (means )
4791
4808
distance_data_array = numpy .full ((dictionary_count , dictionary_count ), 50 , dtype = 'float' )
@@ -4863,6 +4880,10 @@ def split_lex(lex):
4863
4880
4864
4881
result = html_result ,
4865
4882
xlsx_url = xlsx_url ,
4883
+ dictionary_count = len (perspective_info_list ),
4884
+ group_count = len (group_list ),
4885
+ not_enough_count = not_enough_count ,
4886
+ transcription_count = total_transcription_count ,
4866
4887
minimum_spanning_tree = mst_list ,
4867
4888
embedding_2d = embedding_2d_pca ,
4868
4889
embedding_3d = embedding_3d_pca ,
@@ -5024,6 +5045,11 @@ class Arguments:
5024
5045
embedding_3d = graphene .List (graphene .List (graphene .Float ))
5025
5046
perspective_name_list = graphene .List (graphene .String )
5026
5047
5048
+ dictionary_count = graphene .Int ()
5049
+ group_count = graphene .Int ()
5050
+ not_enough_count = graphene .Int ()
5051
+ transcription_count = graphene .Int ()
5052
+
5027
5053
@staticmethod
5028
5054
def get_entry_text (entry ):
5029
5055
return f"{ '; ' .join (entry ['affix' ])} ( { '; ' .join (entry ['meaning' ])} )"
@@ -5207,17 +5233,29 @@ def morph_cognate_statistics(
5207
5233
# GC
5208
5234
del data_query
5209
5235
5236
+ group_counter = [0 ] * len (group_list )
5237
+ total_transcription_count = 0
5238
+
5210
5239
# Checking if found entries have links
5211
5240
for perspective_id , entries in result_pool .items ():
5212
5241
for group_index , group in enumerate (group_list ):
5242
+
5213
5243
# Select etymologically linked entries
5214
5244
linked = entries .keys () & group
5245
+ # Count non-empty 'linked'
5246
+ group_counter [group_index ] += (len (linked ) > 0 )
5247
+
5215
5248
for entry_id in linked :
5216
5249
result_pool [perspective_id ][entry_id ]['group' ] = group_index
5217
5250
meaning = result_pool [perspective_id ][entry_id ]['meaning' ]
5251
+ total_transcription_count += 1
5218
5252
for sub_meaning in meaning :
5219
5253
meaning_to_links [perspective_id ][sub_meaning ].add (group_index )
5220
5254
5255
+ not_enough_count = 0
5256
+ for count in group_counter :
5257
+ not_enough_count += (count < 2 )
5258
+
5221
5259
dictionary_count = len (result_pool )
5222
5260
distance_data_array = numpy .full ((dictionary_count , dictionary_count ), 50 , dtype = 'float' )
5223
5261
complex_data_array = numpy .full ((dictionary_count , dictionary_count ), "n/a" , dtype = 'object' )
@@ -5302,6 +5340,10 @@ def morph_cognate_statistics(
5302
5340
5303
5341
result = html_result ,
5304
5342
xlsx_url = xlsx_url ,
5343
+ dictionary_count = len (perspective_info_list ),
5344
+ group_count = len (group_list ),
5345
+ not_enough_count = not_enough_count ,
5346
+ transcription_count = total_transcription_count ,
5305
5347
minimum_spanning_tree = mst_list ,
5306
5348
embedding_2d = embedding_2d_pca ,
5307
5349
embedding_3d = embedding_3d_pca ,
0 commit comments