Skip to content

Commit ba6ea25

Browse files
authored
Merge pull request #7 from PyThaiNLP/dev
Update from PyThaiNLP origin
2 parents 4b108ec + a07a7fd commit ba6ea25

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ We use the famous [gitflow](http://nvie.com/posts/a-successful-git-branching-mod
3232
[GitHub issue system](https://github.com/PyThaiNLP/pythainlp/));
3333
- Run all tests before pushing (just execute `tox`) so you will know if your
3434
changes broke something;
35+
- All source code and all text files should be ended with one empty line. This is [to please git](https://stackoverflow.com/questions/5813311/no-newline-at-end-of-file#5813359) and also [to keep up with POSIX standard](https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline).
3536

3637

3738
# Discussion

pythainlp/tokenize/etcc.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,4 @@ def etcc(text):
115115
ii = re.sub("/", "", i)
116116
text = re.sub(i, ii + "/", text)
117117

118-
return re.sub("//", "/", text)
119-
120-
121-
if __name__ == "__main__":
122-
print(etcc("พันธุ์เด็กเปียเสือเงินพังมือเพราะเกาะเอาะยีนส์เพราะเรือดีเพราะ"))
118+
return re.sub("//", "/", text)

pythainlp/tokenize/tcc.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,4 @@ def tcc_pos(text):
6969

7070

7171
def tcc(w, sep="/"):
72-
return sep.join(tcc_gen(w))
73-
74-
75-
if __name__ == "__main__":
76-
print(tcc("แมวกิน"))
77-
print(tcc("ประชาชน"))
78-
print(tcc("ขุดหลุม"))
79-
print(tcc("ยินดี"))
72+
return sep.join(tcc_gen(w))

requirements-travis.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
pyicu==1.9.3
2-
nltk>=3.2.2
3-
future>=0.16.0
4-
marisa_trie
5-
langdetect
6-
requests
1+
conllu
72
dill
3+
langdetect
4+
marisa_trie
5+
nltk>=3.2.2
6+
pyicu==1.9.3
87
pytz
9-
conllu
8+
requests
109
tinydb
1110
tqdm

requirements.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
nltk>=3.2.2
2-
future>=0.16.0
3-
marisa_trie
4-
requests
1+
conllu
52
dill
3+
marisa_trie
4+
nltk>=3.2.2
65
pytz
7-
conllu
6+
requests
87
tinydb
98
tqdm

tests/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
from pythainlp.change import texttoeng, texttothai
77
from pythainlp.collation import collation
8+
from pythainlp.corpus.conceptnet import edges
9+
from pythainlp.corpus.tnc import get_word_frequency_all
810
from pythainlp.corpus import (
911
alphabet,
1012
country,
@@ -14,6 +16,7 @@
1416
thaiword,
1517
tone,
1618
wordnet,
19+
ttc
1720
)
1821
from pythainlp.date import now, reign_year_to_ad, now_reign_year
1922
from pythainlp.keywords import find_keyword
@@ -151,6 +154,15 @@ def test_stopword(self):
151154
def test_spell(self):
152155
self.assertIsNotNone(spell("เน้ร"))
153156

157+
def test_conceptnet(self):
158+
self.assertIsNotNone(edges("รัก"))
159+
160+
def test_tnc(self):
161+
self.assertIsNotNone(get_word_frequency_all())
162+
163+
def test_ttc(self):
164+
self.assertIsNotNone(ttc.get_word_frequency_all())
165+
154166
def test_date(self):
155167
self.assertIsNotNone(now())
156168
self.assertEqual(reign_year_to_ad(2, 10), 2017)

0 commit comments

Comments
 (0)