Skip to content

Commit

Permalink
Bump coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
BLKSerene committed Oct 16, 2023
1 parent cf5cf85 commit ab6f9a6
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 10 deletions.
12 changes: 4 additions & 8 deletions laonlp/util/digitconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@
"ເກົ້າ",
"ສູນ"
]
_dict_lao_arabic = {
i: j for i, j in zip(list(NUMBERS), list(_arabic_numerals))
}
_dict_arabic_lao = {
i: j for i, j in zip(list(_arabic_numerals), list(NUMBERS))
}
_dict_lao_arabic = dict(zip(list(NUMBERS), list(_arabic_numerals)))
_dict_arabic_lao = dict(zip(list(_arabic_numerals), list(NUMBERS)))
_lao_arabic_table = str.maketrans(_dict_lao_arabic)
_arabic_lao_table = str.maketrans(_dict_arabic_lao)

Expand All @@ -42,7 +38,7 @@ def lao_digit_to_arabic_digit(text: str) -> str:
"""
Lao digit to Arabic digit
:param str text: lao digit text
:param str text: Lao digit text
:return: returns a string of Arabic digit
:rtype: str
"""
Expand All @@ -62,7 +58,7 @@ def arabic_digit_to_lao_digit(text: str) -> str:

def number2lao(numbers: int):
"""
Numbers to La opronunciation
Numbers to Lao pronunciation
"""
# TODO
return ""
41 changes: 41 additions & 0 deletions tests/test_corpus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-

import unittest
from laonlp.corpus.core import get_path_corpus
from laonlp.corpus.lao_words import lao_dictionary, lao_spellcheckdict, lao_wannaphongdict, lao_wiktionarydict, lao_words, lao_stopwords
from laonlp.corpus.mopt_dict import get_lao_eng, get_eng_lao, get_pronunciation, get_type


class TestCorpusPackage(unittest.TestCase):
def test_get_path_corpus(self):
self.assertIsNotNone(get_path_corpus('test'))

def test_lao_dictionary(self):
self.assertIsNotNone(lao_dictionary())

def test_lao_spellcheckdict(self):
self.assertIsNotNone(lao_spellcheckdict())

def test_lao_wannaphongdict(self):
self.assertIsNotNone(lao_wannaphongdict())

def test_lao_wiktionarydict(self):
self.assertIsNotNone(lao_wiktionarydict())

def test_lao_words(self):
self.assertIsNotNone(lao_words())

def test_lao_stopwords(self):
self.assertIsNotNone(lao_stopwords())

def test_get_lao_eng(self):
self.assertIsNotNone(get_lao_eng())

def test_get_eng_lao(self):
self.assertIsNotNone(get_eng_lao())

def test_get_pronunciation(self):
self.assertIsNotNone(get_pronunciation())

def test_get_type(self):
self.assertIsNotNone(get_type())
4 changes: 2 additions & 2 deletions tests/test_transliterate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def test_lao2thai_script(self):
self.assertIsNotNone(lao2thai_script("ພາສາລາວໃນປັດຈຸບັນ."))

def test_thai2lao_script(self):
self.assertIsNotNone(thai2lao_script("พาสาลาว"))
self.assertIsNotNone(thai2lao_script("พาสาลาว."))

def test_transliterate(self):
self.assertEquals(transliterate("ສະຫວັນນະເຂດ"),"sahvannaekhd")
self.assertEqual(transliterate("ສະຫວັນນະເຂດ"), "sahvannaekhd")
6 changes: 6 additions & 0 deletions tests/test_word_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

class TestTagPackage(unittest.TestCase):
def test_word2vec(self):
self.assertRaises(NotImplementedError, Word2Vec, model="cbow", corpus="unsupported_corpus")
_m0 = Word2Vec(model="cbow")
self.assertRaises(NotImplementedError, _m0.load_model, model="unsupported_model")
self.assertIsNotNone(_m0.get_model())
self.assertIsNotNone(_m0.doesnt_match(['test']))
self.assertIsNotNone(_m0.most_similar_cosmul(['test'], ['test']))
_m1 = Word2Vec(model="cbow")
self.assertIsNotNone(_m1.similarity("ແປດ", "ແພະ"))
_m2 = Word2Vec(model="skip-gram")
Expand Down

0 comments on commit ab6f9a6

Please sign in to comment.