Vocabulary
Vocabulary()
Class that creates a Vocabulary object that is used to store references to Embeddings.
Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/vocabulary.py
24 25 26 27 28 29 30 31 |
|
add_to_vocab(token)
Adds token to vocabulary.
Returns:
-
–
Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/vocabulary.py
54 55 56 57 58 59 60 61 62 63 |
|
get_id(token)
Normalises token and checks if token in vocab.
Returns:
-
–
Either reference ID to given token or reference ID to #UNK# token.
Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/vocabulary.py
73 74 75 76 77 78 79 80 |
|
normalize(token, lower=LOWER, digit_0=DIGIT_0)
staticmethod
Normalises token.
Returns:
-
–
Normalised token
Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/vocabulary.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
size()
Checks size vocabulary.
Returns:
-
–
size vocabulary
Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/vocabulary.py
65 66 67 68 69 70 71 |
|