Combining its
functions
#44
-
Is there a built-in way to combine the output of multiple its? I want to do something like:
To produce a list of unique tokens in descending order by frequency, grouped by token and part of speech (so if "google" is used both as a noun and a verb it would have two entries in the output) I just want to make sure I'm not missing a built-in method. In the meantime, I'll explore writing my own |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Here's my solution to the problem, using as much of the built-in winkjs pieces that made sense. Again, am curious if there is a better built-in way to handle this, even if it doesn't produce the exact same output format (but includes all the data). Note for future people wanting to use this: these methods are private members of an ES6 class, hence the
|
Beta Was this translation helpful? Give feedback.
-
Many thanks @pburrows for highlighting a scenario and also the possible solution. Your observation is correct, |
Beta Was this translation helpful? Give feedback.
Here's my solution to the problem, using as much of the built-in winkjs pieces that made sense. Again, am curious if there is a better built-in way to handle this, even if it doesn't produce the exact same output format (but includes all the data).
Note for future people wanting to use this: these methods are private members of an ES6 class, hence the
#
at the start of the methods. To turn these into more "normal" javascript functions, just replace the#
with the wordfunction
:#getWordsByPos
takes a parsed document that is the result of anlp.readDoc(xxx)
call, and an array of Part-Of-Speech tags that you want to filter to. You could easily remove the filter step.