spark-nlp_如何在2周内开始使用Spark NLP-第一部分

spark-nlp

If you want to make a head start in enterprise NLP, but have no clue about Spark, this article is for you. I have seen many colleagues wanting to step to this domain but disheartened due to the initial learning overhead that comes with Spark. It may seem inconspicuous at first glance since Spark code is a bit different than your regular Python script. However, Spark and Spark NLP basics aren’t really hard to learn. If you axiomatically accept this assertion, I will show you how easy the basics are and will provide a road map to pave the way to learn key elements, which will satisfy most use cases of an intermediate level practitioner. Due to impeccable modularity that comes with Spark NLP pipelines, for an average learner, -mark my words- two weeks will be enough to build basic models. Roll up your sleeves, here we start!

如果您想在企业级NLP中领先,但是对Spark毫无头绪,那么本文适合您。 我已经看到许多同事希望踏入这一领域,但由于Spark带来的最初学习开销而灰心。 乍一看似乎不太明显,因为Spark代码与常规Python脚本有点不同。 但是,Spark和Spark NLP基础知识并不难学习。 如果您公理地接受此主张,我将向您展示基础知识有多么简单,并将提供路线图,为学习关键要素铺平道路,这将满足中级从业人员的大多数用例。 由于Spark NLP管道随附无可挑剔的模块化,对于普通学习者来说,请记住我的话,两周就足以建立基本模型。 卷起袖子,我们开始!

Why Spark NLP?Supply and Demand is the answer: It Is The Most Widely Used Library In Enterprises! Here are a few reasons why. Common NLP packages today have been designed by academics and they favor ease of prototyping over runtime performance, eclipsing scalability, error handling, target frugal memory consumption and code reuse. Although some libraries like ‘the industrial-strength NLP library — spaCy’ might be considered an exception (since they are designed to get things done rather than doing research), they may fall short of enterprise targets when it comes to dealing with data in volume.

为什么选择Spark NLP? 供求关系就是答案:它是企业中使用最广泛的图书馆! 原因如下 。 如今,常见的NLP软件包是由学者设计的,它们倾向于简化原型设计而不是运行时性能,使可伸缩性,错误处理,目标节俭的内存消耗和代码重用黯然失色。 尽管某些库(例如“具有行业实力的NLP库-spaCy”)可能会被视为例外(因为它们是为完成任务而不是进行研究而设计的),但在处理海量数据时,它们可能无法达到企业目标。

Image for post
Usage of tools designed for research and smaller scale tasks cannot be handy 使用用于研究和较小规模任务的工具不方便

We are going to have a different strategy here. Rather than following the crowds in the routine, we will use basic libraries to brush up ‘basics’ and then jump directly to address the enterprise sector. Our final aim is to target the niche by building continental pipelines, which are impossible to resolve with standard libraries, albeit their capacity in their league.

我们将在这里采取不同的策略 。 我们将使用基本库来整理“基础知识”,然后直接跳转到企业领域,而不是在日常工作中随波逐流。 我们的最终目标是通过建立大陆式管道来瞄准利基市场,尽管它们在同盟中是有能力的,但是标准管道无法解决这些问题。

If you are not convinced yet, please read this article for benchmarking and comparison with spaCy, which will give you five good reasons to start with Spark NLP. First of all Spark NLP has the innate trait of scalability it inherits from Spark, which was primarily used for distributed applications, it is designed to be scalable. Spark NLP benefits from this since it can scale on any Spark cluster as well as on-premise and with any cloud provider. Furthermore, Spark NLP optimizations are done in such a way that it could run orders of magnitude faster than what the inherent design limitations of legacy libraries allow. It provides the concepts of annotators and it includes more than what other NLP libs include. It includes sentence detection, tokenization, stemming, lemmatization, POS Tagger, NER, dependency parse, text matcher, date matcher, chunking, context-aware spell checking, sentiment detector, pre-trained models, and training models with very high accuracy according to academic peer-reviewed results. Spark NLP also includes production-ready implementation of BERT embeddings for named entity recognition. For example, it makes much fewer errors on NER compared to spaCy, which we tested in the second part of this article. Also, worthy of notice, Spark NLP includes features that provide full Python API, supports training on GPU, user-defined deep learning networks, Spark, and Hadoop.

