NALAPA
Collection of NodeJS NLP Library for Bahasa Indonesia.
Installation
Install node modules with npm:
npm install --save nalapa
API
Tokenizer
Tokenizer = tokenizer; Tokenizer// ['Hello', 'world', ',', 'my', 'name', 'is', 'Alice', '.', '.', '.'] Tokenizer// [ 'Monday', ',', '(', '1/11', ')', '.', 'I', 'have', '1.000', 'rupiah', '.' ] Tokenizer;/*[ "Hello world, my name is Alice", "I live in Bandung", "Jakarta kebanjiran gara-gara hujan", "tugas kuliah sulit", "Baiklah"]*/ var text = "Seorang remaja berinisal HAS (15) ditangkap aparat Polres Magelang lantaran diduga ..."Tokenizer;/*[ "\"Mereka beraksi siang hari, sekitar pukul 13.00 WIB akhir pekan lalu. Saat itu korban terlihat sendirian,\" kata Zain dalam gelar perkara, Selasa (16/2/2016).", "\"Korban mengenali ponsel yang dipegang saksi adalah miliknya, baru kemudian ia melapor ke Polsek Kajoran. Saksi tersebut mengatakan kalau ponsel tersebut dibeli dari tetangga seharga Rp 250.000,\" papar mantan Kapolsek Metro Tamansari, Jakarta itu.", "\"Kami masih koordinasi dengan pihak terkait apakah pelaku HAS ini akan menjalani diversi atau tidak,\" katanya.", "\"Ponselnya saya jual lagi, uangnya buat bantu mertua yang mau nikah lagi. Saya dulu sales di Sumatera tapi sekarang nganggur,\" ucap bapak dari dua anak ini."]*/
Word
Word = word; // stopwordword // trueword // false // basic word propertiesword // trueword // trueword // trueword // trueword // trueword // trueword // trueword // false // stemmingword // beriword // meong // stemming for prefix, suffix, or confixword // sadapword // minumword // beri
Cleaner
Cleaner = cleaner; Cleaner; /* true */Cleaner; /* true */Cleaner; /* false */ Cleaner; /* true */Cleaner; /* false */Cleaner; /* false */ Cleaner; /* "abc123" */Cleaner; /* "abc_-8+" */Cleaner; /* "" */ Cleaner; /* abc123 */Cleaner; /* abc8 */Cleaner; /* "" */ Cleaner; /* "some long paragraph" */
BIO Label
BIOLabel = BIOLabel; var data = text : 'i eat nasi goreng for breakfast, lunch, and dinner' labels : label : 'food' words : 'nasi goreng' BIOLabellabeldata;/*{ tokens : ['i', 'eat', 'nasi', 'goreng', 'for', 'breakfast', ',', 'lunch', ',', 'and', 'dinner'], labels : [['other'], ['other'], ['b_food'], ['i_food'], ['other'], ['other'], ['other'], ['other'], ['other'], ['other'], ['other']]}*/ var data2 = text : 'i eat nasi goreng at midnight too' labels : label : 'who' words : 'i' label : 'what' words : 'i eat nasi goreng' BIOLabellabeldata2;/*{ tokens : ['i', 'eat', 'nasi', 'goreng', 'at', 'midnight', 'too'], labels : [['b_who', 'b_what'], ['i_what'], ['i_what'], ['i_what'], ['other'], ['other'], ['other']]}*/ var data3 = text : 'if you are reading this, you are reading this' labels : label : 'person' words : 'you' label : 'activity' words : 'you are reading' BIOLabellabeldata3;/*{ tokens: ['if', 'you', 'are', 'reading', 'this', ',', 'you', 'are', 'reading', 'this'], labels: [['other'], ['b_person', 'b_activity'], ['i_activity'], ['i_activity'], ['other'], ['other'], ['b_person', 'b_activity'], ['i_activity'], ['i_activity'], ['other']]}*/ var data4 = text : 'friday, saturday, and sunday morning' labels : label : 'day_name' words : 'friday' 'saturday' 'sunday' label : 'time' words : 'sunday morning' BIOLabellabeldata4;/*{ tokens : [ 'friday', ',', 'saturday', ',', 'and', 'sunday', 'morning' ], labels : [ ['b_day_name'], ['other'], ['b_day_name'], ['other'], ['other'], ['b_day_name', 'b_time'], ['i_time'] ]}*/ // get label from sequence of BIOLabelvar tags = 'other' 'other' 'b_food' 'i_food' 'other' 'other' 'other' 'other' 'other' 'other' 'other' 'b_action' 'i_action' 'i_action' 'i_action' 'other' 'other' 'other'var tokens = 'i' 'eat' 'nasi' 'goreng' 'for' 'breakfast' ',' 'lunch' ',' 'and' 'dinner' 'i' 'eat' 'nasi' 'goreng' 'at' 'midnight' 'too'BIOLabel/*{ food: [ 'nasi goreng' ], action: [ 'i eat nasi goreng' ]}*/
Feature
feature = feature; feature // truefeature // false feature // truefeature // false feature // truefeature // false feature // truefeature // false feature // truefeature // falsefeature // false feature // truefeature // false feature // falsefeature // true feature // truefeature // truefeature // false
Testing
From the repo root:
npm test
License
MIT © Ananta Pandu