t_res.utils.REL.mulrel_ranker
module
- class t_res.utils.REL.mulrel_ranker.PreRank(config, embeddings=None)
PreRank class is used for preranking entities for a given mention by multiplying entity vectors with word vectors.
Note
Credit:
This class and its methods are taken (minimally adapted when necessary) from the REL: Radboud Entity Linker Github repository: Copyright (c) 2020 Johannes Michael van Hulst. See the permission notice.
Reference: @inproceedings{vanHulst:2020:REL, author = {van Hulst, Johannes M. and Hasibi, Faegheh and Dercksen, Koen and Balog, Krisztian and de Vries, Arjen P.}, title = {REL: An Entity Linker Standing on the Shoulders of Giants}, booktitle = {Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval}, series = {SIGIR '20}, year = {2020}, publisher = {ACM} }
- forward(token_ids, token_offsets, entity_ids, embeddings)
Multiplies local context words with entity vectors for a given mention.
Returns: entity scores.
- class t_res.utils.REL.mulrel_ranker.MulRelRanker(config, device)
The MulRelRanker class implements a neural network model for entity disambiguation.
Note
Credit:
This class and its methods are taken (minimally adapted when necessary) from the REL: Radboud Entity Linker Github repository: Copyright (c) 2020 Johannes Michael van Hulst. See the permission notice. This is based on the
mulrel-nel
approach developed by Le and Titov (2018), whose original code is available in the mulrel-nel: Multi-relational Named Entity Linking Github repository, and on Ganea and Hofmann (2017).References: @inproceedings{vanHulst:2020:REL, author = {van Hulst, Johannes M. and Hasibi, Faegheh and Dercksen, Koen and Balog, Krisztian and de Vries, Arjen P.}, title = {REL: An Entity Linker Standing on the Shoulders of Giants}, booktitle = {Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval}, series = {SIGIR '20}, year = {2020}, publisher = {ACM} } @inproceedings{ganea2017deep, title={Deep Joint Entity Disambiguation with Local Neural Attention}, author={Ganea, Octavian-Eugen and Hofmann, Thomas}, booktitle={Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing}, pages={2619--2629}, year={2017} } @inproceedings{le2018improving, title={Improving Entity Linking by Modeling Latent Relations between Mentions}, author={Le, Phong and Titov, Ivan}, booktitle={Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)}, pages={1595--1604}, year={2018} }
- forward(token_ids, tok_mask, entity_ids, entity_mask, p_e_m, embeddings, gold=None)
Responsible for the forward pass of the entity disambiguation model and produces a ranking of candidates for a given set of mentions:
ctx_layer refers to function f. See Figure 3 in Le and Titov (2018).
ent_scores refers to function q.
score_combine refers to function g.
- Returns:
Ranking of entities per mention.
- loss(scores, true_pos, lamb=1e-07)
Computes given ranking loss (Equation 7) and adds a regularization term.
Returns: loss of given batch.
- regularize(max_norm=1)
Regularizes model parameters.
- Returns:
None