Accessing the part of speech data for vocab?

So I just started marking a user script that randomly selects an X amount of vocab from your unlocked words. The goal of this originally was so I could practise writing out the vocab I have learnt (in sentences). I didn’t want to just write out the hundreds I have unlocked, and I didn’t want to bother picking them by hand, so I developed the script.

Now my problem is that it’s hard, with my limited knowledge of grammar, to make sentences especially when all the words picked are all of 1 type of the part of speech (ie, all verbs). So I figured I could at least make the script a bit more versatile + ease up by getting the script to pick out say x number of adjectives, y number of nouns, and z number of verbs.

Hence my question: Is there a way to access the part of speech information per vocab. If not, will it be available in the API soon?

Ultimately, making a sentence doesn’t really matter, but it would make it more fun + let me test out my grammar knowledge :slight_smile:

1 Like

The API doesn’t contain part-of-speech, but you can extract it from the individual item pages. You can do an ajax request for the html via https://www.wanikani.com/vocabulary/<vocab_word>, then use jquery selectors on the resulting html to grab the part-of-speech field.

1 Like

Oh that makes sense, thanks :slight_smile:

Ah, it’s such a bummer there’s no way to search by part of speech! I know it probably doesn’t make sense as far as the core functionality of WaniKani but would be super amazing for practicing forming sentences with new vocab! I will probably end up writing a script that screen scrapes each individual page, but will have to save it in a local db, otherwise just calling up a bunch of words in each category would take ages.

Is there any way to tag Koichi to request this API feature? :pray:

^^^ I was going to suggest using the wanikani search tag on Jisho, but then I realized they don’t actually have a #wk tag. You can search Jisho by part of speech, though. Just look at the [docs page] on Jisho, find the tag for the part of speech you’re interested in, and put it in the search box.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.