spark-nlp 4.2.6__py2.py3-none-any.whl → 6.2.1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. com/johnsnowlabs/ml/__init__.py +0 -0
  2. com/johnsnowlabs/ml/ai/__init__.py +10 -0
  3. spark_nlp-6.2.1.dist-info/METADATA +362 -0
  4. spark_nlp-6.2.1.dist-info/RECORD +292 -0
  5. {spark_nlp-4.2.6.dist-info → spark_nlp-6.2.1.dist-info}/WHEEL +1 -1
  6. sparknlp/__init__.py +81 -28
  7. sparknlp/annotation.py +3 -2
  8. sparknlp/annotator/__init__.py +6 -0
  9. sparknlp/annotator/audio/__init__.py +2 -0
  10. sparknlp/annotator/audio/hubert_for_ctc.py +188 -0
  11. sparknlp/annotator/audio/wav2vec2_for_ctc.py +14 -14
  12. sparknlp/annotator/audio/whisper_for_ctc.py +251 -0
  13. sparknlp/{base → annotator}/chunk2_doc.py +4 -7
  14. sparknlp/annotator/chunker.py +1 -2
  15. sparknlp/annotator/classifier_dl/__init__.py +17 -0
  16. sparknlp/annotator/classifier_dl/albert_for_multiple_choice.py +161 -0
  17. sparknlp/annotator/classifier_dl/albert_for_question_answering.py +3 -15
  18. sparknlp/annotator/classifier_dl/albert_for_sequence_classification.py +4 -18
  19. sparknlp/annotator/classifier_dl/albert_for_token_classification.py +3 -17
  20. sparknlp/annotator/classifier_dl/albert_for_zero_shot_classification.py +211 -0
  21. sparknlp/annotator/classifier_dl/bart_for_zero_shot_classification.py +225 -0
  22. sparknlp/annotator/classifier_dl/bert_for_multiple_choice.py +161 -0
  23. sparknlp/annotator/classifier_dl/bert_for_question_answering.py +6 -20
  24. sparknlp/annotator/classifier_dl/bert_for_sequence_classification.py +3 -17
  25. sparknlp/annotator/classifier_dl/bert_for_token_classification.py +3 -17
  26. sparknlp/annotator/classifier_dl/bert_for_zero_shot_classification.py +212 -0
  27. sparknlp/annotator/classifier_dl/camembert_for_question_answering.py +168 -0
  28. sparknlp/annotator/classifier_dl/camembert_for_sequence_classification.py +5 -19
  29. sparknlp/annotator/classifier_dl/camembert_for_token_classification.py +5 -19
  30. sparknlp/annotator/classifier_dl/camembert_for_zero_shot_classification.py +202 -0
  31. sparknlp/annotator/classifier_dl/classifier_dl.py +4 -4
  32. sparknlp/annotator/classifier_dl/deberta_for_question_answering.py +3 -17
  33. sparknlp/annotator/classifier_dl/deberta_for_sequence_classification.py +4 -19
  34. sparknlp/annotator/classifier_dl/deberta_for_token_classification.py +5 -21
  35. sparknlp/annotator/classifier_dl/deberta_for_zero_shot_classification.py +193 -0
  36. sparknlp/annotator/classifier_dl/distil_bert_for_question_answering.py +3 -17
  37. sparknlp/annotator/classifier_dl/distil_bert_for_sequence_classification.py +4 -18
  38. sparknlp/annotator/classifier_dl/distil_bert_for_token_classification.py +3 -17
  39. sparknlp/annotator/classifier_dl/distil_bert_for_zero_shot_classification.py +211 -0
  40. sparknlp/annotator/classifier_dl/distilbert_for_multiple_choice.py +161 -0
  41. sparknlp/annotator/classifier_dl/longformer_for_question_answering.py +3 -17
  42. sparknlp/annotator/classifier_dl/longformer_for_sequence_classification.py +4 -18
  43. sparknlp/annotator/classifier_dl/longformer_for_token_classification.py +3 -17
  44. sparknlp/annotator/classifier_dl/mpnet_for_question_answering.py +148 -0
  45. sparknlp/annotator/classifier_dl/mpnet_for_sequence_classification.py +188 -0
  46. sparknlp/annotator/classifier_dl/mpnet_for_token_classification.py +173 -0
  47. sparknlp/annotator/classifier_dl/multi_classifier_dl.py +3 -3
  48. sparknlp/annotator/classifier_dl/roberta_for_multiple_choice.py +161 -0
  49. sparknlp/annotator/classifier_dl/roberta_for_question_answering.py +3 -17
  50. sparknlp/annotator/classifier_dl/roberta_for_sequence_classification.py +4 -18
  51. sparknlp/annotator/classifier_dl/roberta_for_token_classification.py +1 -1
  52. sparknlp/annotator/classifier_dl/roberta_for_zero_shot_classification.py +225 -0
  53. sparknlp/annotator/classifier_dl/sentiment_dl.py +4 -4
  54. sparknlp/annotator/classifier_dl/tapas_for_question_answering.py +2 -2
  55. sparknlp/annotator/classifier_dl/xlm_roberta_for_multiple_choice.py +149 -0
  56. sparknlp/annotator/classifier_dl/xlm_roberta_for_question_answering.py +3 -17
  57. sparknlp/annotator/classifier_dl/xlm_roberta_for_sequence_classification.py +4 -18
  58. sparknlp/annotator/classifier_dl/xlm_roberta_for_token_classification.py +6 -20
  59. sparknlp/annotator/classifier_dl/xlm_roberta_for_zero_shot_classification.py +225 -0
  60. sparknlp/annotator/classifier_dl/xlnet_for_sequence_classification.py +4 -18
  61. sparknlp/annotator/classifier_dl/xlnet_for_token_classification.py +3 -17
  62. sparknlp/annotator/cleaners/__init__.py +15 -0
  63. sparknlp/annotator/cleaners/cleaner.py +202 -0
  64. sparknlp/annotator/cleaners/extractor.py +191 -0
  65. sparknlp/annotator/coref/spanbert_coref.py +4 -18
  66. sparknlp/annotator/cv/__init__.py +15 -0
  67. sparknlp/annotator/cv/blip_for_question_answering.py +172 -0
  68. sparknlp/annotator/cv/clip_for_zero_shot_classification.py +193 -0
  69. sparknlp/annotator/cv/convnext_for_image_classification.py +269 -0
  70. sparknlp/annotator/cv/florence2_transformer.py +180 -0
  71. sparknlp/annotator/cv/gemma3_for_multimodal.py +346 -0
  72. sparknlp/annotator/cv/internvl_for_multimodal.py +280 -0
  73. sparknlp/annotator/cv/janus_for_multimodal.py +351 -0
  74. sparknlp/annotator/cv/llava_for_multimodal.py +328 -0
  75. sparknlp/annotator/cv/mllama_for_multimodal.py +340 -0
  76. sparknlp/annotator/cv/paligemma_for_multimodal.py +308 -0
  77. sparknlp/annotator/cv/phi3_vision_for_multimodal.py +328 -0
  78. sparknlp/annotator/cv/qwen2vl_transformer.py +332 -0
  79. sparknlp/annotator/cv/smolvlm_transformer.py +426 -0
  80. sparknlp/annotator/cv/swin_for_image_classification.py +242 -0
  81. sparknlp/annotator/cv/vision_encoder_decoder_for_image_captioning.py +240 -0
  82. sparknlp/annotator/cv/vit_for_image_classification.py +36 -4
  83. sparknlp/annotator/dataframe_optimizer.py +216 -0
  84. sparknlp/annotator/date2_chunk.py +88 -0
  85. sparknlp/annotator/dependency/dependency_parser.py +2 -3
  86. sparknlp/annotator/dependency/typed_dependency_parser.py +3 -4
  87. sparknlp/annotator/document_character_text_splitter.py +228 -0
  88. sparknlp/annotator/document_normalizer.py +37 -1
  89. sparknlp/annotator/document_token_splitter.py +175 -0
  90. sparknlp/annotator/document_token_splitter_test.py +85 -0
  91. sparknlp/annotator/embeddings/__init__.py +11 -0
  92. sparknlp/annotator/embeddings/albert_embeddings.py +4 -18
  93. sparknlp/annotator/embeddings/auto_gguf_embeddings.py +539 -0
  94. sparknlp/annotator/embeddings/bert_embeddings.py +9 -22
  95. sparknlp/annotator/embeddings/bert_sentence_embeddings.py +12 -24
  96. sparknlp/annotator/embeddings/bge_embeddings.py +199 -0
  97. sparknlp/annotator/embeddings/camembert_embeddings.py +4 -20
  98. sparknlp/annotator/embeddings/chunk_embeddings.py +1 -2
  99. sparknlp/annotator/embeddings/deberta_embeddings.py +2 -16
  100. sparknlp/annotator/embeddings/distil_bert_embeddings.py +5 -19
  101. sparknlp/annotator/embeddings/doc2vec.py +7 -1
  102. sparknlp/annotator/embeddings/e5_embeddings.py +195 -0
  103. sparknlp/annotator/embeddings/e5v_embeddings.py +138 -0
  104. sparknlp/annotator/embeddings/elmo_embeddings.py +2 -2
  105. sparknlp/annotator/embeddings/instructor_embeddings.py +204 -0
  106. sparknlp/annotator/embeddings/longformer_embeddings.py +3 -17
  107. sparknlp/annotator/embeddings/minilm_embeddings.py +189 -0
  108. sparknlp/annotator/embeddings/mpnet_embeddings.py +192 -0
  109. sparknlp/annotator/embeddings/mxbai_embeddings.py +184 -0
  110. sparknlp/annotator/embeddings/nomic_embeddings.py +181 -0
  111. sparknlp/annotator/embeddings/roberta_embeddings.py +9 -21
  112. sparknlp/annotator/embeddings/roberta_sentence_embeddings.py +7 -21
  113. sparknlp/annotator/embeddings/sentence_embeddings.py +2 -3
  114. sparknlp/annotator/embeddings/snowflake_embeddings.py +202 -0
  115. sparknlp/annotator/embeddings/uae_embeddings.py +211 -0
  116. sparknlp/annotator/embeddings/universal_sentence_encoder.py +3 -3
  117. sparknlp/annotator/embeddings/word2vec.py +7 -1
  118. sparknlp/annotator/embeddings/word_embeddings.py +4 -5
  119. sparknlp/annotator/embeddings/xlm_roberta_embeddings.py +9 -21
  120. sparknlp/annotator/embeddings/xlm_roberta_sentence_embeddings.py +7 -21
  121. sparknlp/annotator/embeddings/xlnet_embeddings.py +4 -18
  122. sparknlp/annotator/er/entity_ruler.py +37 -23
  123. sparknlp/annotator/keyword_extraction/yake_keyword_extraction.py +2 -3
  124. sparknlp/annotator/ld_dl/language_detector_dl.py +2 -2
  125. sparknlp/annotator/lemmatizer.py +3 -4
  126. sparknlp/annotator/matcher/date_matcher.py +35 -3
  127. sparknlp/annotator/matcher/multi_date_matcher.py +1 -2
  128. sparknlp/annotator/matcher/regex_matcher.py +3 -3
  129. sparknlp/annotator/matcher/text_matcher.py +2 -3
  130. sparknlp/annotator/n_gram_generator.py +1 -2
  131. sparknlp/annotator/ner/__init__.py +3 -1
  132. sparknlp/annotator/ner/ner_converter.py +18 -0
  133. sparknlp/annotator/ner/ner_crf.py +4 -5
  134. sparknlp/annotator/ner/ner_dl.py +10 -5
  135. sparknlp/annotator/ner/ner_dl_graph_checker.py +293 -0
  136. sparknlp/annotator/ner/ner_overwriter.py +2 -2
  137. sparknlp/annotator/ner/zero_shot_ner_model.py +173 -0
  138. sparknlp/annotator/normalizer.py +2 -2
  139. sparknlp/annotator/openai/__init__.py +16 -0
  140. sparknlp/annotator/openai/openai_completion.py +349 -0
  141. sparknlp/annotator/openai/openai_embeddings.py +106 -0
  142. sparknlp/annotator/pos/perceptron.py +6 -7
  143. sparknlp/annotator/sentence/sentence_detector.py +2 -2
  144. sparknlp/annotator/sentence/sentence_detector_dl.py +3 -3
  145. sparknlp/annotator/sentiment/sentiment_detector.py +4 -5
  146. sparknlp/annotator/sentiment/vivekn_sentiment.py +4 -5
  147. sparknlp/annotator/seq2seq/__init__.py +17 -0
  148. sparknlp/annotator/seq2seq/auto_gguf_model.py +304 -0
  149. sparknlp/annotator/seq2seq/auto_gguf_reranker.py +334 -0
  150. sparknlp/annotator/seq2seq/auto_gguf_vision_model.py +336 -0
  151. sparknlp/annotator/seq2seq/bart_transformer.py +420 -0
  152. sparknlp/annotator/seq2seq/cohere_transformer.py +357 -0
  153. sparknlp/annotator/seq2seq/cpm_transformer.py +321 -0
  154. sparknlp/annotator/seq2seq/gpt2_transformer.py +1 -1
  155. sparknlp/annotator/seq2seq/llama2_transformer.py +343 -0
  156. sparknlp/annotator/seq2seq/llama3_transformer.py +381 -0
  157. sparknlp/annotator/seq2seq/m2m100_transformer.py +392 -0
  158. sparknlp/annotator/seq2seq/marian_transformer.py +124 -3
  159. sparknlp/annotator/seq2seq/mistral_transformer.py +348 -0
  160. sparknlp/annotator/seq2seq/nllb_transformer.py +420 -0
  161. sparknlp/annotator/seq2seq/olmo_transformer.py +326 -0
  162. sparknlp/annotator/seq2seq/phi2_transformer.py +326 -0
  163. sparknlp/annotator/seq2seq/phi3_transformer.py +330 -0
  164. sparknlp/annotator/seq2seq/phi4_transformer.py +387 -0
  165. sparknlp/annotator/seq2seq/qwen_transformer.py +340 -0
  166. sparknlp/annotator/seq2seq/starcoder_transformer.py +335 -0
  167. sparknlp/annotator/seq2seq/t5_transformer.py +54 -4
  168. sparknlp/annotator/similarity/__init__.py +0 -0
  169. sparknlp/annotator/similarity/document_similarity_ranker.py +379 -0
  170. sparknlp/annotator/spell_check/context_spell_checker.py +116 -17
  171. sparknlp/annotator/spell_check/norvig_sweeting.py +3 -6
  172. sparknlp/annotator/spell_check/symmetric_delete.py +1 -1
  173. sparknlp/annotator/stemmer.py +2 -3
  174. sparknlp/annotator/stop_words_cleaner.py +3 -4
  175. sparknlp/annotator/tf_ner_dl_graph_builder.py +1 -1
  176. sparknlp/annotator/token/__init__.py +0 -1
  177. sparknlp/annotator/token/recursive_tokenizer.py +2 -3
  178. sparknlp/annotator/token/tokenizer.py +2 -3
  179. sparknlp/annotator/ws/word_segmenter.py +35 -10
  180. sparknlp/base/__init__.py +2 -3
  181. sparknlp/base/doc2_chunk.py +0 -3
  182. sparknlp/base/document_assembler.py +5 -5
  183. sparknlp/base/embeddings_finisher.py +14 -2
  184. sparknlp/base/finisher.py +15 -4
  185. sparknlp/base/gguf_ranking_finisher.py +234 -0
  186. sparknlp/base/image_assembler.py +69 -0
  187. sparknlp/base/light_pipeline.py +53 -21
  188. sparknlp/base/multi_document_assembler.py +9 -13
  189. sparknlp/base/prompt_assembler.py +207 -0
  190. sparknlp/base/token_assembler.py +1 -2
  191. sparknlp/common/__init__.py +2 -0
  192. sparknlp/common/annotator_type.py +1 -0
  193. sparknlp/common/completion_post_processing.py +37 -0
  194. sparknlp/common/match_strategy.py +33 -0
  195. sparknlp/common/properties.py +914 -9
  196. sparknlp/internal/__init__.py +841 -116
  197. sparknlp/internal/annotator_java_ml.py +1 -1
  198. sparknlp/internal/annotator_transformer.py +3 -0
  199. sparknlp/logging/comet.py +2 -2
  200. sparknlp/partition/__init__.py +16 -0
  201. sparknlp/partition/partition.py +244 -0
  202. sparknlp/partition/partition_properties.py +902 -0
  203. sparknlp/partition/partition_transformer.py +200 -0
  204. sparknlp/pretrained/pretrained_pipeline.py +1 -1
  205. sparknlp/pretrained/resource_downloader.py +126 -2
  206. sparknlp/reader/__init__.py +15 -0
  207. sparknlp/reader/enums.py +19 -0
  208. sparknlp/reader/pdf_to_text.py +190 -0
  209. sparknlp/reader/reader2doc.py +124 -0
  210. sparknlp/reader/reader2image.py +136 -0
  211. sparknlp/reader/reader2table.py +44 -0
  212. sparknlp/reader/reader_assembler.py +159 -0
  213. sparknlp/reader/sparknlp_reader.py +461 -0
  214. sparknlp/training/__init__.py +1 -0
  215. sparknlp/training/conll.py +8 -2
  216. sparknlp/training/spacy_to_annotation.py +57 -0
  217. sparknlp/util.py +26 -0
  218. spark_nlp-4.2.6.dist-info/METADATA +0 -1256
  219. spark_nlp-4.2.6.dist-info/RECORD +0 -196
  220. {spark_nlp-4.2.6.dist-info → spark_nlp-6.2.1.dist-info}/top_level.txt +0 -0
  221. /sparknlp/annotator/{token/token2_chunk.py → token2_chunk.py} +0 -0
