Python - Pickle Spacy for PySpark

前端 未结 2 773
半阙折子戏
半阙折子戏 2021-02-06 09:29

The documentation for Spacy 2.0 mentions that the developers have added functionality to allow for Spacy to be pickled so that it can be used by a Spark Cluster interfaced by Py

2条回答
  •  星月不相逢
    2021-02-06 09:45

    This worked for my needs and seems to be very quick (adapted from end of discussion here):

    # create class to wrap spacy object
    class SpacyMagic(object):
        """
        Simple Spacy Magic to minimize loading time.
        >>> SpacyMagic.get("en")
        

提交回复
热议问题