diff --git a/docs/en/install.md b/docs/en/install.md index 16b3e924390697..0f9c1c1d0e86ef 100644 --- a/docs/en/install.md +++ b/docs/en/install.md @@ -72,18 +72,27 @@ jupyter notebook
-#### Start Spark NLP Session from python +#### Start Spark NLP Session from Python -If you need to manually start SparkSession because you have other configurations and `sparknlp.start()` is not including them, you can manually start the SparkSession: + Spark session for Spark NLP can be created (or retrieved) by using `sparknlp.start()`: + +```python +import sparknlp +spark = sparknlp.start() +``` + +If you need to manually start SparkSession because you have other configurations and `sparknlp.start()` is not including them, +you can manually start the SparkSession with: ```python spark = SparkSession.builder \ - .appName("Spark NLP")\ - .master("local[*]")\ - .config("spark.driver.memory","16G")\ + .appName("Spark NLP") \ + .master("local[*]") \ + .config("spark.driver.memory", "16G") \ + .config("spark.serializer", "org.apache.spark.serializer.KryoSerializer") \ + .config("spark.kryoserializer.buffer.max", "2000M") \ .config("spark.driver.maxResultSize", "0") \ - .config("spark.kryoserializer.buffer.max", "2000M")\ - .config("spark.jars.packages", "com.johnsnowlabs.nlp:spark-nlp_2.12:5.3.1")\ + .config("spark.jars.packages", "com.johnsnowlabs.nlp:spark-nlp_2.12:5.3.1") \ .getOrCreate() ``` diff --git a/python/docs/getting_started/index.rst b/python/docs/getting_started/index.rst index 65c6d38cf0c7cf..c05a4f68d9010a 100644 --- a/python/docs/getting_started/index.rst +++ b/python/docs/getting_started/index.rst @@ -130,11 +130,12 @@ you can manually start the SparkSession with: .. code-block:: python :substitutions: - spark = SparkSession.builder \ - .appName("Spark NLP")\ - .master("local[4]")\ - .config("spark.driver.memory","16G")\ + SparkSession.builder \ + .appName("Spark NLP") \ + .master("local[*]") \ + .config("spark.driver.memory", "16G") \ + .config("spark.serializer", "org.apache.spark.serializer.KryoSerializer") \ + .config("spark.kryoserializer.buffer.max", "2000M") \ .config("spark.driver.maxResultSize", "0") \ - .config("spark.kryoserializer.buffer.max", "2000M")\ - .config("spark.jars.packages", "com.johnsnowlabs.nlp:spark-nlp_2.12:|release|")\ + .config("spark.jars.packages", "com.johnsnowlabs.nlp:spark-nlp_2.12:|release|") \ .getOrCreate()