<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Technology of Ukrainian-English Machine Translation Based on Recursive Neural Network as LSTM</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Myroslav Konyk</string-name>
          <email>myroslav.konyk.mnsam.2022@lpnu.ua</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Victoria Vysotska</string-name>
          <email>victoria.a.vysotska@lpnu.ua</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Svitlana Goloshchuk</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Roman Holoshchuk</string-name>
          <email>roman.o.holoshchuk@lpnu.ua</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Sofia Chyrun</string-name>
          <email>sofiia.chyrun.sa.2022@lpnu.ua</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ihor Budz</string-name>
          <email>ihor.s.budz@lpnu.ua</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Lviv Polytechnic National University</institution>
          ,
          <addr-line>S. Bandera Street, 12, Lviv, 79013</addr-line>
          ,
          <country country="UA">Ukraine</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Osnabrück University</institution>
          ,
          <addr-line>Friedrich-Janssen-Str. 1, Osnabrück, 49076</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>University of Economics in Bratislava</institution>
          ,
          <addr-line>Dolnozemská cesta 1, Bratislava, 85235, Slovak Republic</addr-line>
        </aff>
      </contrib-group>
      <abstract>
        <p>The paper presents a novel approach to developing Ukrainian-English machine translation technology using neural machine translation. A comparative analysis of the developed software product with analogues such as Google Neural Machine Translation, Microsoft Translator and OpenNMT is conducted. The study focuses on the analysis of their main advantages and disadvantages. Here, we introduce an effective solution for the typical architecture of the intelligent Ukrainian-English machine translation system based on recurrent neural networks. The main functional requirements for similar systems are determined, and the technical task is developed. The neural network model test results have shown that the confirmation loss stopped decreasing after 25 epochs.</p>
      </abstract>
      <kwd-group>
        <kwd>1 Machine translation</kwd>
        <kwd>deep learning</kwd>
        <kwd>Ukrainian language</kwd>
        <kwd>machine learning</kwd>
        <kwd>recurrent neural network</kwd>
        <kwd>English language</kwd>
        <kwd>RNN</kwd>
        <kwd>LSTM</kwd>
        <kwd>Long Short-Term Memory</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>Machine translation (MT) is widely used in various areas of our lives as it speeds up natural language
translation and improves the traditional translation process. Its relevance is due to the constant demand
for translation as a type of information activity and the rapid increase of information exchange value.
The digital translation still needs improvement, but the text obtained from an electronic translator allows
you to understand the document’s meaning in most cases. Further, the user may edit the document with
basic knowledge of a foreign language and a command of the subject area the translated information
belongs to. Due to the development of machine learning technologies, it is possible to achieve better
results than ever. Neural Machine Translation (NMT) is a recently proposed approach to machine
translation that differs from traditional statistical machine translation as it focuses on building a single
artificial neural network that can be jointly configured to maximise translation performance.</p>
      <p>This work aims to study the use of recurrent neural networks for machine learning; to determine the
main features and principles of the sequence-to-sequence model for deep learning in machine
translation. The subject of research is a recurrent neural network for machine translation. The object of
research is machine translation.</p>
      <p>
        The study material is a set of bilingual pairs of sentences with tab separators taken from the open
