LightRAG icon indicating copy to clipboard operation
LightRAG copied to clipboard

[Question]: The get_summary function in step_2 is a bit strange

Open small-code-cat opened this issue 9 months ago • 0 comments

Do you need to ask a question?

  • [x] I have searched the existing question and discussions and this question is not already answered.
  • [ ] I believe this is a legitimate question, not just a bug or feature request.

Your Question

def get_summary(context, tot_tokens=2000): tokens = tokenizer.tokenize(context) half_tokens = tot_tokens // 2

start_tokens = tokens[1000 : 1000 + half_tokens]
end_tokens = tokens[-(1000 + half_tokens) : 1000]

summary_tokens = start_tokens + end_tokens
summary = tokenizer.convert_tokens_to_string(summary_tokens)

return summary

This end_tokens is always empty Should it be changed to tokens[-(1000 + half_tokens) : -1000]

Additional Context

No response

small-code-cat avatar Mar 27 '25 07:03 small-code-cat