def get_shared_semantic_chunker(chunk_size_limit: int):
    """Get or create a shared semantic chunker for text files."""
    global _shared_semantic_chunker
    if _shared_semantic_chunker is None or _shared_semantic_chunker.chunk_size != chunk_size_limit:
        _shared_semantic_chunker = SemanticChunker(
            tokenizer_or_token_counter=count_tokens,
            chunk_size=chunk_size_limit,
            min_sentences=1,
            threshold=0.5,
            mode="window",
            similarity_window=2,
        )
    return _shared_semantic_chunker
Get or create a shared semantic chunker for text files.
backend/airweave/platform/transformers/code_file_chunker.py