database of sentences and translations Tatoeba [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
      </p>
      <p>Unlike other approaches, such as neural/rule-based/statistical machine translation uses an extensive
neural network that applies artificial intelligence to work like the human brain. It is the most advanced
form of machine translation available, with tremendous progress made in recent years through
AIpowered self-learning, huge data collection and deep learning. Modern neural machine translation
engines are a basis for developing professional translations. Recent technological advances have
enabled an increasing number of multinational institutions to use NMT engines to support internal and
external communication.</p>
      <p>
        Advantages of using neural machine translation:
 High accuracy: drawing from ever-extending data sets and language modelling, NMT engines
can mine the broader context of words and phrases to create more accurate and fluent
translations, which can be improved over time. In contrast, conventional phrase-based MT only
considers the context of a few words next to the translated word.
 Fast training: neural networks can be trained quickly using automated processes instead of the
expensive and largely manual methods required for rule-based MT.
 Simple integration and flexibility: the advantage that NMT carries over its statistical
predecessor includes its integration via an application programming interface (API) and
software development kit (SDK) into any software and applied to many content files formats.
 Customisation: to improve the results, the user can set up the NMT output and update the model
with terminological databases, brand-specific glossaries, and other data sources.
 Cost-efficiency: human translation can be expensive, especially in projects that involve long
texts and many languages. NMT produces highly accurate and fast translation systems at low
costs. If needed, the user may address human translators for post-editing.
 Scalability: when your translation needs to scale up, neural machine translation can help meet
increased demand quickly and efficiently [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. Related works</title>
      <p>
        In recent years, the technology of neural machine translation, based on artificial neural networks
with representation learning (deep learning), has rapidly developed. That is why many companies have
decided to use this technology for their products. Despite several reviews in the literature that address
the importance of neural machine translation, none of the recently published articles has
comprehensively examined the critical roles of these technologies in the process of Ukrainian-English
translation based on a recursive neural network. In our research, we will first study and discuss these
products (Fig. 1) [
        <xref ref-type="bibr" rid="ref3 ref4 ref5 ref6 ref7 ref8 ref9">3-8</xref>
        ].




      </p>
      <p>
        Google Neural Machine Translation (GNMT) is a neural machine translation (NMT) system
developed by Google. The GNMT network can undertake interlingual machine translation by encoding
the semantics of the sentence rather than by memorising phrase-to-phrase translations. Next, we will
consider the main benefits and drawbacks of the GNMT system [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
      </p>
      <p>The benefits of Google neural machine translation can be summed up as follows:
Google Translate is free. An experienced professional translator can sometimes be costly, but the
quality balances the expenses spent.</p>
      <p>
        Google Translate is quick. One of the main advantages of Google Translate is that it is speedy. A
human translator(s) cannot compete with the speed nor, as a result, the number of translations that
Google Translate can perform. In an average workday, an experienced translator can translate about
2,000 words maximum (300-400 words/hour), depending on the difficulty of the text. In contrast,
Google Translate can produce a translation with the same number of words in seconds [
        <xref ref-type="bibr" rid="ref5 ref6">5</xref>
        ].
Google Translate uses a statistical method to form an online translation database based on
language pair frequency. Google Translate uses a statistical approach to develop an online database
for translations often made by humans and available online.
      </p>
      <p>The main drawbacks include the following:
Google Translate may “lose” the word meaning because there is no way to incorporate context.</p>
      <p>The complexity of the text and any context that cannot be interpreted without accurate language
knowledge make the error probability higher. Direct translation is standard with Google Translate
and often results in nonsensical literal translations, while professional translators make much effort
to ensure this does not happen. They use well-established online glossaries, back translation
methods, proofreaders and reviewers to achieve this.</p>
      <p>The quality of translation relies on the language pair. The source and target languages involved
also affect the quality of the translation. Since Google’s web-based translation database is built
primarily from existing online translations, standard translations for languages, e.g. German or
English, tend to be more accurate. The translations for other languages that are not available in
Google’s database are less likely to be precise.</p>
      <p>
        Google Translate often translates with significant grammatical errors. Since Google’s translation
system uses a method based on language pair frequency, grammatical rules are not considered [
        <xref ref-type="bibr" rid="ref5 ref6">5</xref>
        ].
Google Translate does not have a system to correct translation errors. There is no way of reporting
errors to avoid repeating them, nor is there a way to proofread what has been translated unless one
is fluent in both the source and the target language [
        <xref ref-type="bibr" rid="ref5 ref6">5</xref>
        ].
      </p>
      <p>
        Microsoft Translator is the main competitor of Google Translate. The advantages of the Microsoft
Translator App include the following features [
        <xref ref-type="bibr" rid="ref8">7</xref>
        ]:
 Group Interactions: The programme’s distinctive feature is its compatibility with conversating
with a large group of people. It generates a conversation code for a user that can be shared with
everyone interested in a discussion.
 Website and Skype Integration: Skype and web integration are another outstanding application
feature. The users do not have to worry if the website is in a foreign language, as the Microsoft
Translator application can interpret it easily. Users can also enjoy the software’s benefits when
using Skype.
 Interprets all Common Vernaculars: The software can translate the world’s most spoken
languages; no matter which device the application is used, it can translate the tongues smoothly.
 Friendly Interface: Microsoft has offered a functional and pleasant interface. It does not make
people feel bored and businesslike. Moreover, it provides easy solutions to its users by offering a
simple procedure.
      </p>
      <p>The Microsoft Translator App also has the following disadvantages:
 Limited Languages.
 Interpretations of One Type.
 Not Always Accurate.</p>
      <p>
        Open-Source Neural Machine Translation (OpenNMT) is an open-source ecosystem for neural
machine translation and neural sequence learning [
        <xref ref-type="bibr" rid="ref9">8</xref>
        ]. OpenNMT contributes to academia and industry
by removing limitations and barriers through an open-source engine. The system is designed to be easy
to use and expandable, maintaining efficiency and state-of-the-art accuracy.
      </p>
      <p>
        It provides implementations in two popular deep learning frameworks:
1. OpenNMT-py: user-friendly and multimodal, benefiting from PyTorch ease of use.
2. OpenNMT-tf: modular and stable, powered by the TensorFlow ecosystem [
        <xref ref-type="bibr" rid="ref9">8</xref>
        ].
Each implementation has its own set of unique features but shares similar goals:
 Highly configurable model architectures and training procedures;
 Efficient model serving capabilities for use in real-world applications;
 Extensions allow other tasks such as text generation, tagging, summarisation, image-to-text,
and speech-to-text [
        <xref ref-type="bibr" rid="ref9">8</xref>
        ].
      </p>
      <p>In summary, we may conclude that the advantage of neural machine translation systems is that they
are end-to-end models that do not have a pipeline of specific tasks. The disadvantage is the need for a
bilingual set and the ongoing problem of processing rare words.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Methods</title>
      <p>The Python programming language and the Jupyter programming environment are used to develop
the neural machine translation system. A set of Keras tools is employed for the natural process of
building the model.</p>
      <p>Python. A brief review of the programming language itself is worth our attention. Python is the
most common programming language for artificial neural networks. It has a low entry threshold: no
one writes neural networks in Python from scratch because it is time-consuming. There are libraries for
Python neural networks already written by experts. Thus, a whole neural network community has
formed around Python.</p>
      <p>The advantages of using Python include the following main features:
 Conciseness and interoperability: The language allows you to develop complex algorithms
in a short time. It is distinguished by simplicity, conciseness and expressiveness. In addition, it
has a powerful interoperability mechanism with C\++, which allows for fast calculations.</p>
      <p>Because of this, engineers can create simple and complex neural networks in Python.
 Flexibility: Neural networks are primarily small programs, but there is a need to change them
often, choosing the best architecture, data processing, and other parameters. Therefore, there
are practically no difficulties with legacy code, but there is a need for rapid development.
Creating and building neural networks in Python is an option that meets these requirements
better than using C++ or Java.</p>
      <p>
        Keras. The next stage of our study is to consider the toolkit built based on TensorFlow Keras. It is
a powerful platform that can scale to large clusters of GPUs or an entire TPU module [
        <xref ref-type="bibr" rid="ref10">9</xref>
        ]. Keras is a
deep learning API written in Python that operates on top of the TensorFlow machine learning platform.
It is designed to emphasise the possibility of rapid experimentation, as moving from idea to result as
quickly as possible is the key to good research [
        <xref ref-type="bibr" rid="ref11">10</xref>
        ]. Benefits of using Keras:
 Simple: Keras reduces the developer’s cognitive load, so they focus on the parts of the issue
that really matter.
 Flexible: Keras adopts the progressive disclosure of complexity principle: simple workflows
should be fast and easy. In contrast, arbitrarily advanced workflows should be possible through
a clear path that builds on your learning.
 Powerful: Keras provides industry-strength performance and scalability: it is used by
organisations and companies, including NASA, YouTube and Waymo [
        <xref ref-type="bibr" rid="ref11">10</xref>
        ].
      </p>
      <p>Figure 2 shows the popular open-source NMT toolkits on GitHub.</p>
      <p>
        Jupyter Notebook integrates code and its output into a single document that combines
visualisations, narrative text, mathematical equations, and other important media. We assume it is a
single document where users can run code, display the output, add explanations, formulas, and charts,
and make their work more transparent, understandable, repeatable, and shareable [
        <xref ref-type="bibr" rid="ref13">12</xref>
        ].
      </p>
      <p>
        Using Notebooks is now a significant part of the data science workflow at companies across
the globe. If the software developer’s goal is to work with data, using a Notebook will speed up their
workflow and make communicating and sharing the results more accessible. Another essential feature
of the programme is that as part of the open-source Project Jupyter, Jupyter Notebooks are entirely free.
The software can be downloaded independently or as part of the Anaconda data science toolkit [
        <xref ref-type="bibr" rid="ref13">12</xref>
        ].
      </p>
      <p>
        NMT Model. The general architecture of our model is explained below. It is a
sequence-tosequence (Seq2Seq) neural network model with inner layers of recurrent neural networks [
        <xref ref-type="bibr" rid="ref14 ref15 ref16">13-15</xref>
        ].
      </p>
      <p>
        Each Seq2Seq model contains two main components:
 Encoder outputs some value for each word in the input sentence. For every input word, the
encoder outputs a vector and a hidden state and uses the hidden state for the next input word
[
        <xref ref-type="bibr" rid="ref17 ref18">16-17</xref>
        ].
 Decoder reads the encoder’s output vector(s) and outputs a sequence of words to create a
translation [
        <xref ref-type="bibr" rid="ref18">17</xref>
        ].
      </p>
      <p>
        Long Short-Term Memory (LSTM) is a type of RNN capable of learning long-term
dependencies. All recurrent neural networks have the form of a chain of recurrent neural network
modules. LSTMs also have this chain architecture, but the repeated module has a different structure.
Instead of having one layer of a neural network, four interact exceptionally [
        <xref ref-type="bibr" rid="ref19 ref20">18-19</xref>
        ].
      </p>
      <p>
        The visualisation of the architecture of our neural machine translation model is shown in Fig. 5 [
        <xref ref-type="bibr" rid="ref21">20</xref>
        ].
      </p>
    </sec>
    <sec id="sec-4">
      <title>4. Experiments, results and discussion</title>
      <p>
        There are several ways we can formulate the task of training an RNN to write text, in this case,
Ukrainian-English translation. However, we choose to introduce it as a many-to-one sequence mapper
[
        <xref ref-type="bibr" rid="ref20 ref21 ref22 ref23 ref24">19-29</xref>
        ]. In the first stages of system design, the main task is to analyse the implementation process of
this system. It is necessary to build a model describing the work process, containing all the essential
information about the processes’ functions and the work organisation’s peculiarities [30-39].
      </p>
      <p>Use case diagram is the initial conceptual model of the system in the process of its design and
development (Fig. 6). It consists of actors, use cases, and relationships between them.
The following interfaces are used in this diagram:
 A diagram of components of the neural machine translation system model (ITP) is an interface
for transferring downloaded text data to the input of the word processor.
 Interface Input Text Processing (IITP) – an interface for transmitting user-entered text to a
primary word processing module.
 Interface Machine Translation (IMT) is used for loading the most effective stored machine
translation model for further use in the process of neural machine translation of pre-processed
text entered by the user.
 Interface Machine Translation Model Training (IMTMT) transmits the original processed
(cleaned, normalised, tokenised, digitised) training data to the machine translation model
training input.
 Interface Processing-Machine Translation (IPMT) transfers the output (from the text translation
module) processed text data, entered by the user to be translated, to the input module of the
direct NMT.
 Interface User-Application (IUA) is the interface for transferring the resulting translation of the
user’s text to the User Interface module for its final output.</p>
      <p>Activity diagram is another crucial behavioural diagram in UML diagram to describe dynamic
aspects of the system. An activity diagram is an advanced flow chart that models the flow from one
activity to another in the system [25-27].</p>
      <p>An activity diagram is a great tool for achieving the following goals:
 to write an algorithm logic;
 to illustrate a business process or workflow between users and the system;
 to simplify and improve any process by identifying complex use cases;
 to model software architecture elements such as method, function, and operation.
The first thing we need to do is import the necessary libraries.</p>
      <p>
        Next, we will write a function for reading data in Jupyter Notebook [
        <xref ref-type="bibr" rid="ref20">19</xref>
        ]:
      </p>
      <p>
        Then, another function for dividing the text into English-Ukrainian pairs separated by a symbol’ \n’
is defined. Further, we correspondingly split these pairs into English and Ukrainian sentences [
        <xref ref-type="bibr" rid="ref20">19</xref>
        ].
      </p>
      <p>
        Now we can use these functions to read text into an array of the necessary format [
        <xref ref-type="bibr" rid="ref20">19</xref>
        ]:
data = read_text(“ukr.txt”)
ua_eng = to_lines(data)
ua_eng = array(ua_eng)
      </p>
      <p>
        The actual data consists of over 150,000 sentence pairs. However, we will only use the first 50,000
per item to reduce the training time of the model [
        <xref ref-type="bibr" rid="ref20">19</xref>
        ].
      </p>
      <p>ua_eng = ua_eng [: 50000 ,:]</p>
      <p>
        Next, we pre-process the text. It is an essential step in any project, especially in NLT. The data we
process is often unstructured, so there are certain things we need to take care of before moving on to
the model-building stage [
        <xref ref-type="bibr" rid="ref1 ref20">1, 19</xref>
        ].
      </p>
      <p>a) Text cleaning
First, we analyse our data as it helps us decide which pre-processing steps to take:
ua_eng</p>
      <p>The next step is to remove punctuation and convert text into lowercase.
# Remove punctuation
ua_eng[:,0] = [s.translate(str.maketrans('', '', string.punctuation)) for s in
ua_eng[:,0]]
ua_eng[:,1] = [s.translate(str.maketrans('', '', string.punctuation)) for s in
ua_eng[:,1]]
for i in range(len(ua_eng)): # convert text to lowercase
ua_eng[i,0] = ua_eng[i,0].lower()
ua_eng[i,1] = ua_eng[i,1].lower()
b) Converting text into a sequence</p>
      <p>
        The Seq2Seq model requires us to convert input and output sentences into fixed-length integer
sequences. Before doing that, we visualise the length of the sentences by collecting the length of all
sentences in two separate lists for English and Ukrainian languages [
        <xref ref-type="bibr" rid="ref20">19</xref>
        ].
      </p>
      <p>for i in ua_eng[:,1]:</p>
      <p>ua_l.append(len(i.split()))
length_df = pd.DataFrame({'eng':eng_l, 'ua':dua_l}) length_df.hist(bins = 30)
plt.show()</p>
      <p>
        We may assume that the maximum length of English sentences is six words, and there are eight in
Ukrainian sentences. Next, we vectorise our text data using the Keras Tokenizer() class. It turns out
sentences into sequences of integers. We can then pad these sequences with zeros to make all rows the
same length. And afterwards, the lexemes for both Ukrainian and English sentences are prepared [
        <xref ref-type="bibr" rid="ref20">19</xref>
        ].
eng_tokenizer = tokenization(ua_eng[:, 0]) # prepare an english tokeniser
eng_vocab_size = len(eng_tokenizer.word_index) + 1
eng_length = 8 # print('English Vocabulary Size: %d' % eng_vocab_size)
ua_tokenizer = tokenization(ua_eng[:, 1]) # prepare Ukrainian tokeniser
ua_vocab_size = len(ua_tokenizer.word_index) + 1
ua_length = 8 # print('Ukrainian Vocabulary Size: %d' % ua_vocab_size)
The shown below code block contains a function to prepare sequences. It also performs string
complements up to the maximum sentence length as stated above [
        <xref ref-type="bibr" rid="ref20">19</xref>
        ].
      </p>
      <p>
        Then we proceed to build our model. First, we divide the data into training and test sets for model
training and its evaluation [
        <xref ref-type="bibr" rid="ref20">19</xref>
        ].
      </p>
      <p>The next step is to code our sentences. We encode Ukrainian sentences as input sequences and English
sentences as target sequences. It is done for both training and testing datasets.</p>
      <p>
        Subsequently, we define the architecture of the model. As mentioned earlier, we use an embedding
layer and an LSTM layer for the encoder; for the decoder, we use another LSTM layer and then a dense
layer [
        <xref ref-type="bibr" rid="ref20">19</xref>
        ].
def build_model(in_vocab,out_vocab, in_timesteps,out_timesteps,n):# build NMT model
model = Sequential()
model.add(Embedding(in_vocab, n, input_length=in_timesteps,
mask_zero=True))
model.add(LSTM(n))
model.add(RepeatVector(out_timesteps))
model.add(LSTM(n, return_sequences=True))
model.add(Dense(out_vocab, activation='softmax'))
return model
      </p>
      <p>
        We use the RMSprop optimiser in this model because it shows positive results in dealing with
recurrent neural networks [
        <xref ref-type="bibr" rid="ref20">19</xref>
        ].
      </p>
      <p># model compilation (with 512 hidden units)
model = build_model(ua_vocab_size, eng_vocab_size, ua_length, eng_length, 512)
rms = optimizers.RMSprop(lr=0.001)
model.compile(optimizer=rms, loss='sparse_categorical_crossentropy')
We should mention that we use ‘sparse_categorical_crossentropy’ as the loss function. It is
reasoned by the function’s ability to use the target sequence in its pure state instead of a one-time
encoded format. Using such a vast vocabulary, the former encoding of target sequences can fully
exhaust the system’s memory. We train our model for 30 epochs, with a batch size of 512 and a
validation distribution of 20%. The model is trained with 80% of the data; the rest is left for evaluation.</p>
      <p>
        Finally, we can download the saved model and make predictions on unseen data – testX [
        <xref ref-type="bibr" rid="ref20">19</xref>
        ].
model = load_model('model_UA_to_ENG')
preds = model.predict_classes(testX.reshape((testX.shape[0], testX.shape[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ])))
These predictions are sequences of integers. We need to convert these integers into their
corresponding words, so we need to define a function for that [
        <xref ref-type="bibr" rid="ref20">19</xref>
        ]:
      </p>
      <p>The obtained sequences of integers representing predictions are converted into an English text:
Next, we place the original English sentences in the test data set and the predicted sentences in the
data frame:</p>
      <p>pred_df = pd.DataFrame({'UA': test[:,1], 'actual_ENG' : test[:,0], 'predicted_ENG'
: preds_text})
pd.set_option('display.max_colwidth', 200)
Finally, we can run a benchmark test and review the results (Fig. 10 - 11).</p>
      <p>pred_df.head(15)</p>
      <p>pred_df.tail(15)</p>
      <p>Now we would like to describe the model training statistics. For this, we apply a function called
ModelCheckpoint() [28]. Application of the ModelCheckpoint():</p>
      <p>The following arguments of the ModelCheckpoint function are used:
filename : string or PathLike, path to save the model file. The directory of the filepath should
not be reused by any other callbacks to avoid conflicts [28].</p>
      <p>monitor : the metric name to monitor.</p>
      <p>Note:
 Prefix the name with “val_” to monitor validation metrics.
 Use “loss” or “val_loss” to monitor the model’s total loss [28].</p>
      <p>verbose : verbosity mode, 0 or 1. Mode 0 is silent, and mode 1 displays messages when the callback
takes action [28].</p>
      <p>save_best_only: if save_best_only=True, it only saves when the model is considered the “best”
and the latest best model according to the quantity monitored will not be overwritten.</p>
      <p>mode : one of {‘auto’, ‘min’, ‘max’}. If save_best_only=True, the decision to overwrite the
current save file is made based on either the maximisation or the minimisation of the monitored
quantity. For val_loss, this should be min [28].</p>
      <p>So, we will build a graph and compare the model’s training loss and validation loss.
plt.plot(history.history['loss'])
plt.plot(history.history['val_loss'])
plt.legend([‘train’, ‘validation’])
plt.show()</p>
      <p>As we can see in the diagram above, the validation loss ceased decreasing after 25 epochs.</p>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusions</title>
      <p>In the course of work, we developed a project, the objective of which was to design a system of
Ukrainian-English translation using the means of neural machine translation. First, we discussed
essential considerations in developing the research question, defined objectives and tasks, constructed
the subject and object of research, scientific novelty and practical value of the developed project.</p>
      <p>The first stage of our study compared the developed product with analogues such as Google Neural
Machine Translation (GNMT), Microsoft Translator and OpenNMT were carried out, determining their
advantages and disadvantages. Then, a system analysis of the developed product was conducted, and
UML diagrams were constructed (use case diagram, components diagram and activity diagram). After
that, the research hypothesis and the technical task were formulated.</p>
      <p>The next stage of our study dealt with selecting methods and means of the developed product. We
proved the advantages of Python, the Keras toolkit and the Jupyter Notebook development environment
as the necessary tools for our work. The general architecture of the Seq2Seq model using LSTM layers
was also presented. Having analysed the software process and its structure, we performed system testing
to evaluate system specifications and describe the results. Then we made the training statistics of the
model with a description of its outcome. All things considered, it seems reasonable to assume that future
research should explore improving the translation’s system accuracy and increasing the model’s speed,
which will involve exploring additional or alternative architectural solutions.</p>
    </sec>
    <sec id="sec-6">
      <title>6. Acknowledgement</title>
      <p>Part of this paper was written within the project which received funding from the EU
NextGenerationEU through the Recovery and Resilience Plan for Slovakia under the project No.
09I0303-V01-00118.
7. References
[24] Dive into Deep Learning. Machine Translation and the Dataset. URL:
https://d2l.ai/chapter_recurrent-modern/machine-translation-and-dataset.html
[25] Xuanming Zhang. Analysis of State of the Art Deep Learning based Techniques for Medical</p>
      <p>Natural Answer Generation. URL: https://www.billyzhang.me/uploads/billyzhang_thesis.pdf
[26] Deepika Singh. Natural Language Processing - Machine Learning with Text Data. URL:
[27] https://www.pluralsight.com/guides/nlp-machine-learning-text-data
[28] ModelCheckpoint. URL: https://keras.io/api/callbacks/model_checkpoint/.
[29] Callbacks API. URL: https://keras.io/api/callbacks/
[30] M. Garcarz, Legal Language Translation: Theory behind the Practice, CEUR Workshop</p>
      <p>Proceedings, Vol-3171 (2022) 2-2.
[31] N. Hrytsiv, I. Bekhta, M. Tkachivska, V. Byalyk, Sylvia Plath’s I felt-Narrative Label of The Bell</p>
      <p>Jar in Ukrainian Translation, CEUR Workshop Proceedings, Vol-3171 (2022) 240-255.
[32] M. Bekhta-Hamanchuk, H. Oleksiv, T. Shestakevych, Y. Shyika, Quantitative Parameters of J.</p>
      <p>London's Short Stories Collection “Children of the Frost” and its Translation, CEUR Workshop
Proceedings, Vol-3171 (2022) 697-710.
[33] K. S. Mandziy, U. V. Yurlova, M. P. Dilai, English-Ukrainian Parallel Corpus of IT Texts:</p>
      <p>Application in Translation Studies, CEUR Workshop Proceedings, Vol-3171 (2022) 724-736.
[34] N. Hrytsiv, T. Shestakevych, J. Shyyka, Corpus Technologies in Translation Studies: Fiction as</p>
      <p>Document, in: CEUR Workshop Proceedings, Vol-2917 (2021) 327-343.
[35] A. Lutskiv, R. Lutsyshyn, Corpus-Based Translation Automation of Adaptable Corpus Translation</p>
      <p>Module, CEUR Workshop Proceedings, Vol-2870 (2021) 511-527.
[36] V. Lytvyn, P. Pukach, V. Vysotska, M. Vovk, N. Kholodna, Identification and Correction of
Grammatical Errors in Ukrainian Texts Based on Machine Learning Technology. Mathematics 11
(2023) 904. https://doi.org/10.3390/math11040904
[37] A. Kopp, D. Orlovskyi, S. Orekhov, An Approach and Software Prototype for Translation of
Natural Language Business Rules into Database Structure, CEUR Workshop Proceedings 2870
(2021) 1274-1291.
[38] S. Kubinska, R. Holoshchuk, S. Holoshchuk, L. Chyrun, Ukrainian Language Chatbot for
Sentiment Analysis and User Interests Recognition based on Data Mining, CEUR Workshop
Proceedings, Vol-3171 (2022) 315-327.
[39] A. Dmytriv, S. Holoshchuk, L. Chyrun, R. Holoshchuk, Comparative Analysis of Using Different
Parts of Speech in the Ukrainian Texts Based on Stylistic Approach, CEUR Workshop
Proceedings, Vol-3171 (2022) 546-560.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Tatoeba</surname>
          </string-name>
          . URL: https://tatoeba.org/uk/, https://tatoeba.org/en/.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>Machines</given-names>
            <surname>That</surname>
          </string-name>
          <article-title>Think: The Rise of Neural Machine Translation</article-title>
          . URL: https://www.memsource.com/blog/neural-machine-translation/.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <article-title>[3] Google neural machine translation</article-title>
          . URL: http://surl.li/cdbya.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <article-title>[4] Google Translate for Android has become smarter</article-title>
          . URL: https://itechua.com/technologies/83561.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>The</given-names>
            <surname>Pros</surname>
          </string-name>
          and
          <article-title>Cons of Google Translate vs</article-title>
          .
          <source>Professional Translation</source>
          . URL: https://www.languageconnections.com/blog/the-pros
          <article-title>-cons-of-google-translate/.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Microsoft</given-names>
            <surname>Translator</surname>
          </string-name>
          . URL: https://ehlion.com/magazine/microsoft-translator/.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Microsoft</given-names>
            <surname>Translator</surname>
          </string-name>
          <string-name>
            <surname>App</surname>
          </string-name>
          ,
          <article-title>The Advantages and Disadvantages</article-title>
          . URL: https://www.dutchtrans.co.
          <article-title>uk/microsoft-translator-app-the-advantages-and-disadvantages/.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <article-title>[7] OpenNMT</article-title>
          . URL: https://opennmt.net/.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>Exascale</given-names>
            <surname>Machine</surname>
          </string-name>
          <article-title>Learning</article-title>
          . URL: https://keras.io/.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>About</given-names>
            <surname>Keras</surname>
          </string-name>
          . URL: https://keras.io/about/.
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [10]
          <string-name>
            <surname>Jupyter</surname>
          </string-name>
          . URL: https://jupyter.org/.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [11]
          <string-name>
            <surname>What</surname>
          </string-name>
          is Jupyter Notebook? URL: https://www.dataquest.io/blog/jupyter-notebook-tutorial/.
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>A.</given-names>
            <surname>Geitgey</surname>
          </string-name>
          .
          <source>Machine Learning is Fun Part</source>
          <volume>5</volume>
          :
          <article-title>Language Translation with Deep Learning and the Magic of Sequences</article-title>
          . URL: https://medium.com/@ageitgey/machine
          <article-title>-learning-is-fun-part5language-translation-with-deep-learning-and-the-magic-of-sequences-2ace0acca0aa.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [13]
          <article-title>Course:CPSC522/Recurrent Neural Networks</article-title>
          . URL: https://wiki.ubc.ca/Course:CPSC522/Recurrent_Neural_Networks
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [14]
          <article-title>NLP from Scratch: Translation with A Sequence to Sequence Network and Attention</article-title>
          . URL: https://pytorch.org/tutorials/intermediate/seq2seq_translation_tutorial.html.
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [15]
          <article-title>Sequence to Sequence Models</article-title>
          . URL: https://www.analyticsvidhya.com/blog/2020/08/asimpleintroduction-to
          <article-title>-sequence-to-sequence-models/.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          <article-title>[16] Long short-term memory</article-title>
          . URL: https://en.wikipedia.
          <article-title>org/wiki/Long_short-term_memory.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>W.</given-names>
            <surname>Koehrsen</surname>
          </string-name>
          ,
          <article-title>Recurrent Neural Networks by Example in Python</article-title>
          . URL: https://towardsdatascience.com/recurrent
          <article-title>-neural-networks-by-example-in-python-ffd204f99470.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>P.</given-names>
            <surname>Joshi</surname>
          </string-name>
          .
          <article-title>A Must-Read NLP Tutorial on Neural Machine Translation</article-title>
          . URL: https://www.analyticsvidhya.com/blog/2019/01/neural-machine-translation-keras/
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>J.</given-names>
            <surname>Brownlee</surname>
          </string-name>
          .
          <article-title>How to Clean Text for Machine Learning with Python</article-title>
          . URL: https://machinelearningmastery.com
          <article-title>/clean-text-machine-learning-python/</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>R.</given-names>
            <surname>Agrawal</surname>
          </string-name>
          .
          <article-title>Text preprocessing</article-title>
          . URL: https://www.analyticsvidhya.com/blog/2021/06/mustknown-techniques
          <article-title>-for-text-preprocessingin-nlp/</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>A.</given-names>
            <surname>Takezawa</surname>
          </string-name>
          .
          <article-title>Seq2Seq LSTM Model in Keras</article-title>
          . URL: https://towardsdatascience.com
          <article-title>/howtoimplement-seq2seq-lstm-model-in-keras-shortcutnlp-6f355f3e5639</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          [22]
          <string-name>
            <given-names>R.</given-names>
            <surname>Hinno</surname>
          </string-name>
          .
          <article-title>Tuned version of seq2seq tutorial</article-title>
          . URL: https://towardsdatascience.com
          <article-title>/tunedversionof-seq2seq-tutorial-ddb64db46e2a</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          [23]
          <string-name>
            <given-names>H.</given-names>
            <surname>Patel. Neural Machine</surname>
          </string-name>
          <article-title>Translation (NMT) with Attention Mechanism</article-title>
          . URL: https://towardsdatascience.com
          <article-title>/neural-machine-translation-nmt-with-attentionmechanism5e59b57bd2ac</article-title>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>