Code Monkey home page Code Monkey logo

Comments (5)

Wulf avatar Wulf commented on May 16, 2024

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.

 avatar commented on May 16, 2024

@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.

Wulf avatar Wulf commented on May 16, 2024

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.

 avatar commented on May 16, 2024

Perfect. Thank you so much for your help πŸ‘

from nodehun.

Wulf avatar Wulf commented on May 16, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.