Home / Function/ _get_span() — langchain Function Reference

_get_span() — langchain Function Reference

Architecture documentation for the _get_span() function in citation_fuzzy_match.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  5e2b5a25_eccf_bb19_1eb5_5064cae0ce0a["_get_span()"]
  c34f4615_223b_2b12_36ce_287f11058e32["FactWithEvidence"]
  5e2b5a25_eccf_bb19_1eb5_5064cae0ce0a -->|defined in| c34f4615_223b_2b12_36ce_287f11058e32
  8be70a7e_02e6_604b_b482_cd466d411d5b["get_spans()"]
  8be70a7e_02e6_604b_b482_cd466d411d5b -->|calls| 5e2b5a25_eccf_bb19_1eb5_5064cae0ce0a
  style 5e2b5a25_eccf_bb19_1eb5_5064cae0ce0a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/openai_functions/citation_fuzzy_match.py lines 32–45

    def _get_span(self, quote: str, context: str, errs: int = 100) -> Iterator[str]:
        import regex

        minor = quote
        major = context

        errs_ = 0
        s = regex.search(f"({minor}){{e<={errs_}}}", major)
        while s is None and errs_ <= errs:
            errs_ += 1
            s = regex.search(f"({minor}){{e<={errs_}}}", major)

        if s is not None:
            yield from s.spans()

Subdomains

Called By

Frequently Asked Questions

What does _get_span() do?
_get_span() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/openai_functions/citation_fuzzy_match.py.
Where is _get_span() defined?
_get_span() is defined in libs/langchain/langchain_classic/chains/openai_functions/citation_fuzzy_match.py at line 32.
What calls _get_span()?
_get_span() is called by 1 function(s): get_spans.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free