-
Notifications
You must be signed in to change notification settings - Fork 463
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
How to identify the subunits in an encoded text #72
Comments
BPE always starts with a character-level segmentation so you start with {d i r e c t} and apply pairwise merge operations until you've reached the maximum number of merge operations (at training time), or until there is no more valid merge operation in your learned list (at test time). So I'm not sure why you're asking about the smallest subunits (this is always characters). Instead, maybe you should be interested in the largest subword units that are still in-vocabulary. If your segmentation produces "di@@ rect", then "di@@" and "rect" are both in-vocabulary subword units, but "direct" is out-of-vocabulary. |
Thank you for your response, you are right, it is more relevant to think about the largest subwords. I understand your explanation. I hope I don't bother you too much with another question. Just so I get my understanding right, if the final segmentation would be |
I'm not sure I get your question. The final segmentation is produced by a greedy algorithm that iteratively applies the most frequent pairwise merge operation that has been learned on the training set. If you reach the intermediate segmentation (di - re - c - t), and di - re and c - t are the most frequent subword pairs and merged by the algorithm next (instead of re - c), the final segmentation would be dire@@ ct. |
Thank you, your explanations helped me understanding how you program works! |
I understand that by removing the
@@
symbols I get back to the input text, but how can I identify the smallest subunits in the processed text?If for example I have
di@@ rect
, How can I figure out the smallest subunits, as I understand it, it could be {di
,rect
}, {d
,i
,rect
}, {d
,i
,re
,ct
} and so on, since I don'nt know which part ofdi
and which part ofrect
belongs to the subunit, and which part is unknown to the tokenizer.How do I know what part of a word which contains is part of the binary pair, and which part is the rest of the word?
I'm sorry, if I just got the overall concept wrong, but I can't figure this out.
The text was updated successfully, but these errors were encountered: