# Sliding window for Long Documents

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsliding-window-for-long-documents%2F19367%3E%5C
**Category:** 🤗Tokenizers\
**Created:** [June 20, 2022, 7:51am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsliding-window-for-long-documents%2F19367 "2022-06-20T07:51:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shreyans92dhankhar](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/shreyans92dhankhar/32/4909_2.png) [@shreyans92dhankhar](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fshreyans92dhankhar)%5C
**Post date:** [June 20, 2022, 7:51am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsliding-window-for-long-documents%2F19367%2F1 "2022-06-20T07:51:20Z")

</div>

Hi,

Is there any way to chunk a large document with left and right context? The default param in tokenizer provide only left context, is there a way we can provide right context also and predict for the central part not for the context.

 ![flert-paper](https://us1.discourse-cdn.com/hellohellohello/original/2X/5/5821f2e6b4044a5b6401415cb4b45d279c847075.png)

Similar to the approach mention in this paper: [https://arxiv.org/pdf/2011.06993.pdf](https://arxiv.org/pdf/2011.06993.pdf)

---

<div class="post-metadata">

**Author:** ![melhoushi](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/melhoushi/32/28550_2.png) [@melhoushi](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fmelhoushi)%5C
**Post date:** [February 9, 2023, 10:34pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsliding-window-for-long-documents%2F19367%2F2 "2023-02-09T22:34:33Z")

</div>

`return_over_flowing_tokens` might help:

> <https://github.com/huggingface/notebooks/blob/main/examples/question_answering.ipynb>

![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/4/49390c07fa5b0a6ab8cf9b4be315ac6f1bc8a351.png)
