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

using setRequiredAnnotatorTypes() with many of the annotators throws error. #58

Closed
clayms opened this issue Dec 10, 2017 · 4 comments
Closed
Assignees
Labels

Comments

@clayms
Copy link

clayms commented Dec 10, 2017

Many of the annotators in annotator.py list requiredAnnotatorTypes() as a parameter when using either <annotatorName>().explainParams(), or dir(<annotatorName>).

However, when using <annotatorName>().setRequiredAnnotatorTypes on most of these annotators, the following error is thrown.

Py4JJavaError: An error occurred while calling o830.getParam.
: java.util.NoSuchElementException: Param requiredAnnotatorTypes does not exist.

The only place where the requiredAnnotatorTypes parameter is shown is in the class AnnotatorProperties of annotator.py starting on line 29.

@aleksei-ai aleksei-ai added the bug label Dec 14, 2017
@aleksei-ai
Copy link
Contributor

@clayms What annotator you use?
I tried with different annotators and it works for me:
print(PerceptronApproach().explainParams())
print(EntityExtractor().explainParams())
print(ViveknSentimentApproach().explainParams())
print(NorvigSweetingApproach().explainParams())
print(NerCrfApproach().explainParams())

@clayms
Copy link
Author

clayms commented Dec 17, 2017

Hi @aleksei-ai I have tried it with RegexTokenizer, Normalizer, Stemmer, Lemmatizer, RegexMatcher, EntityExtractor, DateMatcher, SentenceDetectorModel, PerceptronApproach, SentimentDetectorModel, NERRegexApproach, and NorvigSweetingApproach.

the .explainParams() method works on all of them, but when I try and use the .setRequiredAnnotatorTypes when building the annotator to use in a pipeline, that is when the error I referenced above is thrown.

Thanks,

@saif-ellafi
Copy link
Contributor

saif-ellafi commented Dec 18, 2017

Hi, setRequiredAnnotatorTypes() is a deprecated method and should not be used. This function in python code is just a mistake of a lingering code. Shall be deleted. Thank you @clayms

Required annotators are a fixed property of annotators, and cannot be modified per annotators inherent functionality.

@saif-ellafi
Copy link
Contributor

Merged Fix

@aleksei-ai aleksei-ai self-assigned this Dec 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants