Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
damzaky authored Mar 11, 2024
1 parent 695ed5d commit e06aaa0
Showing 1 changed file with 29 additions and 20 deletions.
49 changes: 29 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,40 +28,49 @@ Untuk node.js
npm install sastrawijs
```

Lalu di dalam file
## Import

### ECMAScript

```javascript
import { Stemmer, Tokenizer } from 'sastrawijs'
```

### CommonJS
```javascript
var sastrawi = require("sastrawijs");
var sastrawijs = require('sastrawijs');
```

## Contoh Penggunaan

Web/client
### ECMAScript

```javascript
var sentence =
"Perekonomian Indonesia sedang dalam pertumbuhan yang membanggakan";
var stemmed = [];
var stemmer = new Stemmer();
var tokenizer = new Tokenizer();
words = tokenizer.tokenize(sentence);
for (word of words) {
stemmed.push(stemmer.stem(word));
const sentence = 'Perekonomian Indonesia sedang dalam pertumbuhan yang membanggakan'
const stemmed = []

const stemmer = new Stemmer()
const tokenizer = new Tokenizer()
const words = tokenizer.tokenize(sentence)

for (const word of words) {
stemmed.push(stemmer.stem(word))
}
console.log(stemmed);
```

Node
### CommonJS

```javascript
var sentence =
"Perekonomian Indonesia sedang dalam pertumbuhan yang membanggakan";
var stemmed = [];
var stemmer = new sastrawi.Stemmer();
var tokenizer = new sastrawi.Tokenizer();
words = tokenizer.tokenize(sentence);
for (word of words) {
stemmed.push(stemmer.stem(word));
const sentence = 'Perekonomian Indonesia sedang dalam pertumbuhan yang membanggakan'
const stemmed = []

const stemmer = new sastrawijs.Stemmer()
const tokenizer = new sastrawijs.Tokenizer()
const words = tokenizer.tokenize(sentence)

for (const word of words) {
stemmed.push(stemmer.stem(word))
}
console.log(stemmed);
```
Expand Down

0 comments on commit e06aaa0

Please sign in to comment.