Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

SpacyEncoder: TypeError: __init__() got an unexpected keyword argument 'language' #105

Open
TheophileBlard opened this issue Jul 15, 2020 · 2 comments

Comments

@TheophileBlard
Copy link

On v0.5.0, this code fails:

from torchnlp.encoders.text import SpacyEncoder
encoder = SpacyEncoder([], language="fr")

with:

TypeError                                 Traceback (most recent call last)
<ipython-input-30-5ed4fb61bf30> in <module>
      1 from torchnlp.encoders.text import SpacyEncoder
      2 
----> 3 encoder = SpacyEncoder(dataset["review"], language="fr")
      4 #encoded_data = [encoder.encode(example) for example in loaded_data]

~/.local/share/virtualenvs/fraug-uvnmwJNa/lib/python3.8/site-packages/torchnlp/encoders/text/spacy_encoder.py in __init__(self, *args, **kwargs)
     61                 (language, supported_languages))
     62 
---> 63         super().__init__(*args, tokenize=partial(_tokenize, tokenizer=self.spacy), **kwargs)
     64 
     65     def batch_encode(self, sequences):

~/.local/share/virtualenvs/fraug-uvnmwJNa/lib/python3.8/site-packages/torchnlp/encoders/text/static_tokenizer_encoder.py in __init__(self, sample, min_occurrences, append_eos, tokenize, detokenize, reserved_tokens, eos_index, unknown_index, padding_index, **kwargs)
     64                  padding_index=DEFAULT_PADDING_INDEX,
     65                  **kwargs):
---> 66         super().__init__(**kwargs)
     67 
     68         if not isinstance(sample, Iterable):

TypeError: __init__() got an unexpected keyword argument 'language'
@enaserianhanzaei
Copy link

@TheophileBlard faced the same problem, have you by any chance fixed it?

@enaserianhanzaei
Copy link

@PetrochukM faced the same issue, any idea what is the reason?

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

No branches or pull requests

2 participants