langchain/libs/community/langchain_community/document_loaders
Ian Gregory e5472b5eb8
Framework for supporting more languages in LanguageParser (#13318)
## Description

I am submitting this for a school project as part of a team of 5. Other
team members are @LeilaChr, @maazh10, @Megabear137, @jelalalamy. This PR
also has contributions from community members @Harrolee and @Mario928.

Initial context is in the issue we opened (#11229).

This pull request adds:

- Generic framework for expanding the languages that `LanguageParser`
can handle, using the
[tree-sitter](https://github.com/tree-sitter/py-tree-sitter#py-tree-sitter)
parsing library and existing language-specific parsers written for it
- Support for the following additional languages in `LanguageParser`:
  - C
  - C++
  - C#
  - Go
- Java (contributed by @Mario928
https://github.com/ThatsJustCheesy/langchain/pull/2)
  - Kotlin
  - Lua
  - Perl
  - Ruby
  - Rust
  - Scala
- TypeScript (contributed by @Harrolee
https://github.com/ThatsJustCheesy/langchain/pull/1)

Here is the [design
document](https://docs.google.com/document/d/17dB14cKCWAaiTeSeBtxHpoVPGKrsPye8W0o_WClz2kk)
if curious, but no need to read it.

## Issues

- Closes #11229
- Closes #10996
- Closes #8405

## Dependencies

`tree_sitter` and `tree_sitter_languages` on PyPI. We have tried to add
these as optional dependencies.

## Documentation

We have updated the list of supported languages, and also added a
section to `source_code.ipynb` detailing how to add support for
additional languages using our framework.

## Maintainer

- @hwchase17 (previously reviewed
https://github.com/langchain-ai/langchain/pull/6486)

Thanks!!

## Git commits

We will gladly squash any/all of our commits (esp merge commits) if
necessary. Let us know if this is desirable, or if you will be
squash-merging anyway.

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
- **Tag maintainer:** for a quicker response, tag the relevant
maintainer (see below),
- **Twitter handle:** we announce bigger features on Twitter. If your PR
gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before
submitting. Run `make format`, `make lint` and `make test` to check this
locally.

See contribution guidelines for more information on how to write/run
tests, lint, etc:

https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
1. a test for the integration, preferably unit tests that do not rely on
network access,
2. an example notebook showing its use. It lives in `docs/extras`
directory.

If no one reviews your PR within a few days, please @-mention one of
@baskaryan, @eyurtsev, @hwchase17.
 -->

---------

Co-authored-by: Maaz Hashmi <mhashmi373@gmail.com>
Co-authored-by: LeilaChr <87657694+LeilaChr@users.noreply.github.com>
Co-authored-by: Jeremy La <jeremylai511@gmail.com>
Co-authored-by: Megabear137 <zubair.alnoor27@gmail.com>
Co-authored-by: Lee Harrold <lhharrold@sep.com>
Co-authored-by: Mario928 <88029051+Mario928@users.noreply.github.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
2024-02-13 08:45:49 -08:00
..
blob_loaders community[patch]: doc loaders mypy fixes (#17368) 2024-02-12 16:51:06 -08:00
parsers Framework for supporting more languages in LanguageParser (#13318) 2024-02-13 08:45:49 -08:00
__init__.py community[minor]: Add pebblo safe document loader (#16862) 2024-02-12 21:56:12 -08:00
acreom.py
airbyte_json.py
airbyte.py
airtable.py
apify_dataset.py
arcgis_loader.py community[patch]: doc loaders mypy fixes (#17368) 2024-02-12 16:51:06 -08:00
arxiv.py Update arxiv.py with get_summaries_as_docs inside of Arxivloader (#14953) 2023-12-22 13:14:22 -08:00
assemblyai.py community[patch]: doc loaders mypy fixes (#17368) 2024-02-12 16:51:06 -08:00
astradb.py community[patch]: doc loaders mypy fixes (#17368) 2024-02-12 16:51:06 -08:00
async_html.py
athena.py community[patch]: remove print (#17435) 2024-02-12 15:21:38 -08:00
azlyrics.py
azure_ai_data.py
azure_blob_storage_container.py
azure_blob_storage_file.py
baiducloud_bos_directory.py
baiducloud_bos_file.py
base_o365.py
base.py infra: add -p to mkdir in lint steps (#17013) 2024-02-05 11:22:06 -08:00
bibtex.py
bigquery.py
bilibili.py
blackboard.py infra: add print rule to ruff (#16221) 2024-02-09 16:13:30 -08:00
blockchain.py
brave_search.py
browserless.py
cassandra.py infra: add -p to mkdir in lint steps (#17013) 2024-02-05 11:22:06 -08:00
chatgpt.py
chm.py community[patch]: docstrings (#16810) 2024-02-09 12:48:57 -08:00
chromium.py
college_confidential.py
concurrent.py
confluence.py infra: add print rule to ruff (#16221) 2024-02-09 16:13:30 -08:00
conllu.py
couchbase.py
csv_loader.py community[patch]: doc loaders mypy fixes (#17368) 2024-02-12 16:51:06 -08:00
cube_semantic.py
datadog_logs.py
dataframe.py
diffbot.py
directory.py community[patch]: doc loaders mypy fixes (#17368) 2024-02-12 16:51:06 -08:00
discord.py
doc_intelligence.py infra: add -p to mkdir in lint steps (#17013) 2024-02-05 11:22:06 -08:00
docugami.py
docusaurus.py
dropbox.py infra: add print rule to ruff (#16221) 2024-02-09 16:13:30 -08:00
duckdb_loader.py
email.py
epub.py
etherscan.py infra: add print rule to ruff (#16221) 2024-02-09 16:13:30 -08:00
evernote.py
excel.py Docs: fix excel document loader typo (#15470) 2024-01-07 09:33:35 -08:00
facebook_chat.py
fauna.py
figma.py
gcs_directory.py
gcs_file.py fix: correct spelling mistakes of "seperate, intialise, pre-defined" (#14647) 2023-12-22 11:49:35 -08:00
generic.py
geodataframe.py
git.py community[patch]: doc loaders mypy fixes (#17368) 2024-02-12 16:51:06 -08:00
gitbook.py
github.py community[patch]: Add Pagination to GitHubIssuesLoader for Efficient GitHub Issues Retrieval (#16934) 2024-02-12 18:30:36 -08:00
google_speech_to_text.py
googledrive.py infra: add print rule to ruff (#16221) 2024-02-09 16:13:30 -08:00
gutenberg.py
helpers.py
hn.py
html_bs.py fix: correct spelling mistakes of "seperate, intialise, pre-defined" (#14647) 2023-12-22 11:49:35 -08:00
html.py
hugging_face_dataset.py
ifixit.py
image_captions.py
image.py
imsdb.py
iugu.py
joplin.py
json_loader.py
lakefs.py
larksuite.py
markdown.py corrected outdated link (#15053) 2023-12-22 12:39:38 -08:00
mastodon.py
max_compute.py
mediawikidump.py infra: add -p to mkdir in lint steps (#17013) 2024-02-05 11:22:06 -08:00
merge.py langchain[minor],community[minor]: Add async methods in BaseLoader (#16634) 2024-01-31 11:08:11 -08:00
mhtml.py fix: correct spelling mistakes of "seperate, intialise, pre-defined" (#14647) 2023-12-22 11:49:35 -08:00
modern_treasury.py
mongodb.py
news.py
notebook.py
notion.py
notiondb.py
nuclia.py infra: add print rule to ruff (#16221) 2024-02-09 16:13:30 -08:00
obs_directory.py
obs_file.py
obsidian.py
odt.py
onedrive_file.py
onedrive.py
onenote.py infra: add print rule to ruff (#16221) 2024-02-09 16:13:30 -08:00
open_city_data.py
org_mode.py
pdf.py community[patch]: doc loaders mypy fixes (#17368) 2024-02-12 16:51:06 -08:00
pebblo.py community[minor]: Add pebblo safe document loader (#16862) 2024-02-12 21:56:12 -08:00
polars_dataframe.py
powerpoint.py
psychic.py
pubmed.py
pyspark_dataframe.py
python.py
quip.py
readthedocs.py
recursive_url_loader.py community[patch]: doc loaders mypy fixes (#17368) 2024-02-12 16:51:06 -08:00
reddit.py
roam.py
rocksetdb.py
rspace.py fix: correct spelling mistakes of "seperate, intialise, pre-defined" (#14647) 2023-12-22 11:49:35 -08:00
rss.py
rst.py
rtf.py
s3_directory.py
s3_file.py
sharepoint.py
sitemap.py
slack_directory.py
snowflake_loader.py infra: add print rule to ruff (#16221) 2024-02-09 16:13:30 -08:00
spreedly.py
srt.py
stripe.py
surrealdb.py community[patch]: SurrealDB fix for asyncio (#16092) 2024-01-23 19:46:19 -08:00
telegram.py
tencent_cos_directory.py
tencent_cos_file.py fix: correct spelling mistakes of "seperate, intialise, pre-defined" (#14647) 2023-12-22 11:49:35 -08:00
tensorflow_datasets.py
text.py
tomarkdown.py
toml.py infra: add print rule to ruff (#16221) 2024-02-09 16:13:30 -08:00
trello.py
tsv.py
twitter.py
unstructured.py community[patch]: Load list of files using UnstructuredFileLoader (#16216) 2024-01-23 19:37:37 -08:00
url_playwright.py community[proxy]: Enhancement/add proxy support playwrighturlloader 16751 (#16822) 2024-02-12 19:48:29 -08:00
url_selenium.py
url.py
vsdx.py community[minor]: New documents loader for visio files (with extension .vsdx) (#16171) 2024-01-22 22:07:03 -08:00
weather.py
web_base.py community[patch]: Add Cookie Support to Fetch Method (#16673) 2024-01-27 16:03:53 -08:00
whatsapp_chat.py
wikipedia.py
word_document.py
xml.py
xorbits.py
youtube.py community[patch]: docstrings (#16810) 2024-02-09 12:48:57 -08:00