Skip to content

Commit

Permalink
Tambahkan kemungkinan adanya info
Browse files Browse the repository at this point in the history
misal: nama latin
  • Loading branch information
laymonage committed Apr 17, 2019
1 parent 3b108db commit ea20a0b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kbbi/kbbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ def _init_kelas(self, makna_label):

kelas = makna_label.find(color='red')
lain = makna_label.find(color='darkgreen')
info = makna_label.find(color='green')
if kelas:
kelas = kelas.find_all('span')
if lain:
Expand All @@ -251,6 +252,7 @@ def _init_kelas(self, makna_label):
self.kelas = {
k.text.strip(): k['title'].strip() for k in kelas
} if kelas else {}
self.info = info.text.strip() if info else ''

def _init_contoh(self, makna_label):
"""Memproses contoh yang ada dalam makna.
Expand All @@ -276,6 +278,7 @@ def serialisasi(self):
return {
"kelas": self.kelas,
"submakna": self.submakna,
"info": self.info,
"contoh": self.contoh
}

Expand Down Expand Up @@ -306,6 +309,7 @@ def _contoh(self):
def __str__(self):
hasil = self._kelas() + ' ' if self.kelas else ''
hasil += self._submakna()
hasil += ' ' + self.info if self.info else ''
hasil += ': ' + self._contoh() if self.contoh else ''
return hasil

Expand Down

0 comments on commit ea20a0b

Please sign in to comment.