# Automatic Translation between Mixtec to Spanish Languages Using Neural Networks
## 4 Methodology
### Phase 2: Developing and Applying the Corpus Processing Module
\begin{table}
\begin{tabular}{c c} \hline \hline
**Spanish** & **Mixtec** \\ \hline Las cuatro de la tarde & Ka kumi xkuaa \\ A las oiez de la noche & Ka uxi te füütu \\ A las tres de la manâana & Ka uni te na a \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Comparison between Spanish and Mixtec parallel corpus. Figure 5: Comparative analysis of token and sentence Counts in processed corpus dataset. The bar chart displays the number of tokens and sentences in the training, validation, and test subsets for both Spanish and Mixtec languages. ```
1:Start
2:Input: Text file \(F\) in Mixtec or Spanish in utf8
3:Output: Processed Mixtec text file \(S\)
4:functionReadFile(\(F\))
5: Open file \(F\) to read its content
6:endfunction
7:End Read File
8:functionCleanText(\(F\))
9: Define special characters \(\backslash\)specialCharacters=\(\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0} \pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\color[rgb]{0,0,0} \definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0} \pgfsys@color@gray@fill{0}\color[



1. The translation model was trained in the Spanish-to-Mixtec direction with the authentic parallel corpus to generate synthetic data in Mixtec. 2. After training the model with the authentic corpus, the model was then trained with synthetic data in Mixtec. 3. Finally, the synthetic and authentic data were combined to train the model in the Spanish-Mixtec and Mixtec-Spanish directions. #### 4.4.1 Vocabulary Generation

After cleansing the corpus, we proceeded with tokenization, a process that segments sentences into individual words or subwords. This study specifically concentrated on word-level tokenization, which, as our experiments demonstrated, outperforms other tokenization strategies, especially in languages with scarce digital resources. We implemented word-level tokenization across both recurrent neural network (RNN) and transformer network architectures. Tokenization results in a collection of words, each associated with its respective tensors or vectors. This conversion of words in a sentence into vectors is referred to as word embedding. Word embedding facilitates the representation of tokens in a multidimensional space, allowing for the clustering of semantically similar terms. We denote the collection of segmented words and their corresponding tensors as vocabularies. In the following sections, we elaborate on the creation of vocabularies for both Mixtec and Spanish languages. The vocabulary is composed of two files, one for Mixtec and another for Spanish. The format of the vocabulary file is as follows: Token+space+tensor identifier, where _token_ corresponds to a word from the vocabulary followed by a blank space and the numerical value of the token. Table 9 shows examples of the vocabulary in Mixtec and Spanish. The format for generating vocabularies is applied in recurrent neural networks and transformers. Table 10 shows the tokenization of words by language. #### 4.4.2 Model Architectures

Next, we detail the proposed architectures of the recurrent neural network and transformer network, in addition to the tokenization and vectorization of words. **Recurrent Neural Network**

Figure 6 shows the architecture of the proposed recurrent neural network. Table 11 shows the number of layers and hyperparameters. \begin{table}
\begin{tabular}{c c} \hline \hline
**Languages** & **Words** \\ \hline Spanish & 5066 \\ Mixtec & 3965 \\ \hline \hline \end{tabular}
\end{table} 
Table 10: Word tokenization. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Languages** & **Word Token** & **Token Value** \\ \hline Mixtec & cha & 534 \\ Spanish & de & 436 \\ Mixtec & cua & 319 \\ Spanish & que & 251 \\ Mixtec & fra & 287 \\ Spanish & la & 333 \\ \hline \hline \end{tabular}
\end{table} 
Table 9: Examples of vocabularies in Mixtec and Spanish. Each element \(X_{i}\) indicates the sentence in Mixtec and Spanish in the input layer. In the recurrent neural network, we assigned a word embedding length of 128.