explosion / explosion/spacy-stanza

Takes too long to parse doc results

Open
#18 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
748
Forks
63
PR merge metrics
No merged PRs in 30d

Description

Hello,
It takes too long to parse the doc object, i.e to iterate over sentence and tokens in them. Is that expected ?

```
snlp = stanfordnlp.Pipeline(processors='tokenize,pos', models_dir=model_dir)
nlp = StanfordNLPLanguage(snlp)

for line in lines:
doc = nlp.pipe([line])
```
The above code takes few milliseconds (apart from initialisation) to run over 500 sentences,

```
snlp = stanfordnlp.Pipeline(processors='tokenize,pos', models_dir=model_dir)
nlp = StanfordNLPLanguage(snlp)

for line in lines:
doc = nlp.pipe([line])
token_details = []

for sents in doc:
for tok in sents:
token_details.append([tok.text, tok.lemma_, tok.pos_])

```
while this takes almost a minute(apart from initialisation) to run over 500 sentences

P.S : Have put nlp.pipe() inside a for loop intentionally to get all tokens for one sentence even though it gets segmented.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.