丹麦柠檬汁
lemm的Python项目详细描述
勒米
莱米是丹麦和瑞典的一种柠檬汁。它随时可以使用。这个 丹麦模型是在dansk sprogn_vn(dsn)单词表(“fuldformliste”)和 Danish Universal Dependencies。 瑞典模型是在SALDO's morphology数据集和瑞典 Universal Dependencies (Talbanken)。莱米也 支持在自己的数据集上进行培训。
lemmy中包含的模型是根据各自的通用依赖项dev 数据集。丹麦模式得分为99%,瑞典模式得分为97%。 所有报告的分数都是在向Lemmy提供POS标签时获得的。
可以将lemmy用作spacy扩展,更具体地说,是spacy管道组件。 这是强烈推荐的,并且使得从spacy令牌很容易访问引理。 lemmy利用pos标签预测引理。当连接到Spacy管道时, Lemmy有使用Spacy内置pos标记器的好处。
狐猴也可以通过使用没有空间,作为一个独立的狐猴。那样的话,你会 必须提供POS标签。或者,你可以使用不带POS标签的Lemmy 最有可能的是准确性会受到影响。目前,只有丹麦的莱米模型 没有POS标签的模型。也就是说,如果你想在瑞典语中使用lemmy 没有pos标签的文本,你必须训练自己的lemmy模型。
莱米深受CST Lemmatizer for Danish的启发。
安装
pip install lemmy
不带POS标签的基本用法
importlemmy# Create an instance of the standalone lemmatizer.lemmatizer=lemmy.load("da")# Find lemma for the word 'akvariernes'. First argument is an empty POS tag.lemmatizer.lemmatize("","akvariernes")
POS标签的基本用法
importlemmy# Create an instance of the standalone lemmatizer.# Replace 'da' with 'sv' for the Swedish lemmatizer.lemmatizer=lemmy.load("da")# Find lemma for the word 'akvariernes'. First argument is the user-provided POS tag.lemmatizer.lemmatize("NOUN","akvariernes")
使用Spacy型号
importda_custom_modelasda# replace da_custom_model with name of your spaCy modelimportlemmy.pipenlp=da.load()# Create an instance of Lemmy's pipeline component for spaCy.# Replace 'da' with 'sv' for the Swedish lemmatizer.pipe=lemmy.pipe.load('da')# Add the component to the spaCy pipeline.nlp.add_pipe(pipe,after='tagger')# Lemmas can now be accessed using the `._.lemmas` attribute on the tokens.nlp("akvariernes")[0]._.lemmas
培训
notebooks
文件夹包含演示如何使用
莱米。