如果您还不确定,请阅读本文以进行spaCy的基准测试和比较,这将为您提供五个从Spark NLP开始的良好理由。 首先,Spark NLP具有可扩展性的先天特性,它继承自Spark,Spark主要用于分布式应用程序,并且设计为可扩展的 。 Spark NLP可以从中受益,因为它可以在任何Spark集群以及内部部署和任何云提供商上进行扩展。 此外,Spark NLP优化以一种比传统库固有的设计限制所允许的运行速度快几个数量级的方式进行。 它提供了注释器的概念,并且比其他NLP库包含的内容更多。 它包括句子检测,标记化,词干提取,词形化,POS Tagger,NER,依赖性解析,文本匹配器,日期匹配器,分块,上下文感知拼写检查,情感检测器,预训练模型以及根据以下目的非常高精度的训练模型学术同行评审的结果。 Spark NLP还包括用于命名实体识别的BERT嵌入的生产就绪型实现。 例如,与spaCy相比,它在NER上产生的错误要少得多,我们在本文的第二部分对此进行了测试。 另外,值得注意的是,Spark NLP包括提供完整Python API的功能,支持有关GPU,用户定义的深度学习网络,Spark和Hadoop的培训。

The library comes with a production-ready implementation of BERT embeddings and uses transfer learning for data extraction. Transfer learning is a highly-effective method of extracting data that can leverage even small amounts of data. As a result, there’s no need to collect large amounts of data to train SOTA models.

该库带有可直接用于BERT嵌入的生产环境的实现,并使用传输学习进行数据提取。 转移学习是一种提取数据的高效方法,可以利用少量数据。 结果,无需收集大量数据即可训练SOTA模型。

Also, John Snow labs Slack channel provides top tier support that is beneficial because developers and new learners tend to band together and create resources that every one of them can benefit from. You will get answers to your questions right from the developers with dedication. I have been there a few times, can attest that they are quick and accurate in their response. Additionally, anyone finding themselves stuck can quickly get help from people that have had similar problems through Stack Overflow or similar platforms.

