Skip to content

Commit

Permalink
Merge pull request #164 from kwonoj/feat-add-dic
Browse files Browse the repository at this point in the history
feat(hunspellloader): support add dic interface
  • Loading branch information
kwonoj authored Nov 2, 2018
2 parents 68e9a0c + 4f87b40 commit 1a0d417
Show file tree
Hide file tree
Showing 13 changed files with 372 additions and 299 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
<a name="2.0.0-beta.2"></a>
# [2.0.0-beta.2](https://github.com/kwonoj/hunspell-asm/compare/v2.0.0-beta.1...v2.0.0-beta.2) (2018-11-02)


### Bug Fixes

* **allocstring:** use emscripten method, explicitly free ([09a1a56](https://github.com/kwonoj/hunspell-asm/commit/09a1a56))


### Features

* **hunspell:** update interfaces ([c937dec](https://github.com/kwonoj/hunspell-asm/commit/c937dec))
* **hunspellloader:** implement addword interfaces ([9a56a35](https://github.com/kwonoj/hunspell-asm/commit/9a56a35))
* **wraphunspellinterface:** expose add interfaces ([73e5d1c](https://github.com/kwonoj/hunspell-asm/commit/73e5d1c))



<a name="2.0.0-beta.1"></a>
# [2.0.0-beta.1](https://github.com/kwonoj/hunspell-asm/compare/v1.1.2...v2.0.0-beta.1) (2018-11-01)

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ create(affPath: string, dictPath: string): Hunspell

There are simple [examples](https://github.com/kwonoj/hunspell-asm/tree/e0e421fda667fb0d4888a4e0b21877e95540c29c/examples) for each environments using different apis. In each example directory do `npm install && npm start`.

## Adding words to dictionary in runtime

Hunspell exposes few interfaces allow to add words, or dictionaries in existing dictionary in runtime. This is **runtime** behavior, so it doesn't persist over once instance is disposed.

- `addWord(word: string): void` : add single word to current dictionary.
- `removeWord(word: string): void` : remove single word from current dictionary.
- `addWordWithAffix(word: string, affix: string): void`: add word with example word having affix flag to be applied. Second param `affix` is example word, should exists in current dictionary with its own affix flag. Newly added word will have same affix rule as example word.
- `addDictionary(dictPath): boolean` : Load addtional dictionary into existing hunspell instance. This cannot load additional affi
x. If function returns false, it means internal slot hunspell manages are full and can't add additional dictionaries.

## Things to note

- Ensure all inputs (aff, dic, word for spell / suggest) are UTF-8 encoded correctly. While hunspell itself supports other encodings, all surrounding interfaces passing buffers are plain javascript doesn't detect / converts encodings automatically.
Expand Down
158 changes: 35 additions & 123 deletions examples/node_buffer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions examples/node_buffer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"version": "1.0.0",
"description": "",
"scripts": {
"start": "ts-node index.ts"
"start": "ts-node -T index.ts"
},
"author": "OJ Kwon <kwon.ohjoong@gmail.com>",
"license": "MIT",
"devDependencies": {
"ts-node": "^3.2.1",
"typescript": "^2.4.2"
"ts-node": "^7.0.1",
"typescript": "^3.1.6"
}
}
Loading

0 comments on commit 1a0d417

Please sign in to comment.