pytorch / text

Models, data loaders and abstractions for language processing, powered by PyTorch
https://pytorch.org/text
BSD 3-Clause "New" or "Revised" License
3.49k stars 815 forks source link

Implementing __contains__ for vocab.Vectors class #2140

Closed saeeddhqan closed 1 year ago

saeeddhqan commented 1 year ago

🚀 Feature

Isn't it better to implement __contains__ for Vectors class? In this way, one can easily find out whether a vocab is in the self.itos or not.

joecummings commented 1 year ago

Thanks for opening an issue @saeeddhqan! If you want to propose this feature, we can help with testing and approving.

saeeddhqan commented 1 year ago

I created the PR. Looking forward to hear from you!