File without changes
@@ -0,0 +1,10 @@
1
+ import sys
2
+
3
+ if sys.version_info[0] == 2:
4
+ raise ImportError(
5
+ "Spark NLP for Python 2.x is deprecated since version >= 4.0. "
6
+ "Please use an older versions to use it with this Python version."
7
+ )
8
+ else:
9
+ import sparknlp
10
+ sys.modules['com.johnsnowlabs.ml.ai'] = sparknlp
@@ -0,0 +1,362 @@
1
+ Metadata-Version: 2.4
2
+ Name: spark-nlp
3
+ Version: 6.2.1
4
+ Summary: John Snow Labs Spark NLP is a natural language processing library built on top of Apache Spark ML. It provides simple, performant & accurate NLP annotations for machine learning pipelines, that scale easily in a distributed environment.
5
+ Home-page: https://github.com/JohnSnowLabs/spark-nlp
6
+ Author: John Snow Labs
7
+ Keywords: NLP spark vision speech deep learning transformer tensorflow BERT GPT-2 Wav2Vec2 ViT
8
+ Classifier: Development Status :: 5 - Production/Stable
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Information Technology
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Operating System :: MacOS :: MacOS X
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.6
19
+ Classifier: Programming Language :: Python :: 3.7
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Topic :: Software Development :: Internationalization
26
+ Classifier: Topic :: Software Development :: Localization
27
+ Classifier: Topic :: Software Development :: Build Tools
28
+ Classifier: Topic :: Text Processing :: Linguistic
29
+ Classifier: Topic :: Scientific/Engineering
30
+ Classifier: Typing :: Typed
31
+ Description-Content-Type: text/markdown
32
+ Dynamic: author
33
+ Dynamic: classifier
34
+ Dynamic: description
35
+ Dynamic: description-content-type
36
+ Dynamic: home-page
37
+ Dynamic: keywords
38
+ Dynamic: summary
39
+
40
+ # Spark NLP: State-of-the-Art Natural Language Processing & LLMs Library
41
+
42
+ <p align="center">
43
+ <a href="https://github.com/JohnSnowLabs/spark-nlp/actions" alt="build">
44
+ <img src="https://github.com/JohnSnowLabs/spark-nlp/workflows/build/badge.svg" /></a>
45
+ <a href="https://github.com/JohnSnowLabs/spark-nlp/releases" alt="Current Release Version">
46
+ <img src="https://img.shields.io/github/v/release/JohnSnowLabs/spark-nlp.svg?style=flat-square&logo=github" /></a>
47
+ <a href="https://search.maven.org/artifact/com.johnsnowlabs.nlp/spark-nlp_2.12" alt="Maven Central">
48
+ <img src="https://maven-badges.herokuapp.com/maven-central/com.johnsnowlabs.nlp/spark-nlp_2.12/badge.svg" /></a>
49
+ <a href="https://badge.fury.io/py/spark-nlp" alt="PyPI version">
50
+ <img src="https://badge.fury.io/py/spark-nlp.svg" /></a>
51
+ <a href="https://anaconda.org/JohnSnowLabs/spark-nlp" alt="Anaconda-Cloud">
52
+ <img src="https://anaconda.org/johnsnowlabs/spark-nlp/badges/version.svg" /></a>
53
+ <a href="https://github.com/JohnSnowLabs/spark-nlp/blob/master/LICENSE" alt="License">
54
+ <img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" /></a>
55
+ <a href="https://pypi.org/project/spark-nlp/" alt="PyPi downloads">
56
+ <img src="https://static.pepy.tech/personalized-badge/spark-nlp?period=total&units=international_system&left_color=grey&right_color=orange&left_text=pip%20downloads" /></a>
57
+ </p>
58
+
59
+ Spark NLP is a state-of-the-art Natural Language Processing library built on top of Apache Spark. It provides **simple**, **performant** & **accurate** NLP annotations for machine learning pipelines that **scale** easily in a distributed environment.
60
+
61
+ Spark NLP comes with **100000+** pretrained **pipelines** and **models** in more than **200+** languages.
62
+ It also offers tasks such as **Tokenization**, **Word Segmentation**, **Part-of-Speech Tagging**, Word and Sentence **Embeddings**, **Named Entity Recognition**, **Dependency Parsing**, **Spell Checking**, **Text Classification**, **Sentiment Analysis**, **Token Classification**, **Machine Translation** (+180 languages), **Summarization**, **Question Answering**, **Table Question Answering**, **Text Generation**, **Image Classification**, **Image to Text (captioning)**, **Automatic Speech Recognition**, **Zero-Shot Learning**, and many more [NLP tasks](#features).
63
+
64
+ **Spark NLP** is the only open-source NLP library in **production** that offers state-of-the-art transformers such as **BERT**, **CamemBERT**, **ALBERT**, **ELECTRA**, **XLNet**, **DistilBERT**, **RoBERTa**, **DeBERTa**, **XLM-RoBERTa**, **Longformer**, **ELMO**, **Universal Sentence Encoder**, **Llama-2**, **M2M100**, **BART**, **Instructor**, **E5**, **Google T5**, **MarianMT**, **OpenAI GPT2**, **Vision Transformers (ViT)**, **OpenAI Whisper**, **Llama**, **Mistral**, **Phi**, **Qwen2**, and many more not only to **Python** and **R**, but also to **JVM** ecosystem (**Java**, **Scala**, and **Kotlin**) at **scale** by extending **Apache Spark** natively.
65
+
66
+ ## Model Importing Support
67
+
68
+ Spark NLP provides easy support for importing models from various popular frameworks:
69
+
70
+ - **TensorFlow**
71
+ - **ONNX**
72
+ - **OpenVINO**
73
+ - **Llama.cpp (GGUF)**
74
+
75
+ This wide range of support allows you to seamlessly integrate models from different sources into your Spark NLP workflows, enhancing flexibility and compatibility with existing machine learning ecosystems.
76
+
77
+ ## Project's website
78
+
79
+ Take a look at our official Spark NLP page: [https://sparknlp.org/](https://sparknlp.org/) for user
80
+ documentation and examples
81
+
82
+ ## Features
83
+
84
+ - [Text Preprocessing](https://sparknlp.org/docs/en/features#text-preproccesing)
85
+ - [Parsing and Analysis](https://sparknlp.org/docs/en/features#parsing-and-analysis)
86
+ - [Sentiment and Classification](https://sparknlp.org/docs/en/features#sentiment-and-classification)
87
+ - [Embeddings](https://sparknlp.org/docs/en/features#embeddings)
88
+ - [Classification and Question Answering](https://sparknlp.org/docs/en/features#classification-and-question-answering-models)
89
+ - [Machine Translation and Generation](https://sparknlp.org/docs/en/features#machine-translation-and-generation)
90
+ - [Image and Speech](https://sparknlp.org/docs/en/features#image-and-speech)
91
+ - [Integration and Interoperability (ONNX, OpenVINO)](https://sparknlp.org/docs/en/features#integration-and-interoperability)
92
+ - [Pre-trained Models (36000+ in +200 languages)](https://sparknlp.org/docs/en/features#pre-trained-models)
93
+ - [Multi-lingual Support](https://sparknlp.org/docs/en/features#multi-lingual-support)
94
+
95
+ ## Quick Start
96
+
97
+ This is a quick example of how to use a Spark NLP pre-trained pipeline in Python and PySpark:
98
+
99
+ ```sh
100
+ $ java -version
101
+ # should be Java 8 or 11 (Oracle or OpenJDK)
102
+ $ conda create -n sparknlp python=3.7 -y
103
+ $ conda activate sparknlp
104
+ # spark-nlp by default is based on pyspark 3.x
105
+ $ pip install spark-nlp==6.2.1 pyspark==3.3.1
106
+ ```
107
+
108
+ In Python console or Jupyter `Python3` kernel:
109
+
110
+ ```python
111
+ # Import Spark NLP
112
+ from sparknlp.base import *
113
+ from sparknlp.annotator import *
114
+ from sparknlp.pretrained import PretrainedPipeline
115
+ import sparknlp
116
+
117
+ # Start SparkSession with Spark NLP
118
+ # start() functions has 3 parameters: gpu, apple_silicon, and memory
119
+ # sparknlp.start(gpu=True) will start the session with GPU support
120
+ # sparknlp.start(apple_silicon=True) will start the session with macOS M1 & M2 support
121
+ # sparknlp.start(memory="16G") to change the default driver memory in SparkSession
122
+ spark = sparknlp.start()
123
+
124
+ # Download a pre-trained pipeline
125
+ pipeline = PretrainedPipeline('explain_document_dl', lang='en')
126
+
127
+ # Your testing dataset
128
+ text = """
129
+ The Mona Lisa is a 16th century oil painting created by Leonardo.
130
+ It's held at the Louvre in Paris.
131
+ """
132
+
133
+ # Annotate your testing dataset
134
+ result = pipeline.annotate(text)
135
+
136
+ # What's in the pipeline
137
+ list(result.keys())
138
+ Output: ['entities', 'stem', 'checked', 'lemma', 'document',
139
+ 'pos', 'token', 'ner', 'embeddings', 'sentence']
140
+
141
+ # Check the results
142
+ result['entities']
143
+ Output: ['Mona Lisa', 'Leonardo', 'Louvre', 'Paris']
144
+ ```
145
+
146
+ For more examples, you can visit our dedicated [examples](https://github.com/JohnSnowLabs/spark-nlp/tree/master/examples) to showcase all Spark NLP use cases!
147
+
148
+ ### Packages Cheatsheet
149
+
150
+ This is a cheatsheet for corresponding Spark NLP Maven package to Apache Spark / PySpark major version:
151
+
152
+ | Apache Spark | Spark NLP on CPU | Spark NLP on GPU | Spark NLP on AArch64 (linux) | Spark NLP on Apple Silicon |
153
+ |-------------------------|--------------------|----------------------------|--------------------------------|--------------------------------------|
154
+ | 3.0/3.1/3.2/3.3/3.4/3.5 | `spark-nlp` | `spark-nlp-gpu` | `spark-nlp-aarch64` | `spark-nlp-silicon` |
155
+ | Start Function | `sparknlp.start()` | `sparknlp.start(gpu=True)` | `sparknlp.start(aarch64=True)` | `sparknlp.start(apple_silicon=True)` |
156
+
157
+ NOTE: `M1/M2` and `AArch64` are under `experimental` support. Access and support to these architectures are limited by the
158
+ community and we had to build most of the dependencies by ourselves to make them compatible. We support these two
159
+ architectures, however, they may not work in some environments.
160
+
161
+ ## Pipelines and Models
162
+
163
+ For a quick example of using pipelines and models take a look at our official [documentation](https://sparknlp.org/docs/en/install#pipelines-and-models)
164
+
165
+ #### Please check out our Models Hub for the full list of [pre-trained models](https://sparknlp.org/models) with examples, demo, benchmark, and more
166
+
167
+ ## Platform and Ecosystem Support
168
+
169
+ ### Apache Spark Support
170
+
171
+ Spark NLP *6.2.1* has been built on top of Apache Spark 3.4 while fully supports Apache Spark 3.0.x, 3.1.x, 3.2.x, 3.3.x, 3.4.x, and 3.5.x
172
+
173
+ | Spark NLP | Apache Spark 3.5.x | Apache Spark 3.4.x | Apache Spark 3.3.x | Apache Spark 3.2.x | Apache Spark 3.1.x | Apache Spark 3.0.x | Apache Spark 2.4.x | Apache Spark 2.3.x |
174
+ |-----------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|--------------------|
175
+ | 6.x.x and up | YES | YES | YES | YES | YES | YES | NO | NO |
176
+ | 5.5.x | YES | YES | YES | YES | YES | YES | NO | NO |
177
+ | 5.4.x | YES | YES | YES | YES | YES | YES | NO | NO |
178
+ | 5.3.x | YES | YES | YES | YES | YES | YES | NO | NO |
179
+ | 5.2.x | YES | YES | YES | YES | YES | YES | NO | NO |
180
+ | 5.1.x | Partially | YES | YES | YES | YES | YES | NO | NO |
181
+ | 5.0.x | YES | YES | YES | YES | YES | YES | NO | NO |
182
+
183
+ Find out more about `Spark NLP` versions from our [release notes](https://github.com/JohnSnowLabs/spark-nlp/releases).
184
+
185
+ ### Scala and Python Support
186
+
187
+ | Spark NLP | Python 3.6 | Python 3.7 | Python 3.8 | Python 3.9 | Python 3.10| Scala 2.11 | Scala 2.12 |
188
+ |-----------|------------|------------|------------|------------|------------|------------|------------|
189
+ | 6.0.x | NO | YES | YES | YES | YES | NO | YES |
190
+ | 5.5.x | NO | YES | YES | YES | YES | NO | YES |
191
+ | 5.4.x | NO | YES | YES | YES | YES | NO | YES |
192
+ | 5.3.x | NO | YES | YES | YES | YES | NO | YES |
193
+ | 5.2.x | NO | YES | YES | YES | YES | NO | YES |
194
+ | 5.1.x | NO | YES | YES | YES | YES | NO | YES |
195
+ | 5.0.x | NO | YES | YES | YES | YES | NO | YES |
196
+
197
+ Find out more about 4.x `SparkNLP` versions in our official [documentation](https://sparknlp.org/docs/en/install#apache-spark-support)
198
+
199
+ ### Databricks Support
200
+
201
+ Spark NLP 6.2.1 has been tested and is compatible with the following runtimes:
202
+
203
+ | **CPU** | **GPU** |
204
+ |--------------------|--------------------|
205
+ | 14.1 / 14.1 ML | 14.1 ML & GPU |
206
+ | 14.2 / 14.2 ML | 14.2 ML & GPU |
207
+ | 14.3 / 14.3 ML | 14.3 ML & GPU |
208
+ | 15.0 / 15.0 ML | 15.0 ML & GPU |
209
+ | 15.1 / 15.1 ML | 15.1 ML & GPU |
210
+ | 15.2 / 15.2 ML | 15.2 ML & GPU |
211
+ | 15.3 / 15.3 ML | 15.3 ML & GPU |
212
+ | 15.4 / 15.4 ML | 15.4 ML & GPU |
213
+ | 16.4 / 16.4 ML | 16.4 ML & GPU |
214
+
215
+ We are compatible with older runtimes. For a full list check databricks support in our official [documentation](https://sparknlp.org/docs/en/install#databricks-support)
216
+
217
+ ### EMR Support
218
+
219
+ Spark NLP 6.2.1 has been tested and is compatible with the following EMR releases:
220
+
221
+ | **EMR Release** |
222
+ |--------------------|
223
+ | emr-6.13.0 |
224
+ | emr-6.14.0 |
225
+ | emr-6.15.0 |
226
+ | emr-7.0.0 |
227
+ | emr-7.1.0 |
228
+ | emr-7.2.0 |
229
+ | emr-7.3.0 |
230
+ | emr-7.4.0 |
231
+ | emr-7.5.0 |
232
+ | emr-7.6.0 |
233
+ | emr-7.7.0 |
234
+ | emr-7.8.0 |
235
+
236
+
237
+ We are compatible with older EMR releases. For a full list check EMR support in our official [documentation](https://sparknlp.org/docs/en/install#emr-support)
238
+
239
+ Full list of [Amazon EMR 6.x releases](https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-release-6x.html)
240
+ Full list of [Amazon EMR 7.x releases](https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-release-7x.html)
241
+
242
+ NOTE: The EMR 6.1.0 and 6.1.1 are not supported.
243
+
244
+ ## Installation
245
+
246
+ ### Command line (requires internet connection)
247
+
248
+ To install spark-nlp packages through command line follow [these instructions](https://sparknlp.org/docs/en/install#command-line) from our official documentation
249
+
250
+ ### Scala
251
+
252
+ Spark NLP supports Scala 2.12.15 if you are using Apache Spark 3.0.x, 3.1.x, 3.2.x, 3.3.x, and 3.4.x versions. Our packages are
253
+ deployed to Maven central. To add any of our packages as a dependency in your application you can follow [these instructions](https://sparknlp.org/docs/en/install#scala-and-java)
254
+ from our official documentation.
255
+
256
+ If you are interested, there is a simple SBT project for Spark NLP to guide you on how to use it in your
257
+ projects [Spark NLP Starter](https://github.com/maziyarpanahi/spark-nlp-starter)
258
+
259
+ ### Python
260
+
261
+ Spark NLP supports Python 3.7.x and above depending on your major PySpark version.
262
+ Check all available installations for Python in our official [documentation](https://sparknlp.org/docs/en/install#python)
263
+
264
+ ### Compiled JARs
265
+
266
+ To compile the jars from source follow [these instructions](https://sparknlp.org/docs/en/compiled#jars) from our official documentation
267
+
268
+ ## Platform-Specific Instructions
269
+
270
+ For detailed instructions on how to use Spark NLP on supported platforms, please refer to our official documentation:
271
+
272
+ | Platform | Supported Language(s) |
273
+ |-------------------------|-----------------------|
274
+ | [Apache Zeppelin](https://sparknlp.org/docs/en/install#apache-zeppelin) | Scala, Python |
275
+ | [Jupyter Notebook](https://sparknlp.org/docs/en/install#jupter-notebook) | Python |
276
+ | [Google Colab Notebook](https://sparknlp.org/docs/en/install#google-colab-notebook) | Python |
277
+ | [Kaggle Kernel](https://sparknlp.org/docs/en/install#kaggle-kernel) | Python |
278
+ | [Databricks Cluster](https://sparknlp.org/docs/en/install#databricks-cluster) | Scala, Python |
279
+ | [EMR Cluster](https://sparknlp.org/docs/en/install#emr-cluster) | Scala, Python |
280
+ | [GCP Dataproc Cluster](https://sparknlp.org/docs/en/install#gcp-dataproc) | Scala, Python |
281
+
282
+ ### Offline
283
+
284
+ Spark NLP library and all the pre-trained models/pipelines can be used entirely offline with no access to the Internet.
285
+ Please check [these instructions](https://sparknlp.org/docs/en/install#s3-integration) from our official documentation
286
+ to use Spark NLP offline.
287
+
288
+ ## Advanced Settings
289
+
290
+ You can change Spark NLP configurations via Spark properties configuration.
291
+ Please check [these instructions](https://sparknlp.org/docs/en/install#sparknlp-properties) from our official documentation.
292
+
293
+ ### S3 Integration
294
+
295
+ In Spark NLP we can define S3 locations to:
296
+
297
+ - Export log files of training models
298
+ - Store tensorflow graphs used in `NerDLApproach`
299
+
300
+ Please check [these instructions](https://sparknlp.org/docs/en/install#s3-integration) from our official documentation.
301
+
302
+ ## Documentation
303
+
304
+ ### Examples
305
+
306
+ Need more **examples**? Check out our dedicated [Spark NLP Examples](https://github.com/JohnSnowLabs/spark-nlp/tree/master/examples)
307
+ repository to showcase all Spark NLP use cases!
308
+
309
+ Also, don't forget to check [Spark NLP in Action](https://sparknlp.org/demos) built by Streamlit.
310
+
311
+ #### All examples: [spark-nlp/examples](https://github.com/JohnSnowLabs/spark-nlp/tree/master/examples)
312
+
313
+ ### FAQ
314
+
315
+ [Check our Articles and Videos page here](https://sparknlp.org/learn)
316
+
317
+ ### Citation
318
+
319
+ We have published a [paper](https://www.sciencedirect.com/science/article/pii/S2665963821000063) that you can cite for
320
+ the Spark NLP library:
321
+
322
+ ```bibtex
323
+ @article{KOCAMAN2021100058,
324
+ title = {Spark NLP: Natural language understanding at scale},
325
+ journal = {Software Impacts},
326
+ pages = {100058},
327
+ year = {2021},
328
+ issn = {2665-9638},
329
+ doi = {https://doi.org/10.1016/j.simpa.2021.100058},
330
+ url = {https://www.sciencedirect.com/science/article/pii/S2665963.2.300063},
331
+ author = {Veysel Kocaman and David Talby},
332
+ keywords = {Spark, Natural language processing, Deep learning, Tensorflow, Cluster},
333
+ abstract = {Spark NLP is a Natural Language Processing (NLP) library built on top of Apache Spark ML. It provides simple, performant & accurate NLP annotations for machine learning pipelines that can scale easily in a distributed environment. Spark NLP comes with 1100+ pretrained pipelines and models in more than 192+ languages. It supports nearly all the NLP tasks and modules that can be used seamlessly in a cluster. Downloaded more than 2.7 million times and experiencing 9x growth since January 2020, Spark NLP is used by 54% of healthcare organizations as the world’s most widely used NLP library in the enterprise.}
334
+ }
335
+ }
336
+ ```
337
+
338
+ ## Community support
339
+
340
+ - [Slack](https://join.slack.com/t/spark-nlp/shared_invite/zt-198dipu77-L3UWNe_AJ8xqDk0ivmih5Q) For live discussion with the Spark NLP community and the team
341
+ - [GitHub](https://github.com/JohnSnowLabs/spark-nlp) Bug reports, feature requests, and contributions
342
+ - [Discussions](https://github.com/JohnSnowLabs/spark-nlp/discussions) Engage with other community members, share ideas,
343
+ and show off how you use Spark NLP!
344
+ - [Medium](https://medium.com/spark-nlp) Spark NLP articles
345
+ - [YouTube](https://www.youtube.com/channel/UCmFOjlpYEhxf_wJUDuz6xxQ/videos) Spark NLP video tutorials
346
+
347
+ ## Contributing
348
+
349
+ We appreciate any sort of contributions:
350
+
351
+ - ideas
352
+ - feedback
353
+ - documentation
354
+ - bug reports
355
+ - NLP training and testing corpora
356
+ - Development and testing
357
+
358
+ Clone the repo and submit your pull-requests! Or directly create issues in this repo.
359
+
360
+ ## John Snow Labs
361
+
362
+ [http://johnsnowlabs.com](http://johnsnowlabs.com)