konlpy.py — langchain Source File
Architecture documentation for konlpy.py, a python file in the langchain codebase. 4 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR f8344cc4_57af_1c2e_79df_d4d95c61c897["konlpy.py"] 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] f8344cc4_57af_1c2e_79df_d4d95c61c897 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 91721f45_4909_e489_8c1f_084f8bd87145["typing_extensions"] f8344cc4_57af_1c2e_79df_d4d95c61c897 --> 91721f45_4909_e489_8c1f_084f8bd87145 885a8262_5dd0_fc53_460c_b7a8de727b5e["langchain_text_splitters.base"] f8344cc4_57af_1c2e_79df_d4d95c61c897 --> 885a8262_5dd0_fc53_460c_b7a8de727b5e f8344cc4_57af_1c2e_79df_d4d95c61c897["konlpy.py"] f8344cc4_57af_1c2e_79df_d4d95c61c897 --> f8344cc4_57af_1c2e_79df_d4d95c61c897 f8344cc4_57af_1c2e_79df_d4d95c61c897["konlpy.py"] f8344cc4_57af_1c2e_79df_d4d95c61c897 --> f8344cc4_57af_1c2e_79df_d4d95c61c897 style f8344cc4_57af_1c2e_79df_d4d95c61c897 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Konlpy text splitter."""
from __future__ import annotations
from typing import Any
from typing_extensions import override
from langchain_text_splitters.base import TextSplitter
try:
import konlpy
_HAS_KONLPY = True
except ImportError:
_HAS_KONLPY = False
class KonlpyTextSplitter(TextSplitter):
"""Splitting text using Konlpy package.
It is good for splitting Korean text.
"""
def __init__(
self,
separator: str = "\n\n",
**kwargs: Any,
) -> None:
"""Initialize the Konlpy text splitter.
Args:
separator: The separator to use when combining splits.
Raises:
ImportError: If Konlpy is not installed.
"""
super().__init__(**kwargs)
self._separator = separator
if not _HAS_KONLPY:
msg = """
Konlpy is not installed, please install it with
`pip install konlpy`
"""
raise ImportError(msg)
self.kkma = konlpy.tag.Kkma()
@override
def split_text(self, text: str) -> list[str]:
splits = self.kkma.sentences(text)
return self._merge_splits(splits, self._separator)
Domain
Subdomains
Functions
Classes
Dependencies
- konlpy.py
- langchain_text_splitters.base
- typing
- typing_extensions
Source
Frequently Asked Questions
What does konlpy.py do?
konlpy.py is a source file in the langchain codebase, written in python. It belongs to the DocumentProcessing domain, TextSplitters subdomain.
What functions are defined in konlpy.py?
konlpy.py defines 2 function(s): _HAS_KONLPY, konlpy.
What does konlpy.py depend on?
konlpy.py imports 4 module(s): konlpy.py, langchain_text_splitters.base, typing, typing_extensions.
What files import konlpy.py?
konlpy.py is imported by 1 file(s): konlpy.py.
Where is konlpy.py in the architecture?
konlpy.py is located at libs/text-splitters/langchain_text_splitters/konlpy.py (domain: DocumentProcessing, subdomain: TextSplitters, directory: libs/text-splitters/langchain_text_splitters).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free