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

Helper function for Vocab object #1254

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TuckerBMorgan
Copy link

I found it hard to understand how to preform a "full loop" of Token -> index -> Token, I think the intended manner is to just access the itos variable of the vocab. This feels to me to be inconsistent with how the API is setup to get a index for a token, which uses the getitem overload. While this is not a perfect solution, I do think it will help other new users to have a guiding hand about how to get at this information.

@facebook-github-bot
Copy link
Contributor

Hi @TuckerBMorgan!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@codecov
Copy link

codecov bot commented Mar 14, 2021

Codecov Report

Merging #1254 (b455c91) into master (735d5e7) will decrease coverage by 0.08%.
The diff coverage is 20.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1254      +/-   ##
==========================================
- Coverage   80.76%   80.68%   -0.09%     
==========================================
  Files          67       67              
  Lines        3624     3629       +5     
==========================================
+ Hits         2927     2928       +1     
- Misses        697      701       +4     
Impacted Files Coverage Δ
torchtext/vocab.py 88.81% <20.00%> (-1.19%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 735d5e7...b455c91. Read the comment docs.

@zhangguanheng66
Copy link
Contributor

You can use itos attribute in the vocab object. Just FYI, this vocab will be retired and replaced with torchtext.experimental.vocab. cc @parmeet

@joecummings
Copy link
Contributor

Covered by current functionality, but might be a good idea to include in the documentation how to get a token.

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

Successfully merging this pull request may close these issues.

4 participants