Utils
flatten_list_of_lists(list_of_lists)
making inputs to torch.nn.EmbeddingBag
Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/utils.py
163 164 165 166 167 168 169 170 |
|
is_important_word(s)
cached
an important word is not a stopword, a number, or len == 1
Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/utils.py
185 186 187 188 189 190 191 192 193 194 195 196 |
|
preprocess_mention(m, wiki_db)
Responsible for preprocessing a mention and making sure we find a set of matching candidates in our database.
Returns:
-
–
mention
Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/utils.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
process_results(mentions_dataset, predictions, processed, include_offset=False)
Function that can be used to process the End-to-End results.
Returns:
-
–
dictionary with results and document as key.
Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/utils.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
split_in_words(inputstr)
This regexp also splits 'AL-NAHAR', which should be a single word into 'AL' and 'NAHAR', resulting in the inability to find a match.
Same with U.S.
Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/utils.py
133 134 135 136 137 138 139 140 141 142 143 |
|
split_in_words_mention(inputstr)
This regexp also splits 'AL-NAHAR', which should be a single word into 'AL' and 'NAHAR', resulting in the inability to find a match.
Same with U.S.
Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/utils.py
146 147 148 149 150 151 152 153 |
|