From 68d46b2a1e3ed98ca11c9116b442bbcb11f51e3e Mon Sep 17 00:00:00 2001 From: Luo Pan <45253432+unsw-luopan@users.noreply.github.com> Date: Fri, 13 Dec 2024 08:50:58 +0800 Subject: [PATCH] Fix bug in hierarchical_merge function (#4006) ### What problem does this PR solve? Fix hierarchical_merge function. From idx vs. actual value to actual value vs. actual value. Related issue #4003 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Co-authored-by: luopan --- rag/nlp/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rag/nlp/__init__.py b/rag/nlp/__init__.py index 2aaf98aab0..eb529f68b5 100644 --- a/rag/nlp/__init__.py +++ b/rag/nlp/__init__.py @@ -466,7 +466,7 @@ def binary_search(arr, target): jj = binary_search(levels[ii], j) if jj < 0: continue - if jj > cks[-1][-1]: + if levels[ii][jj] > cks[-1][-1]: cks[-1].pop(-1) cks[-1].append(levels[ii][jj]) for ii in cks[-1]: