Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentence segmenter can not be loaded #149

Closed
yuhui-zh15 opened this issue Aug 12, 2019 · 3 comments
Closed

Sentence segmenter can not be loaded #149

yuhui-zh15 opened this issue Aug 12, 2019 · 3 comments

Comments

@yuhui-zh15
Copy link

Hello,

I ran the following commands to train the parser:

bash ./scripts/base_model.sh small base_model
bash ./scripts/parser.sh base_model parser

When I used the following commands to load the trained parser, the sentence segmenter does not work:

import spacy
nlp = spacy.load('parser/best')
x = nlp('Hello. Hello.')
print(len(list(x.sents)) # Output: 1, Expected: 2

However, when I followed the code and added the segmenter to the pipeline, the sentense segmenter still does not work:

import spacy
from scispacy.custom_sentence_segmenter import combined_rule_sentence_segmenter
nlp = spacy.load('parser/best')
nlp.add_pipe(combined_rule_sentence_segmenter, first=True)
x = nlp('Hello. Hello.')
print(len(list(x.sents)) # Output: 1, Expected: 2

What should I do to add the sentence segmenter into pipeline?

Thanks!

@yuhui-zh15 yuhui-zh15 changed the title Sentence segmenter can not work use own trained model Sentence segmenter can not be loaded Aug 12, 2019
@DeNeutoy
Copy link
Contributor

Does it not work at all, even for more normal sentences?

@yuhui-zh15
Copy link
Author

yuhui-zh15 commented Aug 13, 2019

Sorry, it is my fault. The issue was resolved after correctly setting the spacy. :)

@DeNeutoy
Copy link
Contributor

No problem, glad you fixed it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants