INNER CODE UNIT · Python

add_window

junruxiong/IncarnaMind · docs2db.py:194

def add_window(
    doc: Document, window_steps: int, window_size: int, window_idx_name: str
):
    """Adds windowing information to the metadata of each document in the list.

    Args:
        doc (Document): List of Document objects.
        window_steps (int): Step size for windowing.
        window_size (int): Size of each window.
        window_idx_name (str): Metadata key for storing window indices.
    """
    window_id = 0
    window_deque = deque()

    for idx, item in enumerate(doc):
        if idx % window_steps == 0 and idx != 0 and idx < len(doc) - window_size:
            window_id += 1
        window_deque.append(window_id)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…