compromise
compromise copied to clipboard
syntax tree / dependency parsing
Hi, saw this in the readme:
dependency parsing: Proper sentence transformation requires understanding the syntax tree of a sentence, which we don't currently do. We should! Help wanted with this.
I looked for about 10 minutes for an issue related to this and didn't find one. So please excuse me if I missed it and there is a better place to be placing this.
I was curious if anything has been done in with this front, and if not, my thoughts were that this topic can be the beginning of a discussion related to this.
hey @broskees i'd love some help with this. I'm not sure I understand the problem very well.
in the compromise-sentences plugin, we have very early stabs at this, which need a lot of work.
The process so far:
- First split by 'clause', which is mostly just commas
- grab the 'main clause' which is a kinda-weak attempt to ignore dependent clauses, and get the top-one
- grab the first verb of the main clause
so in that, we have a basic 'top verb' of the sentence. That's where it's at. I know it's not close to the recursive-tree stuff that is necessary for proper dependency parsing.
Wanna take a stab at it, as a plugin? I can setup some boilerplate code, if you want
cheers
I'd love to; boilerplate code would be extremely helpful.
I understand the issue on some fundamental level. However, I've been doing a great bit of learning more about it for a project I'm currently involved with. So, rather than let that all go to waste, maybe I can get it out in some code and not only achieve the goal I'm going for but make a contribution.
Let me know what you come up with. I'll drop some concepts as I get deeper into it for discussion if I get stuck.
ok thanks @broskees i'll create a repo for us to experiment on this with
hey @broskees i've created a repo with some rough proof-of-concept here
Feel free to take it for a spin. You'll need to install compromise as a peerDependency, like
npm i --no-save compromise
then if you run node ./scratch.js
you'll see a basic parsing and response of a sentence.
I built-up a weird Tree
and Node
class structure, though I have no idea what the best response format would be, for a nested object of phrases.
Up to you! Let me know if I can help. cheers
Hey @spencermountain I'll do my best to give this a whirl this weekend (overall this is probably a bigger tackle than just some time this weekend, but I'll chip away at it). I'll let you know what I come up with.