# Antonym Detection
## Paper revisions
- [x] change \cite into \citep or sth like that
- [x] na de open vraag moet het iets herschreven worden. er iis een verschijnsel in de literatuur. wij gaan kijken of en hoe dat gereflecteerd wordt in kranten. (iets met dat meer debat zowel voor toename als afname gebruik binary oppositions kan zorgen). onze hypothese is vooral de tweede helft van de zin na de vraag. (Alie)
- [x] extra lijn in Fig. 1 met enkel dictionary pairs (Ruben)
- [x] onderscheid maken in Fig. 3, 4 en 5 tussen true en false positives (bijv. dikgedrukt), zodat het een logische aanzet is naar de bespreking in 4.2 (Alie)
- [ ] Discussie in 4.2 iets meer laten aansluiten op eerdere figuren (Joris)
- [x] Punt van reviewr 1 over different types of antonyms kan verwerkt worden in Inleiding (zie tweede punt op deze to-do lijst)
- [x] en aan het begin van Section Related Work (Ruben) (heb ik (A) al gedaan)
- [x] In Section 3 het corpus iets uitgebreider introduceren (NRC in Nlse krantenlandschap) (Joris)
- [x] Vertalingen van paren toevoegen in lopende tekst (Joris)
- [x] en de rest in een appendix (Alie)
- [x] Meer info over finetuning BERT (Joris)
- [x] Iets meer toelichting geven over de vertrekdefinitie van antoniem - even kijken wat de meneer van de dikke dictionary erover zei. Kijken of selectiecriteria van Van Dale te achterhalen zijn (Alie)
- [x] A naar B interesting dingetje uitzoeken of het toegelicht kan worden in enkele zin (Alie)
- [x] Filter 10 herschrijven en uitzoeken (Ruben)
- [x] Iets zeggen over threshold (Joris)
- [x] tabelletje met paren met hoogste score (Joris)
- [x] uitleggen dat we geen flexibele tagger hebben qua tijd to unlock the superfull potential (Joris)
## Models
Learning rate: $2e-5$
Batch size: $16$
Early stopping: val accuracy, patience $3$
| Model | Train data | $F^1_{ant}$ | $F^1_{syn}$ | Accuracy |
| --------------------- | ----------------- | ----------- | ----------- | -------- |
| `bert-base-dutch-cased` | nl | 0.63 | 0.67 | 0.65 |
| `robbert-v2-dutch-base` | nl | 0.56 | 0.64 | 0.60 |
| `mdeberta-v3-base` | nl | 0.93 | 0.94 | 0.94 |
| `mdeberta-v3-base` | nl + fallows (en) | 0.86 | 0.88 | 0.87 |
| `xlm-roberta-base` | nl | 0.49 | 0.61 | 0.56 |
| `bert-base-multilingual-cased` | nl | 0.70 | 0.71 | 0.71 |
---
## Meeting Notes
---
### 4 July 2023
Script draait om woordparen te maken, maar er zijn heel veel mogelijkheden. Hoe kunnen we de mogelijkheden limiteren?
- op zinsniveau kijken naar combinaties, want dat maakt de kans op een daadwerkelijk antonym groter.
- zinsniveau parsen
- paragraaf niveau kan ook (new line)
Input voor classifier:
| woord 1 | woord 2 | artikel-id |
| -------- | -------- | -------- |
| laag | hoog | 123 |
eerste sample: 500 artikelen
---
### 27 June 2023
Het is goed nieuws dat er nog steeds een hoge accuracy is met `mdeberta-v3-base`
- we hebben getraind met mwb, en getest met van dale
- we gaan het nu nog beter trainen, op zowel mwb en van dale
We beginnen met het krantencorpus
- POS-taggen
- lemmatiseren
- woordparen maken op artikelniveau
Vier opties voor threshold antoniem
- probability antoniem
- classifier met 3 klassen
- word embeddings (fasttext)
- BERT embeddings
Ruben gaat pre-processing krantencorpus doen, Joris gaat modellen trainen, Alie gaat schrijven.
---
### 20 June 2023
We willen weten of de hoge accuracy van `mdeberta-v3-base` goed of slecht nieuws is.
- meer training materiaal om ook meer abstracte antonymen te detecteren
- synoniemen waarvoor we nog geen antonymen hebben in de Van Dale opzoeken en antonymen scrapen (Ruben)
- nieuwe test set
Mogelijke scenario's
- weer hoge accuracy: heel goed nieuws
- accuracy gaat omlaag: als het hoog genoeg is, nog steeds`mdeberta-v3-base`, anders `bert-base-multilingual-cased` met opgekrikte performance naar 0.75
Toepassing
- krantencorpus omzetten naar woordparen (per artikel/alinea/chunks/sliding window)
- zelfst. naamwoorden en bijv. naamwoorden
- komt er iets uit?
- frequentie van antonymenparen
- collocaties: zorgt toename woord 1 of 2 ook voor toename antoniemrelatie 1-2? PMI
- drie opties: collocaties, asymmetrisch, nog iets?
Contextualisering
- Levi-Strauss en Derrida over binaire opposities
---
### 13 June 2023
Stappenplan
1. Lijst van synoniemen en antoniemen opstellen met behulp van mijnwoordenboek.nl
2. Model trainen om een synoniem of antoniem te herkennen
1. classificeer elk mogelijk woordpaar op een pagina/in een artikel bestaande uit een zelfst. naamwoord of adjectief als S(ynoniem), A(ntonym) of (N)iks
2. bepaal voor elk zelfst. naamw. of adjectief op een bepaalde pagina/in een artikel dat een bepaalde cos. distance heeft tot een ander woord de S of A.
Modellen om te proberen:
- BERT
- word2vec
- fasttext - ingebouwde functie voor synoniemdetectie
Corpora:
- HAROLD
- kranten
- parlementaire debatten
---
## Literature (in order of relevance)
[Church et al., *Training on Lexical Resources* (2022)](https://aclanthology.org/2022.lrec-1.676.pdf)
- We propose using lexical resources (thesaurus, VAD) to fine-tune pretrained deep nets such as BERT and ERNIE. Then at inference time, these nets can be used to distinguish synonyms from antonyms, as well as VAD distances. The inference method can be applied to words as well as texts such as multiword expressions (MWEs), out of vocabulary words (OOVs), morphological variants and more.
---
[ Defining Antonymy: A Corpus-based Study of Opposites by Lexico-syntactic Patterns (2010)](https://www.ai.rug.nl/~anja/public/Lobanovaetal.pdf)
- Using small sets of adjectival seed antonym pairs, we automatically find patterns where these pairs co-occur in a large corpus of Dutch, and then use these patterns to extract new antonym pairs.
---
[Xie et al., *A mixture-of-experts model for antonym-synonym discrimination* (2021)](https://aclanthology.org/2021.acl-short.71.pdf)
- Discrimination between antonyms and synonyms is an important and challenging NLP task. Antonyms and synonyms often share the same or similar contexts and thus are hard to make a distinction. This paper proposes two underlying hypotheses and employs the mixture-of-experts framework as a solution. It works on the basis of a divide-and-conquer strategy, where a number of localized experts focus on their own domains (or subspaces) to learn their specialties, and a gating mechanism determines the space partitioning and the expert mixture. Experimental results have shown that our method achieves the state-of-the-art performance on the task.
---
[Nguyen et al., *Distinguishing Antonyms and Synonyms in a Pattern-based Neural Network* (2017)](https://aclanthology.org/E17-1008.pdf)
- Distinguishing between antonyms and synonyms is a key task to achieve high performance in NLP systems. While they are notoriously difficult to distinguish by distributional co-occurrence models, pattern-based methods have proven effective to differentiate between the relations. In this paper, we present a novel neural network model AntSynNET that exploits lexico-syntactic patterns from syntactic parse trees. In addition to the lexical and syntactic information, we successfully integrate the distance between the related words along the syntactic path as a new pattern feature. The results from classification experiments show that AntSynNET improves the performance over prior pattern-based methods.
---
[Nguyen et al., *Integrating Distributional Lexical Contrast into Word Embeddings for Antonym–Synonym Distinction* (2016)](https://arxiv.org/pdf/1605.07766.pdf)
- We propose a novel vector representation that integrates lexical contrast into distributional vectors and strengthens the most salient features for determining degrees of word similarity. The improved vectors significantly outperform standard models and distinguish antonyms from synonyms with an average precision of 0.66–0.76 across word classes (adjectives, nouns, verbs). Moreover, we integrate the lexical contrast vectors into the objective function of a skip-gram model. The novel embedding outperforms state-of-the-art models on predicting word similarities in SimLex- 999, and on distinguishing antonyms from synonyms.
---
[Learning to Negate Adjectives with Bilinear Models (2017)](https://aclanthology.org/E17-2012.pdf)
- We learn a mapping that negates adjectives by predicting an adjective’s antonym in an arbitrary word embedding model. We show that both linear models and neural networks improve on this task when they have access to a vector representing the semantic domain of the input word, e.g. a centroid of temperature words when predicting the antonym of ‘cold’. We intrduce a continuous class-conditional bilinear neural network which is able to negate adjectives with high precision.
---
[Word Embedding-based Antonym Detection using Thesauri and Distributional Information (2015)](https://aclanthology.org/N15-1100.pdf)
- This paper proposes a novel approach to train word embeddings to capture antonyms. Word embeddings have shown to capture synonyms and analogies. Such word embeddings, however, cannot capture antonyms since they depend on the distributional hypothesis. Our approach utilizes supervised synonym and antonym information from thesauri, as well as distributional information from large-scale unlabelled text data. The evaluation results on the GRE antonym question task show that our model outperforms the state-of-the-art sys- tems and it can answer the antonym questions in the F-score of 89%.
---
[Computing Lexical Contrast (2013)](https://direct.mit.edu/coli/article/39/3/555/1436/Computing-Lexical-Contrast)
- We propose an automatic method to identify contrasting word pairs that is based on the hypothesis that if a pair of words, A and B, are contrasting, then there is a pair of opposites, C and D, such that A and C are strongly related and B and D are strongly related. (For example, there exists the pair of opposites hot and cold such that tropical is related to hot, and freezing is related to cold.) We will call this the contrast hypothesis.
---
[Revisiting Word Embedding for Contrasting Meaning (2015)](https://aclanthology.org/P15-1011.pdf)
---
[Paper met code](https://github.com/ec2604/Antonym-Detection/tree/master)
---
https://annals-csis.org/Volume_30/drp/pdf/37.pdf
---
https://github.com/i-samenko/Triplet-net/
---