mistval / unofficial-jisho-api

Encapsulates the official Jisho.org API and also provides kanji, example, and stroke diagram search.
MIT License
139 stars 14 forks source link

reading of jukugo #19

Closed lingolab2 closed 4 years ago

lingolab2 commented 4 years ago

I'd like get the reading of a jukugo. The following provides meaning but not the reading. How can one achieve this?

jisho.scrapeForPhrase('電車').then((data) => {
  console.log(JSON.stringify(data, null, 2));
});
mistval commented 4 years ago

You can use searchForPhrase instead:

jisho.searchForPhrase('電車').then((data) => {
  const reading = data.data[0].japanese[0].reading;
  console.log(reading);
});

scrapeForPhrase should only be used for things that searchForPhrase doesn't have.

lingolab2 commented 4 years ago

works perfectly thank you. any chance to get at newspaper frequency if available?

On 9 Jun 2020, at 00:12, Randall notifications@github.com wrote:

You can use searchForPhrase instead:

jisho.searchForPhrase('電車').then((data) => { const reading = data.data[0].japanese[0].reading; console.log(reading); }); scrapeForPhrase should only be used for things that searchForPhrase doesn't have.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mistval/unofficial-jisho-api/issues/19#issuecomment-640803717, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHBLCK6L5OI62ABB73G2FALRVUWKRANCNFSM4NYT5HMQ.

mistval commented 4 years ago

That is in the kanji search results:

const JishoApi = require('unofficial-jisho-api');
const jisho = new JishoApi();

jisho.searchForKanji('語').then(result => {
  console.log('Newspaper frequency rank: ' + result.newspaperFrequencyRank);
});
lingolab2 commented 4 years ago

this would work only for Kanji and not for compound words (jukugo), right?

On 9 Jun 2020, at 05:13, Randall notifications@github.com wrote:

That is in the kanji search results:

const JishoApi = require('unofficial-jisho-api'); const jisho = new JishoApi();

jisho.searchForKanji('語').then(result => { console.log('Newspaper frequency rank: ' + result.newspaperFrequencyRank); }); — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mistval/unofficial-jisho-api/issues/19#issuecomment-640944171, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHBLCK5RYDJOVEEOV2W4UETRVVZQLANCNFSM4NYT5HMQ.

mistval commented 4 years ago

Yes, I didn't think Jisho.org shows newspaper frequency for anything except single kanji search results. Am I mistaken?

lingolab2 commented 4 years ago

you’re most likely right. wanted to refresh existing data about jukugo. probably from some other source. i’ll search. thanks

On 9 Jun 2020, at 05:19, Randall notifications@github.com wrote:

Yes, I didn't think Jisho.org shows newspaper frequency for anything except single kanji search results. Am I mistaken?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mistval/unofficial-jisho-api/issues/19#issuecomment-640945886, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHBLCK6L4OJ4KWFHQIKSO3TRVV2HXANCNFSM4NYT5HMQ.