End-to-End#

This tutorial is available as an IPython notebook at Malaya/example/translation.

This module trained on both standard and local (included social media) language structures, so it is save to use for both.

[1]:
import os

os.environ['CUDA_VISIBLE_DEVICES'] = ''
[2]:
%%time

import malaya
import logging

logging.basicConfig(level=logging.INFO)
/home/husein/.local/lib/python3.8/site-packages/bitsandbytes/cextension.py:34: UserWarning: The installed version of bitsandbytes was compiled without GPU support. 8-bit optimizers, 8-bit multiplication, and GPU quantization are unavailable.
  warn("The installed version of bitsandbytes was compiled without GPU support. "
/home/husein/.local/lib/python3.8/site-packages/bitsandbytes/libbitsandbytes_cpu.so: undefined symbol: cadam32bit_grad_fp32
CPU times: user 3.18 s, sys: 2.7 s, total: 5.89 s
Wall time: 2.69 s
/home/husein/dev/malaya/malaya/tokenizer.py:214: FutureWarning: Possible nested set at position 3397
  self.tok = re.compile(r'({})'.format('|'.join(pipeline)))
/home/husein/dev/malaya/malaya/tokenizer.py:214: FutureWarning: Possible nested set at position 3927
  self.tok = re.compile(r'({})'.format('|'.join(pipeline)))

List available HuggingFace models#

[3]:
malaya.translation.available_huggingface
[3]:
{'mesolitica/translation-t5-tiny-standard-bahasa-cased': {'Size (MB)': 139,
  'Suggested length': 1536,
  'en-ms chrF2++': 65.91,
  'ms-en chrF2++': 61.3,
  'ind-ms chrF2++': 58.15,
  'jav-ms chrF2++': 49.33,
  'pasar ms-ms chrF2++': 58.46,
  'pasar ms-en chrF2++': 55.76,
  'manglish-ms chrF2++': 51.04,
  'manglish-en chrF2++': 52.2,
  'from lang': ['en', 'ms', 'ind', 'jav', 'bjn', 'manglish', 'pasar ms'],
  'to lang': ['en', 'ms']},
 'mesolitica/translation-t5-small-standard-bahasa-cased': {'Size (MB)': 242,
  'Suggested length': 1536,
  'en-ms chrF2++': 67.37,
  'ms-en chrF2++': 63.79,
  'ind-ms chrF2++': 58.09,
  'jav-ms chrF2++': 52.11,
  'pasar ms-ms chrF2++': 62.49,
  'pasar ms-en chrF2++': 60.77,
  'manglish-ms chrF2++': 52.84,
  'manglish-en chrF2++': 53.65,
  'from lang': ['en', 'ms', 'ind', 'jav', 'bjn', 'manglish', 'pasar ms'],
  'to lang': ['en', 'ms']},
 'mesolitica/translation-t5-base-standard-bahasa-cased': {'Size (MB)': 892,
  'Suggested length': 1536,
  'en-ms chrF2++': 67.62,
  'ms-en chrF2++': 64.41,
  'ind-ms chrF2++': 59.25,
  'jav-ms chrF2++': 52.86,
  'pasar ms-ms chrF2++': 62.99,
  'pasar ms-en chrF2++': 62.06,
  'manglish-ms chrF2++': 54.4,
  'manglish-en chrF2++': 54.14,
  'from lang': ['en', 'ms', 'ind', 'jav', 'bjn', 'manglish', 'pasar ms'],
  'to lang': ['en', 'ms']},
 'mesolitica/translation-t5-small-standard-bahasa-cased-v2': {'Size (MB)': 242,
  'Suggested length': 2048,
  'en-ms chrF2++': 67.8,
  'ms-en chrF2++': 64.53,
  'ind-ms chrF2++': 60.38,
  'jav-ms chrF2++': 53.48,
  'pasar ms-ms chrF2++': 63.13,
  'pasar ms-en chrF2++': 63.04,
  'manglish-ms chrF2++': 56.57,
  'manglish-en chrF2++': 54.14,
  'from lang': ['en', 'ms', 'ind', 'jav', 'bjn'],
  'to lang': ['en', 'ms']},
 'mesolitica/translation-t5-small-standard-bahasa-cased-code': {'Size (MB)': 242,
  'Suggested length': 2048,
  'en-ms chrF2++': 66.89,
  'ms-en chrF2++': 63.79,
  'from lang': ['en', 'ms', 'ind', 'jav', 'bjn'],
  'to lang': ['en', 'ms']},
 'mesolitica/translation-nanot5-tiny-malaysian-cased': {'Size (MB)': 205,
  'Suggested length': 2048,
  'en-ms chrF2++': 63.61,
  'ms-en chrF2++': 59.55,
  'ind-ms chrF2++': 56.38,
  'jav-ms chrF2++': 47.68,
  'mandarin-ms chrF2++': 36.61,
  'mandarin-en chrF2++': 39.78,
  'pasar ms-ms chrF2++': 58.74,
  'pasar ms-en chrF2++': 54.87,
  'manglish-ms chrF2++': 50.76,
  'manglish-en chrF2++': 53.16,
  'from lang': ['en',
   'ms',
   'ind',
   'jav',
   'bjn',
   'manglish',
   'pasar ms',
   'mandarin',
   'pasar mandarin'],
  'to lang': ['en', 'ms']},
 'mesolitica/translation-nanot5-small-malaysian-cased': {'Size (MB)': 358,
  'Suggested length': 2048,
  'en-ms chrF2++': 66.98,
  'ms-en chrF2++': 63.52,
  'ind-ms chrF2++': 58.1,
  'jav-ms chrF2++': 51.55,
  'mandarin-ms chrF2++': 46.09,
  'mandarin-en chrF2++': 44.13,
  'pasar ms-ms chrF2++': 63.2,
  'pasar ms-en chrF2++': 59.78,
  'manglish-ms chrF2++': 54.09,
  'manglish-en chrF2++': 55.27,
  'from lang': ['en',
   'ms',
   'ind',
   'jav',
   'bjn',
   'manglish',
   'pasar ms',
   'mandarin',
   'pasar mandarin'],
  'to lang': ['en', 'ms']},
 'mesolitica/translation-nanot5-base-malaysian-cased': {'Size (MB)': 990,
  'Suggested length': 2048,
  'en-ms chrF2++': 67.87,
  'ms-en chrF2++': 64.79,
  'ind-ms chrF2++': 56.98,
  'jav-ms chrF2++': 51.21,
  'mandarin-ms chrF2++': 47.39,
  'mandarin-en chrF2++': 48.78,
  'pasar ms-ms chrF2++': 65.06,
  'pasar ms-en chrF2++': 64.03,
  'manglish-ms chrF2++': 57.91,
  'manglish-en chrF2++': 55.66,
  'from lang': ['en',
   'ms',
   'ind',
   'jav',
   'bjn',
   'manglish',
   'pasar ms',
   'mandarin',
   'pasar mandarin'],
  'to lang': ['en', 'ms']}}
[4]:
print(malaya.translation.info)
1. tested on FLORES200 pair `dev` set, https://github.com/huseinzol05/malay-dataset/tree/master/translation/flores200-eval
2. tested on noisy test set, https://github.com/huseinzol05/malay-dataset/tree/master/translation/noisy-eval
3. check out NLLB 200 metrics from `malaya.translation.nllb_metrics`.
4. check out Google Translate metrics from `malaya.translation.google_translate_metrics`.

Improvements of new model#

  1. able to translate [en, ms, ind, jav, bjn, manglish, pasar ms, mandarin, pasar mandarin] while old model only able to translate [en, ms, pasar ms].

  2. No longer required from_lang part of the prefix.

  3. able to retain text structure as it is.

Load Transformer models#

def huggingface(
    model: str = 'mesolitica/translation-t5-small-standard-bahasa-cased',
    force_check: bool = True,
    from_lang: List[str] = None,
    to_lang: List[str] = None,
    old_model: bool = False,
    **kwargs,
):
    """
    Load HuggingFace model to translate.

    Parameters
    ----------
    model: str, optional (default='mesolitica/translation-t5-small-standard-bahasa-cased')
        Check available models at `malaya.translation.available_huggingface()`.
    force_check: bool, optional (default=True)
        Force check model one of malaya model.
        Set to False if you have your own huggingface model.

    Returns
    -------
    result: malaya.torch_model.huggingface.Translation
    """
[25]:
model = malaya.translation.huggingface(model = 'mesolitica/translation-nanot5-small-malaysian-cased')

Translate#

def generate(self, strings: List[str], to_lang: str = 'ms', **kwargs):
    """
    Generate texts from the input.

    Parameters
    ----------
    strings : List[str]
    to_lang: str, optional (default='ms')
        target language to translate.
    **kwargs: vector arguments pass to huggingface `generate` method.
        Read more at https://huggingface.co/docs/transformers/main_classes/text_generation

        If you are using `use_ctranslate2`, vector arguments pass to ctranslate2 `translate_batch` method.
        Read more at https://opennmt.net/CTranslate2/python/ctranslate2.Translator.html?highlight=translate_batch#ctranslate2.Translator.translate_batch

    Returns
    -------
    result: List[str]
    """
[6]:
from pprint import pprint
[7]:
# https://www.sinarharian.com.my/article/89678/BERITA/Politik/Saya-tidak-mahu-sentuh-isu-politik-Muhyiddin

string_news1 = 'TANGKAK - Tan Sri Muhyiddin Yassin berkata, beliau tidak mahu menyentuh mengenai isu politik buat masa ini, sebaliknya mahu menumpukan kepada soal kebajikan rakyat serta usaha merancakkan semula ekonomi negara yang terjejas berikutan pandemik Covid-19. Perdana Menteri menjelaskan perkara itu ketika berucap pada Majlis Bertemu Pemimpin bersama pemimpin masyarakat Dewan Undangan Negeri (DUN) Gambir di Dewan Serbaguna Bukit Gambir hari ini.'
pprint(string_news1)
('TANGKAK - Tan Sri Muhyiddin Yassin berkata, beliau tidak mahu menyentuh '
 'mengenai isu politik buat masa ini, sebaliknya mahu menumpukan kepada soal '
 'kebajikan rakyat serta usaha merancakkan semula ekonomi negara yang terjejas '
 'berikutan pandemik Covid-19. Perdana Menteri menjelaskan perkara itu ketika '
 'berucap pada Majlis Bertemu Pemimpin bersama pemimpin masyarakat Dewan '
 'Undangan Negeri (DUN) Gambir di Dewan Serbaguna Bukit Gambir hari ini.')
[8]:
# https://www.sinarharian.com.my/article/90021/BERITA/Politik/Tun-Mahathir-Anwar-disaran-bersara-untuk-selesai-kemelut-politik

string_news2 = 'ALOR SETAR - Kemelut politik Pakatan Harapan (PH) belum berkesudahan apabila masih gagal memuktamadkan calon Perdana Menteri yang dipersetujui bersama. Ahli Parlimen Sik, Ahmad Tarmizi Sulaiman berkata, sehubungan itu pihaknya mencadangkan mantan Pengerusi Parti Pribumi Bersatu Malaysia (Bersatu), Tun Dr Mahathir Mohamad dan Presiden Parti Keadilan Rakyat (PKR), Datuk Seri Anwar Ibrahim mengundurkan diri daripada politik sebagai jalan penyelesaian.'
pprint(string_news2)
('ALOR SETAR - Kemelut politik Pakatan Harapan (PH) belum berkesudahan apabila '
 'masih gagal memuktamadkan calon Perdana Menteri yang dipersetujui bersama. '
 'Ahli Parlimen Sik, Ahmad Tarmizi Sulaiman berkata, sehubungan itu pihaknya '
 'mencadangkan mantan Pengerusi Parti Pribumi Bersatu Malaysia (Bersatu), Tun '
 'Dr Mahathir Mohamad dan Presiden Parti Keadilan Rakyat (PKR), Datuk Seri '
 'Anwar Ibrahim mengundurkan diri daripada politik sebagai jalan penyelesaian.')
[9]:
string_news3 = 'Menteri Kanan (Kluster Keselamatan) Datuk Seri Ismail Sabri Yaakob berkata, kelonggaran itu diberi berikutan kerajaan menyedari masalah yang dihadapi mereka untuk memperbaharui dokumen itu. Katanya, selain itu, bagi rakyat asing yang pas lawatan sosial tamat semasa Perintah Kawalan Pergerakan (PKP) pula boleh ke pejabat Jabatan Imigresen yang terdekat untuk mendapatkan lanjutan tempoh.'
pprint(string_news3)
('Menteri Kanan (Kluster Keselamatan) Datuk Seri Ismail Sabri Yaakob berkata, '
 'kelonggaran itu diberi berikutan kerajaan menyedari masalah yang dihadapi '
 'mereka untuk memperbaharui dokumen itu. Katanya, selain itu, bagi rakyat '
 'asing yang pas lawatan sosial tamat semasa Perintah Kawalan Pergerakan (PKP) '
 'pula boleh ke pejabat Jabatan Imigresen yang terdekat untuk mendapatkan '
 'lanjutan tempoh.')
[10]:
# https://qcikgubm.blogspot.com/2018/02/contoh-soalan-dan-jawapan-karangan.html

string_karangan = 'Selain itu, pameran kerjaya membantu para pelajar menentukan kerjaya yang akan diceburi oleh mereka. Seperti yang kita ketahui, pasaran kerjaya di Malaysia sangat luas dan masih banyak sektor pekerjaan di negara ini yang masih kosong kerana sukar untuk mencari tenaga kerja yang benar-benar berkelayakan. Sebagai contohnya, sektor perubatan di Malaysia menghadapi masalah kekurangan tenaga kerja yang kritikal, khususnya tenaga pakar disebabkan peletakan jawatan oleh doktor dan pakar perubatan untuk memasuki sektor swasta serta berkembangnya perkhidmatan kesihatan dan perubatan. Setelah menyedari  hakikat ini, para pelajar akan lebih berminat untuk menceburi bidang perubatan kerana pameran kerjaya yang dilaksanakan amat membantu memberikan pengetahuan am tentang kerjaya ini'
pprint(string_karangan)
('Selain itu, pameran kerjaya membantu para pelajar menentukan kerjaya yang '
 'akan diceburi oleh mereka. Seperti yang kita ketahui, pasaran kerjaya di '
 'Malaysia sangat luas dan masih banyak sektor pekerjaan di negara ini yang '
 'masih kosong kerana sukar untuk mencari tenaga kerja yang benar-benar '
 'berkelayakan. Sebagai contohnya, sektor perubatan di Malaysia menghadapi '
 'masalah kekurangan tenaga kerja yang kritikal, khususnya tenaga pakar '
 'disebabkan peletakan jawatan oleh doktor dan pakar perubatan untuk memasuki '
 'sektor swasta serta berkembangnya perkhidmatan kesihatan dan perubatan. '
 'Setelah menyedari  hakikat ini, para pelajar akan lebih berminat untuk '
 'menceburi bidang perubatan kerana pameran kerjaya yang dilaksanakan amat '
 'membantu memberikan pengetahuan am tentang kerjaya ini')
[11]:
%%time

pprint(model.generate([string_news1, string_news2, string_news3, string_karangan],
                      to_lang = 'en', max_length = 1000))
['TANGKAK - Tan Sri Muhyiddin Yassin said he does not want to touch on '
 'political issues for now, but instead wants to focus on the welfare of the '
 "people and efforts to revitalize the country's economy which has been "
 'affected due to the Covid-19 pandemic. The Prime Minister explained the '
 'matter when speaking at the Meeting of Leaders with community leaders of the '
 'Gambir State Legislative Assembly at the Bukit Gambir Multipurpose Hall '
 'today.',
 'ALOR SETAR - The Pakatan Harapan (PH) political turmoil has not ended when '
 'it still failed to finalize the candidate for Prime Minister agreed upon. '
 'Sik Member of Parliament, Ahmad Tarmizi Sulaiman said, in that regard, he '
 'proposed that former Chairman of Parti Pribumi Bersatu Malaysia (Bersatu), '
 'Tun Dr Mahathir Mohamad and Parti Keadilan Rakyat (PKR) President, Datuk '
 'Seri Anwar Ibrahim to withdraw from politics as a solution.',
 'Senior Minister (Security Cluster) Datuk Seri Ismail Sabri Yaakob said that '
 "the relaxation was given following the government's concern to renew the "
 'document. He said, in addition, for foreigners whose social visit pass '
 'expires during the Movement Control Order (MCO) can go to the nearest '
 'Immigration Department office to obtain an extension of the period.',
 'Furthermore, career exhibitions help students determine the career that they '
 'will pursue. As we know, the career market in Malaysia is vast and there are '
 'still many job sectors in the country that are still vacant due to the '
 'difficulty in finding a truly qualified workforce. For example, the medical '
 'sector in Malaysia is facing a critical shortage of workforce, especially '
 'specialist staff due to the resignation of doctors and medical experts to '
 'enter the private sector and the development of health and medical services. '
 'After realizing this fact, students will be more interested in pursuing a '
 'career in the field of medicine as the career exhibitions carried out '
 'greatly help provide general knowledge about this career.']
CPU times: user 3min 5s, sys: 2.44 s, total: 3min 8s
Wall time: 17 s

Able to translate code#

[12]:
s = """
`Untuk menggunakan numpy, pertama, Anda perlu menginstalnya melalui pip. Anda dapat melakukannya dengan menjalankan perintah `pip install numpy` di terminal Anda.
Setelah numpy terinstal, Anda dapat mengimpor modul numpy dengan menambahkan baris `import numpy as np` di awal program Anda.
Berikut adalah contoh beberapa operasi dasar numpy:
``` python
import numpy as np
# membuat array numpy dari list
my_list = [1, 2, 3, 4, 5]
my_array = np.array(my_list)
# membuat array numpy dengan rentang nilai tertentu
my_range = np.arange(0, 10, 2) # nilai awal, nilai akhir, dan loncatan
# membuat array numpy dengan nilai acak
my_random_array = np.random.rand(3, 3) # 3 baris dan 3 kolom
# mengakses elemen array numpy
print(my_array[0]) # mengakses elemen pertama
# melakukan operasi matematika pada array numpy
my_array = my_array + 1 # menambah setiap elemen dengan 1
my_array = my_array * 2 # mengalikan setiap elemen dengan 2
# mengubah bentuk array numpy
my_array = np.reshape(my_array, (2, 5)) # menjadi array 2D dengan 2 baris dan 5 kolom
```
Itulah beberapa operasi dasar numpy. Anda dapat menemukan dokumentasi resmi numpy di https://numpy.org/doc/stable/.
"""

print(model.generate([s], to_lang = 'ms', max_length = 1000)[0])
`Untuk menggunakan numpy, pertama, anda perlu memasangnya melalui pip. Anda boleh lakukannya dengan menjalankan perintah `pip install numpy` di terminal anda.
Selepas numpy dipasang, anda boleh import modul numpy dengan menambah baris `import numpy as np` pada permulaan program anda.
Berikut adalah contoh beberapa operasi asas numpy:
``` python
import numpy as np
# buat array numpy dari senarai
my_list = [1, 2, 3, 4, 5]
my_array = np.array(my_list)
# buat array numpy dengan julat nilai tertentu
my_range = np.arange(0, 10, 2) # nilai awal, nilai akhir, dan lompatan
# buat array numpy dengan nilai rawak
my_random_array = np.random.rand(3, 3) # 3 baris dan 3 lajur
# akses elemen array numpy
print(my_array[0]) # akses elemen pertama
# lakukan operasi matematik pada array numpy
my_array = my_array + 1 # tambah setiap elemen dengan 1
my_array = my_array * 2 # darab setiap elemen dengan 2
# ubah bentuk array numpy
my_array = np.reshape(my_array, (2, 5)) # menjadi array 2D dengan 2 baris dan 5 lajur
```
Itulah beberapa operasi asas numpy. Anda boleh cari dokumentasi rasmi numpy di https://numpy.org/doc/stable/.

Able to maintain input structure#

[13]:
s = """
\n26 DR.27.10.2021 \n\n \nUSUL MENANGGUHKAN MESYUARAT  \n\nDI BAWAH P.M. 18(1) \n \n\nPENJUALAN ASET GAS PETRONAS DI AZERBAIJAN \n\n \n\n11.33 pg. \n\nDato’ Seri Anwar bin Ibrahim [Port Dickson]: Tuan Yang di-Pertua, saya \nmohon mengemukakan usul di bawah Peraturan Mesyuarat 18(1) dan 18(2) Peraturan-\nperaturan Majlis Mesyuarat Dewan Rakyat seperti berikut: \n\n“Bahawa Dewan yang bersidang pada hari ini merundingkan \nlaporan bahawa Petronas telah menjual aset gas di Azerbaijan dengan \nharga hampir RM10 bilion berikutan desakan kerajaan menaikkan \nbayaran dividen Petronas sebanyak RM25 bilion kepada kerajaan bagi \ntahun 2021.” \n\n \nPerkara ini adalah perkara tertentu kerana penjualan aset gas di Azerbaijan \n\nbernilai RM10 bilion dan juga pembayaran dividen kepada kerajaan sebanyak RM25 bilion \nbagi tahun 2021 adalah berbahaya dan menjejaskan masa depan Petronas. Terkait \ndengan― sedikit penjelasan.  Kerana tindakan seperti ini telah menyebabkan J.P. Morgan \nmengeluarkan Petronas dari ESG Emerging Market Bond Index dan ESG Asia Credit \nIndex.  \n\nOleh itu, perkara itu perlu disegerakan kerana Petronas mengalami defisit \nberikutan pembayaran dividen berlebihan sejak tahun 2018 sehingga kini yang memaksa \nPetronas menjual aset atau meminjam lebih banyak dana luar negara bagi menampung \naliran tunai.   \n\nIni diperkukuh dengan kenyataan Tengku Muhammad Taufik, CEO Petronas, “If \nthere is a policy shift but it comes too suddenly or too slowly, not only Petronas but the \nentire Malaysian economy could be put at risk, with regards to our energy mix.” \n\nIni perkara berkenaan dengan kepentingan orang ramai, malah seluruh ekonomi \nnegara, kerana Petronas adalah institusi penting ekonomi negara dan sewajarnya \ndiperkukuh kekuatannya dan tidak dilemahkan penarafan syarikat. Kemampuan untuk \nmelabur bagi menjana keuntungan masa depan yang mampu untuk membayar dividen \nyang munasabah kepada kerajaan demi kepentingan rakyat. Dengan tambahan RM7 \nbilion tahun ini, hasil Petronas akan berjumlah RM44.8 bilion atau 18 peratus daripada \npendapatan kerajaan bagi tahun 2021 daripada RM37.8 bilion sebelumnya. \n\nJadi, mohon persetujuan Tuan Yang di-Pertua untuk dibahaskan. [Tepuk] \n\nTuan Yang di-Pertua: Terima kasih Yang Berhormat. Sebenarnya Yang \nBerhormat perlu melengkapkan teks Yang Berhormat dan cuma dibaca teks tersebut \nmengikut peraturan. Akan tetapi, tak apa.  \n\nAhli-ahli Yang Berhormat, saya telah menerima satu pemberitahu usul di bawah \nPeraturan Mesyuarat 18(1) oleh Yang Berhormat Port Dickson, Ketua Pembangkang pada \nhari Isnin, 25 Oktober 2021. Teks usul itu adalah seperti yang dibacakan tadi dengan \nsedikit tambahan oleh Ahli Yang Berhormat Port Dickson sebentar tadi.  \n\nBagi membolehkan perkara ini ditimbangkan oleh Majlis Mesyuarat, saya \nhendaklah berpuas hati bahawa perkara yang dibangkitkan oleh Yang Berhormat itu \nmematuhi tiga syarat seperti mana biasalah iaitu: \n\n(i) perkara tertentu; \n\n(ii) bagi kepentingan orang ramai; dan \n\n(iii) berkehendak disegerakan. \n\n\n
"""
print(model.generate([s], to_lang = 'en', max_length = 1000)[0])
26 DR. 27.10.2021


MOTION TO ADJOURN THE MEETING

UNDER P.M. 18(1)


PETRONAS GAS ASSET SALE IN AZERBAIJAN



11.33 a.m.

Dato' Seri Anwar bin Ibrahim [Port Dickson]: Mr. Speaker, I am
please submit a motion under Meeting Rules 18(1) and 18(2) Regulations-
 Rules of the Dewan Rakyat Meeting as follows:

"That the House in session today negotiated
report that Petronas has sold gas assets in Azerbaijan with
price almost RM10 billion following the government's insistence on raising
Petronas dividend payment of RM25 billion to the government for
year 2021.”


This is a certain matter because of the sale of gas assets in Azerbaijan

worth RM10 billion and also dividend payments to the government amounting to RM25 billion
for 2021 is dangerous and affects Petronas' future. Related
with a little explanation. Because actions like this have caused J.P. Morgan
issued Petronas from ESG Emerging Market Bond Index and ESG Asia Credit
Index.

Therefore, the matter needs to be expedited because Petronas is experiencing a deficit
following excessive dividend payments since 2018 until now that are forced
Petronas sells assets or borrows more foreign funds to cover
cash flow.

This is reinforced by the statement of Tengku Muhammad Taufik, CEO of Petronas, "If
there is a policy shift but it comes too suddenly or too slowly, not only Petronas but the
entire Malaysian economy could be put at risk, with regards to our energy mix.”

This is related to the interests of the public, even the rest of the economy
country, because Petronas is an important institution of the country's economy and accordingly
strengthened its strength and not weakened by the company's rating. Ability to
invest to generate future profits that are able to pay dividends
which is reasonable to the government for the benefit of the people. With an additional RM7
billion this year, Petronas' revenue will amount to RM44.8 billion or 18 percent of
government revenue for 2021 from RM37.8 billion previously.

So, please get the President's approval to be debated. [Applause]

Mr. Speaker: Thank you, Your Honor. Actually Yang
Honorable to complete the honorable text and only read the text
according to the rules. However, it's okay.

Honorable members, I have received a notice of the motion below
Meeting Rule 18(1) by Yang Berhormat Port Dickson, Leader of the Opposition on
Monday, October 25, 2021. The text of the motion is as read earlier with
a little extra by the Honorable Member of Port Dickson just now.

To allow this matter to be considered by the Council of Ministers, I
should be satisfied that the matter raised by the Honorable
comply with three conditions as usual, namely:

(i) certain things;

(ii) for the interests of the public; and

(iii) want to be expedited.

Able to translate indonesian, banjarese and javanese#

[14]:
s1 = 'Kita ora duwe wektu kanggo gelut utawa sengit.'
s2 = 'Tiga dekade kemudian area sekolah diperluas.'
s3 = 'Maklum haja lah muntung guri wadi kawa haja dipisiti, amun muntung manusia siapang nang hingkat manduga.'
[15]:
pprint(model.generate([s1, s2, s3], to_lang = 'en', max_length = 1000))
["We don't have time to fight or be fierce.",
 'Three decades later the school area was expanded.',
 "It's understandable that the people are not ready to be in a bad mood, but "
 'the people are not ready to be in a bad mood.']
[16]:
pprint(model.generate([s1, s2, s3], to_lang = 'ms', max_length = 1000))
['Kita tidak sempat untuk bertarung atau membenci.',
 'Tiga dekad kemudian kawasan sekolah telah diperluaskan.',
 '"Anda tahu bahawa anda hanya perlu memikirkan perkara yang tidak perlu, '
 'tetapi jika anda tidak mahu orang lain yang tidak tahu apa yang perlu '
 'dilakukan."']

Noisy malay#

[17]:
strings = [
    'ak tak paham la',
    'Hi guys! I noticed semalam & harini dah ramai yang dapat cookies ni kan. So harini i nak share some post mortem of our first batch:',
    "Memanglah. Ini tak payah expert, aku pun tau. It's a gesture, bodoh.",
    'jam 8 di pasar KK memang org ramai 😂, pandai dia pilih tmpt.',
    'Jadi haram jadah😀😃🤭',
    'nak gi mana tuu',
    'Macam nak ambil half day',
    "Bayangkan PH dan menang pru-14. Pastu macam-macam pintu belakang ada. Last-last Ismail Sabri naik. That's why I don't give a fk about politics anymore. Sumpah dah fk up dah.",
    'mesolitica boleh buat asr tak',
]
[18]:
%%time

pprint(model.generate(strings, to_lang = 'ms', max_length = 1000))
['Saya tidak faham',
 'Hi guys! Saya perasan semalam dan hari ini ramai yang dapat cookies ni kan. '
 'Jadi hari ini saya ingin berkongsi beberapa post mortem dari batch pertama '
 'kami:',
 'Memanglah. Ini tidak perlu pakar, saya juga tahu. Ini adalah isyarat, bodoh.',
 'Jam 8 di pasar KK memang ramai orang 😂, pandai dia pilih tempat.',
 'Jadi haram jadah 😀😃🤭',
 'Ke mana kamu pergi?',
 'Saya ingin mengambil separuh hari',
 'Bayangkan PH dan menang dalam PRU-14. Kemudian terdapat pelbagai pintu '
 'belakang. Akhirnya, Ismail Sabri naik. Itulah sebabnya saya tidak lagi '
 'peduli tentang politik. Saya bersumpah saya sudah pergi.',
 'Bolehkah mesolitica digunakan untuk membuat asr?']
CPU times: user 50.4 s, sys: 48.9 ms, total: 50.4 s
Wall time: 4.84 s
[19]:
%%time

pprint(model.generate(strings, to_lang = 'en', max_length = 1000))
["I don't understand",
 'Hi guys! I noticed that many people have received cookies yesterday and '
 'today. So today I want to share some post mortem of our first batch:',
 "Indeed. No need for an expert, I know. It's a gesture, stupid.",
 "At 8 o'clock in the KK market, it's crowded 😂, he's clever in choosing a "
 'place.',
 "So it's illegal😀😃🤭",
 'Where are you going?',
 'How to take half a day',
 'Imagine PH and winning the 14th general election. Then there are all sorts '
 "of backgazes. In the end, Ismail Sabri got in. That's why I don't care about "
 "politics anymore. I swear I'm already fucked up.",
 'Can the mesolitica make Asr?']
CPU times: user 1min 26s, sys: 267 ms, total: 1min 27s
Wall time: 8.38 s

Manglish#

[20]:
strings = [
    'i know plenty of people who snack on sambal ikan bilis.',
    'I often visualize my own programs algorithm before implemment it.',
    'Am I the only one who used their given name ever since I was a kid?',
    'Gotta be wary of pimples. Oh they bleed bad when cut',
    'Smh the dude literally has a rubbish bin infront of his house',
    "I think I won't be able to catch it within 1 min lol"
]
[21]:
%%time

pprint(model.generate(strings, to_lang = 'ms', max_length = 1000))
['Saya kenal ramai orang yang makan sambal ikan bilis.',
 'Saya sering memvisualisasikan algoritma program saya sendiri sebelum '
 'mengimplemmennya.',
 'Adakah saya seorang sahaja yang menggunakan nama mereka sejak saya masih '
 'kecil?',
 'Kena berhati-hati dengan jerawat. Oh, mereka berdarah teruk apabila dipotong',
 'Sial, lelaki itu benar-benar mempunyai tong sampah di depan rumahnya.',
 'Saya rasa saya tidak akan dapat menangkapnya dalam masa 1 minit lol']
CPU times: user 9.66 s, sys: 4.09 ms, total: 9.66 s
Wall time: 883 ms

Able to translate Mandarin and local Mandarin#

[22]:
s1 = """
2023年了,依然还存在有很多封建的父母。来聊聊你所遇到的 奇奇怪怪的限制
以及 男与女不同对待 程度

已嫁女儿 不能回娘家吃团圆饭,不可以拜天公,不可以扫墓
红包 外孙 内孙 数目不一
可是 有事情,都是找女儿
"""
s2 = """
在選購外套時,防水功能成為了許多人關注的重點之一。極度乾燥外套以其卓越的防水性能和時尚設計,成為了眾多顧客的首選。讓我們來探討一下 極度乾燥 外套的防水技術,以及如何確保你在任何天氣下都能保持乾爽舒適。
Superdry 外套 防水高效的防水技術
"""
[23]:
pprint(model.generate([s1, s2], to_lang = 'en', max_length = 1000))
["It has been 2023, and there are still many principled parents. Let's chat "
 'about the strange restrictions you encountered, and the level of treatment '
 'between men and women. If you marry your daughter, you cannot go back to the '
 "mother's house for a round trip, you cannot worship the gods, you cannot "
 'clean up the grave. The red envelope, the outside grandson, and the inner '
 'grandson, are not the same. However, when there is something, you can always '
 'look for your daughter.',
 'When choosing a pair of shoes, waterproofing is one of the focus of many '
 'people. The highly selesa air conditioning shoes are a popular choice for '
 "many customers. Let's explore the highly selesa waterproofing and "
 'waterproofing technology for the highly selesa waterproofing and safety of '
 'your shoes. Superdry is a high-quality waterproofing and waterproofing '
 'technology.']
[24]:
pprint(model.generate([s1, s2], to_lang = 'ms', max_length = 1000))
['Sejak tahun 2023, masih banyak ibu bapa yang berdedikasi. Mari kita '
 'berbincang tentang batasan aneh yang anda hadapi dan tahap perlakuan yang '
 'berbeza antara lelaki dan perempuan.\n'
 '\n'
 'Sudah berkahwin dengan anak perempuan, tidak boleh pulang ke rumah ibu untuk '
 'makan jamuan, tidak boleh menyembah tuhan, tidak boleh menyapu kubur, dan '
 'tidak boleh menyapu kubur.\n'
 '\n'
 'Bungkusan merah, anak luar, anak luar, jumlah tidak sama.\n'
 '\n'
 'Tetapi jika ada sesuatu, semuanya akan mencari anak perempuan.',
 'Apabila memilih jaket, fungsi pertahanan air menjadi salah satu fokus utama '
 'ramai orang. Jaket yang sangat menyejukkan dengan prestasi dan penampilan '
 'yang cemerlang dalam pertahanan air, menjadi pilihan utama ramai pelanggan. '
 'Mari kita kunjungi teknologi pertahanan air yang sangat menyejukkan dan '
 'memastikan anda sentiasa selesa dan selesa di mana-mana cuaca. Jaket Super '
 'Dry teknologi pertahanan air yang cekap.']
[ ]: