Comments (5)
Hi @callodacity,
Actually, Hunspell does support this! Check out the Morphological analysis section in the hunspell docs.
Here's the example from the hunspell docs, but it uses nodehun
:
var affbuf = Buffer.from(`SET UTF-8\nTRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ\nSFX X Y 1\nSFX X 0 able . ds:able`)
var dictbuf = Buffer.from(`1\ndrink/X po:verb`)
var dict = new nodehun(affbuf,dictbuf);
console.log(dict.analyzeSync('drink')) // [ ' st:drink po:verb' ]
console.log(dict.analyzeSync('drinkable')) // [ ' st:drink po:verb ds:able' ]
from nodehun.
@Wulf thanks for the response!
Do I need a special dictionary to get that data? This is what I'm getting now:
const nodehun = require('nodehun');
const loadDict = require('dictionary-en-au');
loadDict(function (err, data) {
if (err) throw err;
const dict = new nodehun(data.aff, data.dic);
console.log(dict.analyzeSync('drink')) // [ ' st:drink' ]
console.log(dict.analyzeSync('drinkable')) // [ ' st:drinkable', ' st:drink fl:B' ]
});
As you can see I'm not getting the "po:verb"
part from analyze
.
I've also tried it with dictionary-en-us
and some others from wooorm/dictionaries but I don't seem to get that information.
I also have no idea what the "fl:B"
part of the data returned is, either.
from nodehun.
Uh-huh, you need a dictionary which contains all the metadata defining whatever you need.
fl:B
just indicates that the word is flagged with B. Glance over the "Twofold suffix stripping" example in the hunspell docs - notice how the drink
entry in the dictionary file has the flag X
? (drink/X
).
from nodehun.
Perfect. Thank you so much for your help
from nodehun.
@callodacity I was looking through the examples/dictionaries/ folder, and it seems verbs in past tense are tagged with Vd
, and nouns are tagged with Ns
(in the affix file). The commit history suggests they've come from LibreOffice (though I can't seem to find anything but this). You might have some luck there!
All the best :)
from nodehun.
Related Issues (20)
- Does not work from ESM HOT 1
- Can't install nodehun with node 11.11.0 HOT 5
- Add TypeScript bindings HOT 1
- Can't install nodehun with node 10.16.2 HOT 2
- Git clone with submodules failed HOT 2
- node-v12.13.0 error HOT 17
- Publish Nodehun v3
- Suggestions for emojis
- Segfault on suggestion HOT 1
- Nodehun and Hunspell produce different results HOT 2
- [ERROR] TypeError: cannot use a string pattern on a bytes-like object HOT 1
- nodehun fails to build
- Chrome extension: Nodehun in webpack HOT 6
- Dumping all known words HOT 1
- Hunspell GPL license HOT 2
- nodehun with electron jenkins build error HOT 2
- React app canΒ΄t find module HOT 2
- What version of Hunspell is used here? HOT 6
- Library don't works inside docker container
- App crashes in docker container HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodehun.