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

Word Type Search #7

Open
afortiori opened this issue Feb 24, 2019 · 5 comments
Open

Word Type Search #7

afortiori opened this issue Feb 24, 2019 · 5 comments

Comments

@afortiori
Copy link

On jisho.org, it is possible to see the 'type' of word, for example, suru verb, godan verb etc. In the future would it be possible to get that information via the unofficial jisho api? I also now Jisho has a lot of information about inflection, being able to get that information would be super cool too.

@mistval
Copy link
Owner

mistval commented Feb 24, 2019

Hi, I'll see if I can add that information when I have some time 👍

@afortiori
Copy link
Author

Thanks! :)

@mistval
Copy link
Owner

mistval commented Feb 25, 2019

I added a new scrapeForPhrase function to master that can get you the word type among other things. I need to test it a bit more and write documentation before I push a new version to NPM, but if you want to try it out now you can do npm install https://github.com/mistval/unofficial-jisho-api to install the master branch.

console.log(JSON.stringify(await jisho.scrapeForPhrase('ゆっくり'), null, 2)) returns the following:

{
  "found": true,
  "tags": [
    "Common word",
    "JLPT N5"
  ],
  "meanings": [
    {
      "seeAlsoTerms": [],
      "sentences": [],
      "meaning": "slowly; at ease; restful",
      "supplemental": [
        "Onomatopoeic or mimetic word"
      ],
      "meaningAbstract": "",
      "meaningTags": [
        "adverb",
        "noun",
        "suru verb",
        "adverb taking the 'to' particle"
      ]
    }
  ],
  "query": "ゆっくり",
  "uri": "https://jisho.org/word/%E3%82%86%E3%81%A3%E3%81%8F%E3%82%8A"
}

The word type is in the "meaningTags" property, it's the same as in the entry on Jisho.org.

As for the inflections, those are actually conjugated by JavaScript in the browser (here), so I'd have to do something like use Puppeteer to execute that code, I'll look into that some other time if I get a chance.

@mistval
Copy link
Owner

mistval commented Feb 27, 2019

New version 1.2.0 on NPM has the above mentioned scrapeForPhrase function. Please see the README or jsdocs for more info.

@afortiori
Copy link
Author

Wow, thanks! This is super cool.

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