Arabic text processing

username: Aiman_Mutasem-bellh
cooked: <p>Hello friend,</p>
<p>I have a question about how to manipulating Arabic text from right to left with seq2seq model tasks like (word embedding - softmax function). I think by default (CNN and RNN) manipulate text left to right like English language, and this may affect negatively on results accuracy.</p>

username: Nikronic
cooked: <p>Hi,</p>
<p>Actually I have never done project on texts but this <a href="https://medium.com/ai-backyard/persian-to-english-translation-efa97896846" rel="nofollow noopener">medium article</a> may help you, because they have built a Persian-English translator. You may know, Persian and Arabic both use same scripts (right to left, same characters except 4).</p>
<p>Good luck</p>

username: Aiman_Mutasem-bellh
cooked: <p>Thank you, Mr. Lakhani, for help <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=9" title=":slight_smile:" class="emoji" alt=":slight_smile:"></p>
<p>I was read the article carefully, and there is no cite to right-to-left text processing. This article uses align word or sentence, and this enough for this case.</p>
<p>I have a new question for you. <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=9" title=":slight_smile:" class="emoji" alt=":slight_smile:"><br>
Do you have an idea about right-to-left seq2seq model in PyTorch?</p>

username: vdw
cooked: <p>I cannot see why there should be any fundamental differences resulting from the reading direction of a language. Nothing truly changes.</p>
<p>RNNs process sequences. It doesn’t matter if the first item of a sequence represents the first left or the first right word of a sentence. Diagrams of RNNs are commonly represented processing left to right. Well, just flip it. An RNN has no reading direction :). If you use a bidirectional RNN, then it’s a non-issue to begin with.</p>
<p>A CNN is even less a concern since it does go over a sequence step by step. So there’s no concept of left to right or right to left. For CNN it should even matter where the padding is – before or after a sentence in the sentence is shorter then the max input of the CNN.</p>
<p>In short, if you prepare your data properly, you can use any existing network model that works for English. Some minor considerations like padding might come into play, but that’s not something to worry about when getting started.</p>

username: Nikronic
cooked: <p>You are welcome,</p>
<p><a class="mention" href="/u/vdw">@vdw</a>’s  answer is complete thanks to him. Actually, this is the reason you might not noticed the right-to-left consideration in the article I had linked.</p>

username: Aiman_Mutasem-bellh
cooked: <p><a class="mention" href="/u/vdw">@vdw</a> and <a class="mention" href="/u/nikronic">@Nikronic</a> thank you <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=9" title=":slight_smile:" class="emoji" alt=":slight_smile:"></p>
<p>my point is in some tasks may I need to process text sequentially right-to-left and left-to-right like Grammer Error Correction (GEC) tasks. To extract features and relationship between words it will be better to do rtl and ltr processing. some types of errors are easier to be corrected by a right-to-left seq2seq model, while some are more likely to be corrected by a left-to-right seq2seq model.</p>
<p>for example, if I have this sentence<br>
"She likes playing in <strong>park</strong> and <strong>come</strong> here every week "</p>
<p>so, when I start from right-to-left I can easily correct an error like,<br>
"She likes playing in <strong>the park</strong> and come here every week "</p>
<p>when I reverse the process from left-to-right, I will fix correctly an error like:<br>
“She likes playing in <strong>the park</strong> and <strong>comes</strong> here every week”</p>
<p>from this point, I need to apply the both approaches to get better results, and this is my question. Please, check the below link:<br>
<aside class="onebox whitelistedgeneric">
  <header class="source">
      <img src="https://www.groundai.com/project/reaching-human-level-performance-in-automatic-grammatical-error-correction-an-empirical-study/" class="site-icon" width="" height="">
      <a href="https://www.groundai.com/project/reaching-human-level-performance-in-automatic-grammatical-error-correction-an-empirical-study/" target="_blank" rel="nofollow noopener">GroundAI</a>
  </header>
  <article class="onebox-body">
    <img src="https://www.groundai.comhttps://storage.googleapis.com/groundai-web-prod/media/users/user_135683/project_211797/images/x3.png.265x230_q75_crop.png" class="thumbnail" width="" height="">

<h3><a href="https://www.groundai.com/project/reaching-human-level-performance-in-automatic-grammatical-error-correction-an-empirical-study/" target="_blank" rel="nofollow noopener">Reaching Human-level Performance in Automatic Grammatical Error
  Correction:...</a></h3>

<p>Neural sequence-to-sequence (seq2seq) approaches have proven to be successful in grammatical error correction (GEC). Based on the seq2seq framework, we propose a novel fluency boost learning and inference mechanism. Fluency boosting learning...</p>


  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>
</p>

username: vdw
cooked: <p>I still don’t know what is stopping you. Assume you have a sentence “A B C D E F” (no matter the language), you can given the model either “A B C D E F” or “F E D C B A”. Or you have two networks, one for each order. Or one bidirectional network.</p>
<p>I’m not saying that the task of GEC is trivial. I’m just saying there’s no difference between English and Arabic due to the reading direction.</p>

username: Aiman_Mutasem-bellh
cooked: <p>Dear Mr. <a class="mention" href="/u/vdw">@vdw</a><br>
thank you for your time and your cooperation.</p>
<p>I got your point in the previous comment " there’s no difference between English and Arabic due to the reading direction".<br>
Actually, this is my fault. I didn’t explain my question in a clear and direct way, and I’m sorry about that.</p>
<p>Recently, I tried to develop my first model in GEC based on CNN. Everything worked well, and I got promising results.  Now, I’m going to improve results based on the paper idea, that I was posted in the previous comment. the next paragraph is copy pest from the paper.</p>
<p>“Based on the idea of multi-round correction, we further propose an advanced fluency boost inference approach: round-way error correction. Instead of progressively correcting a sentence with the same seq2seq model as introduced, round-way correction corrects a sentence through a right-to-left seq2seq model and a left-to-right seq2seq model successively.”</p>
<p>Accordingly, I’m looking for a way to apply a right-to-left seq2seq model and a left-to-right seq2seq model, just to improve results, not a language matter.</p>
<p>This stage is just for applying several approaches I have read in some papers.</p>
<p>I hope now I explained my question clearly.</p>
<p>Again, I’m so sorry for the misunderstanding and spending your time.</p>

username: vdw
cooked: <p>I finally read the paper. From what I understand, they simply train two Seq2Seq models side by side: one processing sentences left to right, the other from right to left.</p>
<p>As far as I can tell, the training of both models is done in parallel, just with opposite sequence orders. For inference, the run an incorrect input sentence alternatively through both models until the output is “good enough” or doesn’t change.</p>
<p>In short, you just have to train two models – well, one model in terms of its architecture but with different datasets, where the difference is solely in the order of the sentences.</p>

username: zarat
cooked: <p>I had this problem in Adobe  premier but i solved it</p>

username: Aiman_Mutasem-bellh
cooked: <p>Okay, thank you so match <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=9" title=":slight_smile:" class="emoji" alt=":slight_smile:"></p>