Akarata is a JavaScript library to retrieve the root / syllable root (stem) from word stem that does have a prefix in front of the word or suffix at the end of the word in Indonesian. Akarata is derived from the word "akar kata" in indonesian, for easier pronouncing.
Akarata inspired by stem of word in Indonesian based on Porter Stemmer, using algorithm published in paper A Study of Stemming Effects on Information Retrieval in Bahasa Indonesia, by Fadillah Z Tala.
Akarata created universally, can be run on the server using Node.js
or in the modern browser even inreact-native
. But it should be noted that the compatibility of the platform. Check on Compatibility function
tslib >= 1.9.0
npm:
npm install --save tslib akarata
yarn:
yarn add tslib akarata
Because akarata uses Array.includes. So if you use akarata on Node.js
version 4, browser Edge < v14, IE, Chrome < v47, Firefox < 43, Safari < v9, etc(see table) you need polyfill
. You can jump to this section to include it Include polyfill
Skip this step if platform is supported.
use npm
:
npm i ts-polyfill
use yarn
:
yarn add ts-polyfill
Import this before you import akarata, usually put it on top.
on node.js:
require('ts-polyfill/lib/es2016-array-include');
on ES2015+ / Babel / TypeScript:
import 'ts-polyfill/lib/es2016-array-include';
If you do not want to install ts-polyfill
and the target is browser only. Then copy the code in the documentation polyfill
<script type="javascript">
// paste code here
<script>
ES2015+ / Babel / TypeScript:
// import library
import * as akarata from 'akarata';
// or
import akarata from 'akarata';
CommonJS/ UMD / NodeJS:
// import library
var akarata = require('akarata');
Michael Jackson script/ MJS / NodeJS experimental-modules
:
// import library
import * as akarata from 'akarata';
// or
import akarata from 'akarata';
unpkg.com
:
// since akarata version > 0.1.5
// unpkg.com/:package@:version/:file
// `.min` means compressed version
// for instance
import * as akarata from 'https://unpkg.com/akarata@0.2.0/bundles/index.esm.js';
// or
import akarata from 'https://unpkg.com/akarata@0.2.0/bundles/index.esm.min.js';
// or with absolute url, fallback to bundles/index.umd.js
import akarata from 'https://unpkg.com/akarata';
// call the stem method
akarata.stem('menikah'); // nikah
Or you can directly try it on this web: akarata.netlify.com.
By cause of this module is still in its development process, submit a ticket if you are facing an issue.
This module is intended to be a Javascript implementation of Apache Lucene's Bahasa Indonesia word stemmer.
- Require Node.js version >= 8.5
- Fork this project
- Create your feature branch (
git checkout -b my-new-feature
) - Make changes and test cases for your feature in
__tests__
directory and runnpm test
- Save your changes and add them (
git add .
) - Commit your changes (
git commit -m 'Added some new feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new pull request
- Great Dictionary of the Indonesian Language
- To look up and verify Indonesian words
- Wikipedia article (in Bahasa) Prefixes in Bahasa Indonesia
First and foremost, I would like to thank to Allah Subhanahu Wa Ta'ala, that without his blessings this project could not be made. I would like to also thank:
- Faidlah Z Tala & Apache Lucene as without them this module could not be made
- Kateglo Bahtera for providing an API so this module could separate ambiguous words and validation.
- Adinda Praditya & Indonesian Stemmer for the great mentorship along with his project, this module could be implemented in JavaScript