-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from laymonage/0.3-rewrite
Rilis 0.3.0
- Loading branch information
Showing
9 changed files
with
663 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.vscode/ | ||
**__pycache__/ | ||
build/ | ||
dist/ | ||
kbbi.egg-info/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[[source]] | ||
name = "pypi" | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
|
||
[dev-packages] | ||
pylint = "*" | ||
|
||
[packages] | ||
requests = "*" | ||
beautifulsoup4 = "*" | ||
|
||
[requires] | ||
python_version = "3.7" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,131 @@ | ||
# [WIP] kbbi-python | ||
|
||
Modul Python untuk mengambil entri sebuah kata/frase dalam KBBI Daring | ||
(https://kbbi.kemdikbud.go.id). | ||
# kbbi-python | ||
|
||
Modul Python untuk mengambil sebuah laman untuk kata/frasa dalam [KBBI Daring][kbbi]. | ||
|
||
## Instalasi | ||
|
||
### Melalui pip | ||
|
||
```bash | ||
$ pip install kbbi | ||
pip install kbbi | ||
``` | ||
|
||
|
||
### Manual | ||
|
||
- Clone repositori ini atau unduh kbbi.py | ||
- Letakkan kbbi.py dalam direktori yang Anda inginkan | ||
|
||
1. Lakukan instalasi untuk paket-paket prasyarat ([`requests`][requests] | ||
dan [`BeautifulSoup4`][beautifulsoup4]). | ||
2. Klonakan repositori ini atau unduh [`kbbi.py`][kbbi-py]. | ||
3. Letakkan `kbbi.py` dalam direktori yang Anda inginkan. | ||
|
||
## Penggunaan | ||
|
||
```bash | ||
$ python | ||
``` | ||
Buat objek `KBBI` baru (contoh: `kata = KBBI('kata kunci')`), lalu manfaatkan | ||
representasi `str`-nya dengan memanggil `str(kata)` atau ambil `dict` hasil | ||
serialisasinya dengan memanggil `kata.serialisasi()`. | ||
|
||
Untuk lebih jelasnya, lihat contoh berikut. | ||
|
||
```python | ||
>>> from kbbi import KBBI | ||
>>> cinta = KBBI('cinta') | ||
>>> print(cinta) | ||
cin.ta | ||
1. (a) suka sekali; sayang benar: orang tuaku -- kepada kami semua; -- kepada sesama makhluk | ||
2. (a) kasih sekali; terpikat (antara laki-laki dan perempuan): sebenarnya dia tidak -- kepada lelaki itu, tetapi hanya menginginkan hartanya | ||
3. (a) ingin sekali; berharap sekali; rindu: makin ditindas makin terasa betapa --nya akan kemerdekaan | ||
4. (a) (kl) susah hati (khawatir); risau: tiada terperikan lagi --nya ditinggalkan ayahnya itu | ||
``` | ||
```text | ||
(a) suka sekali; sayang benar | ||
(a) kasih sekali; terpikat (antara laki-laki dan perempuan) | ||
(a) ingin sekali; berharap sekali; rindu | ||
(a kl) susah hati (khawatir); risau | ||
``` | ||
|
||
```python | ||
>>> for setiap in cinta.arti_contoh: | ||
>>> print(setiap) | ||
``` | ||
```text | ||
(a) suka sekali; sayang benar: orang tuaku -- kepada kami semua; -- kepada sesama makhluk | ||
(a) kasih sekali; terpikat (antara laki-laki dan perempuan): sebenarnya dia tidak -- kepada lelaki itu, tetapi hanya menginginkan hartanya | ||
(a) ingin sekali; berharap sekali; rindu: makin ditindas makin terasa betapa --nya akan kemerdekaan | ||
(a kl) susah hati (khawatir); risau: tiada terperikan lagi --nya ditinggalkan ayahnya itu | ||
>>> kata = KBBI('taksir') | ||
>>> print(kata) | ||
tak.sir [1] | ||
(n) kira-kira; hitungan (kasar) | ||
|
||
tak.sir [2] | ||
1. (a) (Ar) tidak mengindahkan; lalai; alpa | ||
2. (n) (Ar) kelalaian; kealpaan | ||
>>> import json | ||
>>> print(json.dumps(kata.serialisasi(), indent=2)) | ||
{ | ||
"taksir": [ | ||
{ | ||
"nama": "tak.sir", | ||
"nomor": "1", | ||
"kata_dasar": [], | ||
"pelafalan": "", | ||
"bentuk_tidak_baku": [], | ||
"varian": [], | ||
"makna": [ | ||
{ | ||
"kelas": { | ||
"n": "Nomina: kata benda" | ||
}, | ||
"submakna": [ | ||
"kira-kira", | ||
"hitungan (kasar)" | ||
], | ||
"contoh": [] | ||
} | ||
] | ||
}, | ||
{ | ||
"nama": "tak.sir", | ||
"nomor": "2", | ||
"kata_dasar": [], | ||
"pelafalan": "", | ||
"bentuk_tidak_baku": [], | ||
"varian": [], | ||
"makna": [ | ||
{ | ||
"kelas": { | ||
"a": "Adjektiva: kata yang menjelaskan nomina atau pronomina", | ||
"Ar": "Arab: -" | ||
}, | ||
"submakna": [ | ||
"tidak mengindahkan", | ||
"lalai", | ||
"alpa" | ||
], | ||
"contoh": [] | ||
}, | ||
{ | ||
"kelas": { | ||
"n": "Nomina: kata benda", | ||
"Ar": "Arab: -" | ||
}, | ||
"submakna": [ | ||
"kelalaian", | ||
"kealpaan" | ||
], | ||
"contoh": [] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## Lisensi | ||
|
||
Proyek ini didistribusikan dengan lisensi [MIT][license]. | ||
|
||
## Penafian | ||
|
||
Proyek ini merupakan proyek pribadi yang didasari oleh rasa cinta kepada | ||
bahasa Indonesia dan bahasa pemrograman Python. Proyek ini bertujuan untuk | ||
memudahkan akses ke KBBI daring tanpa menggunakan peramban web. Proyek ini | ||
tidak dimaksudkan untuk menyalahi [hak cipta KBBI daring][hukum]. Proyek ini | ||
dan pengembangnya tidak berafiliasi dengan | ||
[Badan Bahasa Kemdikbud][badan-bahasa] maupun | ||
[Python Software Foundation][psf]. Pengembang tidak bertanggung jawab atas | ||
penyalahgunaan yang mungkin muncul dari proyek ini. | ||
|
||
[kbbi]: https://kbbi.kemdikbud.go.id | ||
[requests]: https://pypi.org/project/requests | ||
[beautifulsoup4]: https://pypi.org/project/requests/beautifulsoup4 | ||
[kbbi-py]: kbbi/kbbi.py | ||
[license]: LICENSE | ||
[hukum]: https://kbbi.kemdikbud.go.id/Beranda/Hukum | ||
[badan-bahasa]: http://badanbahasa.kemdikbud.go.id | ||
[psf]: https://www.python.org/psf |
Oops, something went wrong.