Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_get_all_page 解析每个section 内容的时候,当section 跨页的时候,for 循环的range 应该是 (star… #253

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions chat_arxiv.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,23 +273,23 @@ def _get_all_page(self):
end_i = text_list[start_page].find(next_sec)
cur_sec_text += text_list[start_page][start_i:end_i]
else:
for page_i in range(start_page, end_page):
for page_i in range(start_page, end_page+1):
# print("page_i:", page_i)
if page_i == start_page:
if text_list[start_page].find(sec_name) == -1:
start_i = text_list[start_page].find(sec_name.upper())
start_i = text_list[page_i].find(sec_name.upper())
else:
start_i = text_list[start_page].find(sec_name)
start_i = text_list[page_i].find(sec_name)
cur_sec_text += text_list[page_i][start_i:]
elif page_i < end_page:
cur_sec_text += text_list[page_i]
elif page_i == end_page:
if sec_index < len(list(self.section_page_dict.keys())) - 1:
next_sec = list(self.section_page_dict.keys())[sec_index + 1]
if text_list[start_page].find(next_sec) == -1:
end_i = text_list[start_page].find(next_sec.upper())
if text_list[page_i].find(next_sec) == -1:
end_i = text_list[page_i].find(next_sec.upper())
else:
end_i = text_list[start_page].find(next_sec)
end_i = text_list[page_i].find(next_sec)
cur_sec_text += text_list[page_i][:end_i]
section_dict[sec_name] = cur_sec_text.replace('-\n', '').replace('\n', ' ')
return section_dict
Expand Down