另外,John Snow实验室的Slack频道提供了顶级支持,这是有益的,因为开发人员和新学习者倾向于联合起来并创建每个人都可以从中受益的资源。 您将全心全意地从开发人员那里得到问题的答案。 我去过几次,可以证明他们的React是快速而准确的。 此外,任何发现自己陷入困境的人都可以通过Stack Overflow或类似平台Swift从遇到类似问题的人那里获得帮助。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 要在2周内开始使用Spark NLP第一步是安装SparkSpark NLP。您可以从官方网站下载SparkSpark NLP的二进制文件,也可以使用Maven或SBT等构建工具安装它们。 安装完成后,您可以使用Spark NLP提供的各种预训练模型和管道来处理文本数据。您可以使用Spark NLP的API来加载这些模型和管道,并使用它们来进行文本分类、实体识别、情感分析等任务。 此外,您还可以使用Spark NLP提供的各种工具和组件来自定义和训练自己的模型和管道。这需要一些机器学习和自然语言处理的知识,但是Spark NLP提供了很多文档和示例来帮助您入门。 总之,要在2周内开始使用Spark NLP,您需要安装SparkSpark NLP,了解Spark NLP的API和预训练模型,以及学习如何自定义和训练模型和管道。 ### 回答2: Spark NLP是一个用于自然语言处理的开源框架,提供了一系列预处理、特征提取和模型训练的工具和算法。如果你想在两周内开始使用Spark NLP,需要掌握一些基本的知识和技能,包括以下几个方面。 1. 安装和配置Spark 首先,需要在本地或云服务器上安装和配置好Spark,包括Spark的环境变量、Java环境和内存调整等。这一步可以参考官网提供的文档和教程来完成。 2. 下载Spark NLP包 然后,在Spark环境下下载和配置Spark NLP包。可以从官网下载最新版本的Spark NLP,或者使用Maven等工具管理依赖关系。同样,需要配置好Spark NLP的环境变量和路径。 3. 准备数据和语料库 在开始处理自然语言数据之前,需要准备好待处理的数据和语料库。这可能包括一些标准的语言模型、词典、停用词列表、词性标注和实体识别等数据集。这些数据可以下载和整理好,放置在本地或云端的指定目录下。 4. 学习Spark NLP的API和功能 在准备好环境和数据集之后,开始学习Spark NLP的API和功能。首先需要了解Spark NLP提供的一些预处理和特征提取的函数和类,例如Tokenizer、Normalizer、Stemmer、StopWordsRemover、NGram、CountVectorizer等。然后可以进一步探索Spark NLP提供的实体识别、情感分析、文本分类、关键词提取等高级功能。 5. 运行和优化Spark NLP任务 最后,需要编写和运行Spark NLP的任务,并进行优化和调试。这可以包括设置合适的参数和超参数、选取合适的模型和算法、调节数据量和内存等。如果想进一步优化性能和扩展Spark NLP的功能,可以尝试使用分布式计算、GPU加速等技术。 总之,要在两周内开始使用Spark NLP,需要掌握一些基础的知识和技能,并不断进行实践和探索。如果您遇到任何问题或难点,可以参考官方文档和论坛,或者向社区和同行寻求帮助。 ### 回答3: spark-nlp是非常流行的自然语言处理开源库,它是在Apache Spark上构建的,它提供了许多有用的自然语言处理工具和功能。学会如何使用spark-nlp是非常有用的,因为它可以帮助您快速实现自然语言处理任务,例如文本分类、实体识别、情感分析等。在这篇文章中,我将分享一些如何在2周内学习和开始使用spark-nlp的技巧和建议,重点放在第一部分。 1. 熟悉Apache Spark和Scala 在学习spark-nlp之前,必须熟悉Apache Spark和Scala。虽然spark-nlp提供了许多高级功能和API,但最好还是先了解Spark和Scala的基础知识。这包括Spark的核心概念,如RDD、DataFrame和DataSet,以及Scala的基本语法和数据结构。通过学习这些基础知识,您可以更轻松地学习spark-nlp,并将它与其他Spark应用程序结合使用。 2. 安装Sparkspark-nlp 安装Sparkspark-nlp使用spark-nlp第一步。Spark的安装十分简单,我们可以去官网下载Spark,然后解压即可使用。 对于spark-nlp,我们可以在Maven中心库中获得最新的spark-nlp二进制文件。在pom.xml文件中加入以下依赖即可: ``` <dependency> <groupId>com.johnsnowlabs.nlp</groupId> <artifactId>spark-nlp_2.12</artifactId> <version>3.0.0</version> </dependency> ``` 3. 学习spark-nlp的核心概念和API 学习spark-nlp的核心概念和API是非常重要的,因为它是使用spark-nlp的关键。这包括学习如何读取和处理文本数据、特征工程、模型训练和评估以及如何应用自然语言处理模型等。我们可以通过阅读spark-nlp官方文档、使用API文档、示例代码和教程等方式学习这些知识。 4. 多看、多做、多问 学习每个技术都需要时间和实践。我们可以去许多社交网站和论坛(如Gitter、Stack Overflow)寻求更多帮助,也可以加入Sparkspark-nlp的社群,向其他开发人员提问并分享您的经验。此外,我们可以通过多看源码、多做实践来加深对spark-nlp的理解和掌握。 5. 利用第三方工具和资源 最后,我们可以使用第三方工具和资源来扩展您的spark-nlp学习。当我们遇到困难时,GitHub和Gitter是我们的好选择。如若通过Python API使用它,我们可以使用PySpark库和Python中的其他自然语言处理库,例如NLTK、spaCy、TextBlob等。 总之,学习如何使用spark-nlp需要一定的时间和努力,但通过遵循这些技巧和建议,您可以在2周内开始使用spark-nlp。除这些之外,不要忘记保持耐心和对知识的热情,并始终致力于不断提高自己的技能和能力,这样你才有可能在这个领域获得成功。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值