Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node.js bindings #181

Closed
tobymarsden opened this issue Jul 21, 2021 · 5 comments
Closed

Node.js bindings #181

tobymarsden opened this issue Jul 21, 2021 · 5 comments

Comments

@tobymarsden
Copy link

Hi @dimus

I put together Node.js bindings for gnparser. My C is worse than my golang so it's... not exactly great for now, but it's dead simple to use and extremely fast: binding to your fabulous shared C library is obviously dramatically more performant than exec'ing to the command line from Node.

Literally just:

const parser = require('gnparser')
const res = parser.parse('Drosera intermedia') // parser.parse(arrayOfStrings) works too
console.log(res)
{
  parsed: true,
  quality: 1,
  verbatim: 'Drosera intermedia',
  normalized: 'Drosera intermedia',
  canonical: {
    stemmed: 'Drosera intermed',
    simple: 'Drosera intermedia',
    full: 'Drosera intermedia'
  },
  cardinality: 2,
  details: { species: { genus: 'Drosera', species: 'intermedia' } },
  words: [
    {
      verbatim: 'Drosera',
      normalized: 'Drosera',
      wordType: 'GENUS',
      start: 0,
      end: 7
    },
    {
      verbatim: 'intermedia',
      normalized: 'intermedia',
      wordType: 'SPECIES',
      start: 8,
      end: 18
    }
  ],
  id: 'f91c4174-1705-5c07-831d-eb2663bc5178',
  parserVersion: 'nightly-1-g03eec2d'
}

I plan to publish it to npm but wanted to check with you about naming. I don't want to tread on toes or imply endorsement, and don't have any strong feelings. As it's a simple wrapper I'd be happy to go with biodiversity or gnparser on npm (node-biodiversity etc is frowned upon now, apparently), or if that's confusing I can pick something more esoteric (ideas welcome!).

Alternatively if you want control under the auspices of gnames, that's fine too.

@dimus
Copy link
Member

dimus commented Jul 22, 2021

@tobymarsden it is fantastic you adjusted gnparser for npm, I think gnparser name is clear and straightforward, please just point to Go code in readme, so it is clear where engine comes from, biodiversity gem was originally planned as an analog of bioruby, bioperl etc, but for biodiversity. Later I decided on a small atomic modules approach, but the name stuck

@dimus
Copy link
Member

dimus commented Jul 26, 2021

@tobymarsden, please let me know when you publish it to npm, I would like to make a blog post about it and new version of biodiversity gem.

@tobymarsden
Copy link
Author

tobymarsden commented Sep 23, 2021

@dimus Well, this has been a royal pain to get working on Mac, though straightforward on Linux. It's here:

https://www.npmjs.com/package/gnparser

If there's anything amiss in the license, readme or links to GNParser please let me know and I'll correct immediately.

I now need to set up CI integration so we can (nearly) automate builds when GNParser is updated, and add Windows support.

@tobymarsden
Copy link
Author

tobymarsden commented Sep 23, 2021

@dimus
Copy link
Member

dimus commented Oct 1, 2021

Fantastic @tobymarsden, thanks for letting me know! I will add a link in gnparser readme

@dimus dimus closed this as completed Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants