mirror of
https://github.com/kennethreitz/langchain.git
synced 2026-06-05 23:00:18 +00:00
bcab894f4e
### Summary
Adds an `UnstructuredTSVLoader` for TSV files. Also updates the doc
strings for `UnstructuredCSV` and `UnstructuredExcel` loaders.
### Testing
```python
from langchain.document_loaders.tsv import UnstructuredTSVLoader
loader = UnstructuredTSVLoader(
file_path="example_data/mlb_teams_2012.csv", mode="elements"
)
docs = loader.load()
```
16 lines
425 B
Python
16 lines
425 B
Python
import os
|
|
from pathlib import Path
|
|
|
|
from langchain.document_loaders import UnstructuredTSVLoader
|
|
|
|
EXAMPLE_DIRECTORY = file_path = Path(__file__).parent.parent / "examples"
|
|
|
|
|
|
def test_unstructured_tsv_loader() -> None:
|
|
"""Test unstructured loader."""
|
|
file_path = os.path.join(EXAMPLE_DIRECTORY, "stanley-cups.tsv")
|
|
loader = UnstructuredTSVLoader(str(file_path))
|
|
docs = loader.load()
|
|
|
|
assert len(docs) == 1
|