Home / Function/ from_language() — langchain Function Reference

from_language() — langchain Function Reference

Architecture documentation for the from_language() function in character.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  72753d58_c67a_9a23_1006_2861c5bf1d1a["from_language()"]
  22d8d30b_9b36_1532_bb1c_4c9aa03a4bb8["RecursiveCharacterTextSplitter"]
  72753d58_c67a_9a23_1006_2861c5bf1d1a -->|defined in| 22d8d30b_9b36_1532_bb1c_4c9aa03a4bb8
  38b02c9d_fd32_4960_73f8_de1c2c0d0827["get_separators_for_language()"]
  72753d58_c67a_9a23_1006_2861c5bf1d1a -->|calls| 38b02c9d_fd32_4960_73f8_de1c2c0d0827
  style 72753d58_c67a_9a23_1006_2861c5bf1d1a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/text-splitters/langchain_text_splitters/character.py lines 161–176

    def from_language(
        cls, language: Language, **kwargs: Any
    ) -> RecursiveCharacterTextSplitter:
        """Return an instance of this class based on a specific language.

        This method initializes the text splitter with language-specific separators.

        Args:
            language: The language to configure the text splitter for.
            **kwargs: Additional keyword arguments to customize the splitter.

        Returns:
            An instance of the text splitter configured for the specified language.
        """
        separators = cls.get_separators_for_language(language)
        return cls(separators=separators, is_separator_regex=True, **kwargs)

Subdomains

Frequently Asked Questions

What does from_language() do?
from_language() is a function in the langchain codebase, defined in libs/text-splitters/langchain_text_splitters/character.py.
Where is from_language() defined?
from_language() is defined in libs/text-splitters/langchain_text_splitters/character.py at line 161.
What does from_language() call?
from_language() calls 1 function(s): get_separators_for_language.

Analyze Your Own Codebase

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

Try Supermodel Free