{'fraction_non_alphanumeric': 0.02616687554593445, 'fraction_numerical': 0.011925107287987543, 'mean_word_length': 5.082698082698083, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Binary and Multitask Classification Model for Dutch Anaphora Resolution: Die/Dat Prediction

The correct use of Dutch pronouns 'die' and 'dat' is a stumbling block for both native and non-native speakers of Dutch due to the multiplicity of syntactic functions and the dependency on the antecedent's gender and number. Drawing on previous research conducted on neural context-dependent dt-mistake correction models (Heyman et al. 2018), this study constructs the first neural network model for Dutch demonstrative and relative pronoun resolution that specifically focuses on the correction and part-of-speech prediction of these two pronouns. Two separate datasets are built with sentences obtained from, respectively, the Dutch Europarl corpus (Koehn 2015) - which contains the proceedings of the European Parliament from 1996 to the present - and the SoNaR corpus (Oostdijk et al. 2013) - which contains Dutch texts from a variety of domains such as newspapers, blogs and legal texts. Firstly, a binary classification model solely predicts the correct 'die' or 'dat'. The classifier with a bidirectional long short-term memory architecture achieves 84.56% accuracy. Secondly, a multitask classification model simultaneously predicts the correct 'die' or 'dat' and its part-of-speech tag. The model containing a combination of a sentence and context encoder with both a bidirectional long short-term memory architecture results in 88.63% accuracy for die/dat prediction and 87.73% accuracy for part-of-speech prediction. More evenly-balanced data, larger word embeddings, an extra bidirectional long short-term memory layer and integrated part-of-speech knowledge positively affects die/dat prediction performance, while a context encoder architecture raises part-of-speech prediction performance. This study shows promising results and can serve as a starting point for future research on machine learning models for Dutch anaphora resolution.


Introduction
Following previous research on automatic detection and correction of dt-mistakes in Dutch (Heyman et al. 2018), this paper investigates another stumbling block for both native and non-native speakers of Dutch: the correct use of die and dat. The multiplicity of syntactic functions and the dependency on the antecedent's gender and number make this a challenging task for both human and computer. The grammar concerning die and dat is threefold. Firstly, they can be used as dependent or independent demonstrative pronouns (aanwijzend voornaamwoord), with the first replacing the article before the noun it modifies and the latter being a noun phrase that refers to a preceding/following noun phrase or sentence. The choice between die and dat depends on the gender and number of the antecedent: dat refers to neuter, singular nouns and sentences, while die refers to masculine, singular nouns and plural nouns independent of their gender. Secondly, die and dat can be used as relative pronouns introducing relative clauses (betrekkelijk voornaamwoord), which provide additional information about the directly preceding antecedent it modifies. Similar rules as for demonstrative pronouns apply: masculine, singular nouns and plural nouns are followed by relative pronoun die, neuter singular nouns by dat. Lastly, dat can be used as a subordinating conjunction (onderschikkend voegwoord) introducing a subordinating clause. A brief overview of the grammar is given in Table 1 The aim is to develop (1) a binary classification model that automatically detects, predicts and corrects die and dat instances in texts and (2) a multitask classification model that jointly predicts the correct die/dat instance and its syntactic function. Whereas research on neural-based, machine learning approaches for Dutch demonstrative and relative pronoun resolution -especially for die and dat -is to our knowledge non-existing, this paper is a starting point for further research on machine learning applications concerning Dutch subordinating conjunctions, demonstrative pronouns and relative pronouns.

Related Work
The incentive for this paper is the detection and correction system for dt-mistakes in Dutch (Heyman et al. 2018). For that task, a system with a context encoder -a bidirectional LSTM with attention mechanism -and verb encoder -of which the outputs are then fed to a feedforward neural network -has been developed to predict different verb suffixes. As mentioned above, this paper explores the possibility of constructing a neural network system for correcting Dutch demonstrative and relative pronouns die and dat. The task is also called pronoun resolution or anaphora resolution. Anaphora resolution and pronoun prediction has been major research subjects in machine translation research. Novk et al. (2015), for example, studied the effect of multiple English coreference resolvers on the pronoun translation in English-Dutch machine translation system with deep transfer has been investigated. Niton, Morawiecki and Ogrodnizuk (2018) developed a fully connected network with three layers in combination with a sieve-based architecture for Polish coreference resolution (Nitoń et al. 2018). Not only in machine translation, but also in general natural language processing much research has been conducted on machine learning approaches towards coreference resolution (Ng and Cardie 2002, Culotta et al. 2007, Zhekova and Kübler 2010 and pronoun resolution (Strube andMüller 2003, Zhao andNg 2007). However, little to no research has been conducted specifically on die/dat correction.

Datasets
The datasets used for training, validation and testing contain sentences extracted from the Europarl corpus (Koehn 2005) and SoNaR corpus (Oostdijk et al. 2013). The Europarl corpus is an open-source parallel corpus containing proceedings of the European Parliament. The Dutch section consists of 2,333,816 sentences and 53,487,257 words. The SoNaR corpus comprises two corpora: SONAR500 and SONAR1. The SONAR500 corpus consists of more than 500 million words obtained from different domains. Examples of text types are newsletters, newspaper articles, legal texts, subtitles and blog posts. All texts except texts from social media have been automatically tokenized, POS tagged and lemmatized. It contains significantly more data and more varied data than the Europarl corpus. Due to the high amount of data in the corpus, only three subparts are used:

Preprocessing
The sentences in the Europarl corpus are tokenized and parsed using the Dutch version of TreeTagger (Schmid 1994). Only sentences which contain at least one die or dat are extracted from the corpora. Subsequently, each single occurrence of die and dat is detected and replaced by a unique token ('PREDICT'). When there are multiple occurrences in one sentence, only one occurrence is replaced at a time. Consequently, a sentence can appear multiple times in the training and test dataset with the unique token for die and dat at a different place in the sentence. Each sentence is paired with its automatically assigned ground truth label for die and dat. The resulting datasets consist of 103,871 (Europarl) and 1,269,091 (SoNaR) sentences. The Europarl dataset, on the one hand, contains 70,057 dat-labeled and 33,814 die-labeled sentences. The SoNaR dataset, on the other hand, has more than ten times the number of labeled sentences with 736,987 dat-labeled and 532,104 die-labeled. Considering the imbalance in both datasets, it may be argued that dat occurs more frequently than die due to its syntactic function as subordinating conjunction and not to its use as demonstrative pronoun whereas it can only refer to singular, neuter nouns. As for the multitask classification model, the POS tags for die and dat present in the SoNaR corpus are extracted and stored as ground truth labels: 407,848 subordinating conjunction, 387,292 relative pronoun and 473,951 demonstrative pronoun. From a brief qualitative assessment on the POS tags for die and dat in both corpora, the POS tags in the SoNaR corpus appear to be more reliable than the POS tags generated by TreeTagger in the Europarl corpus. Therefore, only the SoNaR dataset is used for the multitask classification. An overview of the datasets after preprocessing is given in Table 2.

Model Architecture
For the binary classification model that predicts the correct die or dat for each sentence, a Bidirectional Long-Short Term Memory (BiLSTM) neural network is deployed. Whereas the antecedent can be rather distant from the demonstrative pronoun due to adjectives and sentence boundaries, an LSTM architecture is chosen over a regular Recurrent Neural Network as the latter does not cope well with learning non-trivial long-distance dependencies (Chiu and Nichols 2016). Furthermore, a bidirectional LSTM is chosen over a single left-to-right LSTM, whereas the antecedent can be either before or after the die or dat. The architecture of the binary classification model is provided in Fig.  1. The input sentence is first sent through an embedding layer where each token is transformed to a 100-dimensional word embedding which has been initially trained on the dataset of sentences containing at least one die or dat using the Word2Vec Skip-gram model (Mikolov et al. 2013). The This means that at time t for input x, represented by its word embedding E(x), the bidirectional LSTM outputs the following: Next, the concatenated output is sent through a maxpooling layer, linear layer and, eventually, a softmax layer that generates a probability distribution over the two classes. In order to prevent the model from overfitting and co-adapting too much, dropout regularization is implemented in the embedding layer and the linear layer. In both layers, dropout is set to p = 0.5 which randomly zeroes out nodes in the layer using samples from a Bernoulli distribution.

Experimental Set-Up
Each dataset is randomly divided into a training (70%), validation (15%) and test set (15%). The data is fed to the model in batches of 128 samples and reshuffled at every epoch. The objective function that is minimized is Binary Cross-Entropy: where y i is the ground truth label (0 for dat and 1 for die) and p(ŷ i ) is the probability of the predicted label for all N input sentences of the train set. The weights are optimized using Stochastic   (1), the Europarl dataset containing windowed sentences within sentence boundaries (2), the SoNaR dataset containing windowed sentences within sentence boundaries (3) and the SoNaR dataset containing windowed sentences exceeding sentence boundaries (4).
Gradient Descent with learning rate = 0.01 and momentum = 0.9. The data is fed to the model in 24 epochs.

Results
An overview of the performance results is given in Table 3. We compare model performance when trained and tested on the two corpora individually and experiment with different settings of the two corpora in order to investigate the effect of dataset changes on model performance. There are three settings: full in which the datasets contain full sentences, windowed in which sentences are windowed around the unique prediction token without exceeding sentence boundaries (max. five tokens before and after the token, including token), and windowed no boundaries in which the windows can exceed sentence boundaries. When limiting the input sentences to windowed sentences in the Europarl corpus (2), model performance increases significantly on all metrics, especially for die prediction performance. The difference in model performance when trained and tested on the Europarl (2) and SoNaR (3) windowed datasets is particularly noticeable in the precision, recall and F1 scores. Model performance for dat prediction is better for the Europarl dataset than for the SoNaR dataset, while model performance for die prediction is notably better for the SoNaR dataset than for the Europarl dataset. Lastly, a change in windowing seems to have a positive impact on the overall model performance: the model trained and tested on the SoNaR dataset with windows exceeding sentence boundaries (3) outperforms the model trained and tested on the SoNaR dataset with windows within sentence boundaries (4) on every metric.

Model Architecture
The second model performs two prediction tasks. The first prediction task remains the binary classification of die and dat. The second prediction task concerns the prediction of three parts-ofspeech (POS) or word classes, namely subordinating conjunction, relative pronoun and demonstrative pronoun. An overview of the model architectures is given in Fig. 2  concatenates the outputs at time t into a 64-dimensional vector and sends it through a maxpooling layer. Until this point, the two tasks share the same parameters. The model then splits into two separate linear layers. The left linear layer transforms the 64-dimensional vector to a twodimensional vector on which the softmax is computed. That softmax layer outputs the probability distribution over the dat and die labels. The right linear layer transforms the 64-dimensional vector to a three-dimensional vector on which a softmax function is applied. The softmax layer outputs the probability distribution over the subordinating conjunction, relative pronoun and demonstrative pronoun labels. The second multitask classification model takes the immediate context around the 'PREDICT' token (two tokens before and one token after) as additional input. Both the windowed sentence and context are first transformed into their word embedding representations. They are then sent through a sentence encoder and context encoder, respectively. The sentence encoder has the same architecture as the second and third layer of the BiLSTM model, namely a two-layer BiLSTM and a maxpooling layer. For the context encoder, we experiment with two different architectures: a feedforward neural network and a one-layer BiLSTM with dropout = 0.2 with a maxpooling layer on top. Both sentence and context encoder output a 64-dimensional vector which are, consequently, concatenated to a 128-dimensional vector. As in the BiLSTM model, the resulting vector is sent through two separate linear layers to output probability distributions for both the die/dat and POS prediction task.

Experimental Set-up
As discussed in Section 4, the POS ground truth labels in SoNaR-based datasets are more reliable than the POS labels in the Europarl-based datasets that are generated by TreeTagger. Consequently, only the SoNaR dataset is used for training and testing. The dataset is randomly divided into a training (70%), validation (15%) and test (15%) set. The data is fed into the model in batches of 516 samples and the data is reshuffled at every epoch.
where C is the number of classes (in this case three) y i,c is the binary indicator (1 or 0) if class label c is the correct predicted classification for input sentence i or not, and p is the probability of sentence i having class label c. The weights are optimized using Adam optimization with learning rate being equal to 0.0001. The data is fed to the model in 35 epochs.

Results
An overview of the performance results for die/dat prediction is given in Table 4. The same dataset settings as for the binary classification model are used: full in which the datasets contain full sentences, windowed in which sentences are windowed around the unique prediction token without exceeding sentence boundaries (max. five tokens before and after the token, including token), and windowed no boundaries in which the windows can exceed sentence boundaries. As mentioned in section 4, we only use the SoNaR dataset. The multitask classification models generally perform better with the windowed and windowed no boundaries dataset setting for die/dat prediction. Concerning the model architectures, it can be concluded that altering the model architecture has no large impact on model performance for die/dat prediction. However, altering the model architecture from an architecture with merely a sentence encoder to an architecture with both a sentence and a context encoder does have a more significant positive impact on model performance for POS prediction ( Table 5). For that prediction task, the multitask classification model with a BiLSTM context encoder trained and tested on windowed SoNaR sentences reaches best performance results on almost all evaluation metrics.

Discussion
In Section 5, a first classification model is computed to predict die and dat labels. The binary classification model (Model 1) consists of an embedding layer, a bidirectional LSTM, a maxpooling layer and a linear layer. The softmax is taken over the output of the last layer and provides a probability distribution over die and dat prediction labels. The sentences receive the prediction label with the highest probability. It is trained, validated and tested four times using four different database settings. From an analysis of the performance metric results, several conclusions can be drawn. Firstly, in all cases, the model appears to predict the dat label more precisely than the die label. This may be caused by the higher number of dat than die instances in training, validation and test datasets extracted from the Europarl and SoNaR corpus. Secondly, when the dataset is more balanced, as in the SoNaR corpus, the difference in performance between die and dat labels decreases as expected. Thirdly, die/dat prediction performance increases when the window over the sentences is not limited to sentence boundaries (SoNaR windowed, no boundaries). A probable reason for that higher performance is that the model is able to detect antecedents in the preceding or following sentence, while it is not able to do so when it is trained and tested on boundary-constraint windowed sentences (SoNaR windowed ). Lastly, it appears that performance of the model drops significantly when the binary classification model is trained and tested on full sentences (Europarl full ). In conclusion, the binary classification model performs best when it is trained on the larger, more evenly balanced SoNaR corpus that consists of windowed sentences that are not limited to sentence boundaries. A clear performance overview of the best performing binary classification and multitask classification models for die/dat prediction can be found in Table 6. In Section 6, three multitask classification models are constructed to jointly execute two prediction tasks: die/dat prediction and POS prediction. The BiLSTM multitask classification model (Model 2) consists of an embedding layer, two consecutive BiLSTMs and a maxpooling layer. The output of the maxpooling layer is used as input to two separate linear layers followed by a softmax layer. The two softmax layers yield a probability distribution for die/dat and POS labels. The model trained and tested on windowed SoNaR sentences that exceed sentence boundaries performs better than the model on boundary-constraint windowed sentences and full sentences. The best performing BiLSTM multitask classification model (Model 2) outperforms the best binary classification model (Model 1) on every evaluation metric for die/dat prediction. This could arguably be due to the  increased batch size, the doubled embedding dimension, the extra bidirectional LSTM layer, the influence of the second prediction task and/or the split in sentence and context encoder. Firstly, we test the influence of the increased batch size. For this, we retrain the multitask classification model and feed the data in batches of 128 (used for binary classifier training) instead of 512 samples. Table 7 consistently shows that there is little consistent difference in performance when batch size is 512 or 128. Therefore, it can be suggested that an increased batch size has no directly positive influence on model performance. Secondly, we retrain the multitask classification model and let the embedding layer transform the input data to 100-dimensional word embeddings instead of 200dimensional word embeddings. From the results displayed in Table 7, it appears that an increase in word embedding dimension does indeed cause a slight increase in model performance. Thirdly, the multitask model contains two BiLSTM layers opposed to the binary model that has only one layer. Table 8 shows the influence of the number of layers on the performance of the binary classification model. When the binary classification model is retrained with an additional BiLSTM layer, all the evaluation metrics rise with approximately 2%. However, when the binary classification model has three BiLSTM layers, model performance drops significantly. It appears that the doubled number of layers is indeed one of the reasons why the multitask classification models perform better than the binary classification model. However, not every rise in number of layers necessarily influences a model's performance in a positive manner. Concerning the influence of the POS prediction task on die/dat prediction performance, a comparison between a two-layer BiLSTM binary classification model (Model 1) and the two-layer BiLSTM multitask classification model (Model 2) is made and displayed in Table 9. It seems that the integration of POS knowledge positively influences die/dat prediction performance, as all evaluation metrics have increased. When examining the influence of a context encoder on die/dat prediction performance, the evaluation metrics of Model 2, 3 and 4 are compared. The results of the three models are fairly similar which leads to the conclusion that the addition of a context encoder has little to no further influence on die/dat prediction performance. Moreover, the encoder architecture does not cause a considerable difference in die/dat prediction performance between the model with a feedforward context encoder (Model 3) and the model with a BiLSTM context encoder (Model 4). It can thus be suggested that a model does not necessarily profit from a different architecture and that an extra focus on immediate context is not additionally advantageous for the die/dat prediction task. Contrary to the little to no impact it has on die/dat prediction performance, the context encoder -especially the BiLSTM context encoder -does have a direct positive impact on POS prediction performance. The difference in POS prediction performance between the three multitask prediction models can be found in Table 10. The model with the BiLSTM context encoder (Model 4) outperforms the other two multitask classification models on every evaluation metric. Considering its highest POS prediction performance and high die/dat prediction performance, it can be concluded

Conclusion and Future Work
Deciding which pronoun to use in various contexts can be a complicated task. The correct use of die and dat as Dutch pronouns entails knowing the linguistic class of the antecedent and -if the antecedent is a noun -its grammatical gender and number. We experimented with neural network models to examine whether die and dat instances in sentences can be computationally predicted and, if necessary, corrected. Our binary classification model reaches a promising 84.56 % accuracy. In addition, we extended the model to a multitask model which apart from the die and dat prediction also predicts their POS (demonstrative pronoun, relative pronoun and subordinating conjunction). By increasing the word embedding dimension, doubling the number of bidirectional LSTM layers and integrating POS knowledge in the model, the multitask classification models raise die/dat prediction performance by approximately 4 %. Concerning POS prediction performance, the multitask classification model consisting of a sentence and context encoder performs best on all evaluation metrics and reaches 87.78 % accuracy. There are ample opportunities to further analyze, enhance and/or extend the die/dat prediction model. A qualitative study of the learned model weights, for example, could provide more insight in the prediction mechanism of the models. We already obtain excellent results with a simple neural architecture comprising relatively few parameters. We believe that more complex architectures such as a transformer architecture (Vaswani et al. 2017) with multihead attention will improve results. It might also be interesting to look at the possibility of integrating a language model such as BERT (Devlin et al. 2018) in the classification model (e.g., as pretrained embeddings). Moreover, the binary classification task could be extended to a multiclass classification task to predict not only die and dat labels, but also respectively equivalent deze and dit labels. The difference between die/dat and deze/dat, however, entails a difference in temporal and spatial information: while die/dat indicates a physically distant or earlier mentioned antecedent, deze/dit implies that the antecedent is physically near or later mentioned in the text. Moreover, die/dat and deze/dit are preferably used for anaphoric and cataphoric reference, respectively. The difference in reference (examples 1 and 2) and spatial understanding (example 4) between dat/dit and die/deze is demonstrated below. 4. Lees eerst deze boeken, dan die andere. ("First, read these books, than those other.") (Taaltelefoon 2020) Dat in example 1 indicates an anaphoric reference to the previous sentence. The same message is conveyed in example 2, but the sentence is referred to cataphorically using dit. Example 3 is very similar to example 2 in terms of sequence in which the information is provided. However, dat and dit differ in POS: dit is an independent demonstrative pronoun and functions as direct object (example 2), whereas dat is a subordinating conjunction and the entire subordinate clause "dat je gek bent" functions as direct object (example 3). In addition, the word order differs in both examples. Finally, deze (example 4) indicates that its antecedent is spatially close to the speaker, whereas die is spatially distant. In order to learn the difference between dat/dit and die/deze, the model may need to focus more on the antecedent's position with respect to the pronoun, POS, word order and other tokens in the sentences such as colons, and it will need to infer the spatial (and temporal) relation between the speaker and the antecedent.