Giter Club home page Giter Club logo

forvo's Introduction

forvo

Forvo’s API gives you access to 4 million audio pronunciations and translations in over 340 languages.

Getting started

First you need to have Forvo to be installed locally.

npm i --save forvo

Now you can get the best pronunciation for a word pronounced by native speaker. You need to have an API key for Forvo.

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
    const wordPronunciations = await forvo.standardPronunciation({ word: 'auf Wiederschauen', language: 'de' })
    // {
    //   items:[
    //     { id: 5943, word: 'auf_wiederschauen', original: 'auf Wiederschauen', pathmp3: 'https://apifree.forvo.com/audio/3h3h...
    //   ]
    // }
}

start().catch(err => console.log(err.stack));

API

Table of Contents

forvoApi

This function creates forvo api.

Parameters

  • options object Configuration object for forvo api
    • options.key string Your forvo api key

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });

Returns API Api

Api

This object represents a forvo Api.

Type: Object

Properties

  • wordPronunciations Api.wordPronunciations This function gets all the pronunciations from a word.
  • standardPronunciation Api.standardPronunciation This function gets the standard (top rated) pronunciation from a word.
  • languageList Api.languageList This function gets languages availables at Forvo.
  • popularLanguages Api.popularLanguages This function gets the most popular languages.
  • pronouncedWordsSearch Api.pronouncedWordsSearch This function gets words starting with a pattern alphabetically ordered with one or more pronunciations.
  • wordsSearch Api.wordsSearch This function gets words starting with a pattern alphabetically ordered.
  • popularPronouncedWords Api.popularPronouncedWords This function gets the most popular words with, at least, one pronunciation..

Api.wordPronunciations

This function gets all the pronunciations from a word.

Parameters

  • parameters object Parameters object provided for forvo api
    • parameters.word string The word you want to get its pronunciations.
    • parameters.language string? To get only the pronunciations recorded in the given language.
    • parameters.country string? To get only the pronunciations recorded by users of this country. You should use the Alpha-3 code.
    • parameters.username string? Returns the pronunciation recorded by a specific user.
    • parameters.sex string? m (for male), f (for female)
    • parameters.rate number? To get only the pronunciations rated with at least the given value.
    • parameters.order string? date-desc (pronunciations order by pronounced time, from recent to older) date-asc (pronunciations order by pronounced time, older to recent) rate-desc (pronunciations order by rate, high rated first) rate-asc (pronunciations order by rate, low rated first)
    • parameters.limit number? Max. pronunciations returned.
    • parameters.groupInLanguages boolean? Group pronunciations in languages. Default value is false.

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
  const wordPronunciations = await forvo.wordPronunciations({ word: 'Apfel', language: 'de' })
  // {
  //   attributes: { total: 11 },
  //   items:[
  //     { id: 5943, word: 'apfel', original: 'Apfel', pathmp3: 'https://apifree.forvo.com/audio/3h3h...
  //   ]
  // }
}

start().catch(err => console.log(err.stack));

Returns Promise<Object> All the pronunciations from a word

Api.standardPronunciation

This function gets the standard (top rated) pronunciation from a word.

Parameters

  • parameters object Parameters object provided for forvo api
    • parameters.word string The word you want to get its pronunciations.
    • parameters.language string? To get only the pronunciations recorded in the given language.

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
  const wordPronunciations = await forvo.standardPronunciation({ word: 'auf Wiederschauen', language: 'de' })
  // {
  //   items:[
  //     { id: 5943, word: 'auf_wiederschauen', original: 'auf Wiederschauen', pathmp3: 'https://apifree.forvo.com/audio/3h3h...
  //   ]
  // }
}

start().catch(err => console.log(err.stack));

Returns Promise<Object> Standard (top rated) pronunciation from a word

Api.languageList

This function gets languages availables at Forvo.

Parameters

  • parameters object Parameters object provided for forvo api
    • parameters.language string? Language code or "native" to get the language list with the names of the languages in their native languages. Default is English (en).
    • parameters.order string? Values: "name" or "code". Default is name.
    • parameters.minPronunciations number? Values: any integer number. To get only the languagues with, at least, the given number of pronunciations.

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
  const wordPronunciations = await forvo.languageList()
  // {
  //   attributes: { total: 349 },
  //   items:[
  //     { code: 'abq', en: 'Abaza' },
  //     { code: 'ab', en: 'Abkhazian' },
  //     ...
  //   ]
  // }
}

start().catch(err => console.log(err.stack));

Returns Promise<Object> Languages availables at Forvo.

Api.popularLanguages

This function gets the most popular languages.

Parameters

  • parameters object Parameters object provided for forvo api
    • parameters.language string? Values: Language code or "native" to get the language list with the names of the languages in their native languages. Default is English (en).
    • parameters.order string? Values: "popular", "name" or "code". Default is "popular".
    • parameters.limit string? Values: any integer number. Max. languages returned. Default is 10.

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
  const wordPronunciations = await forvo.popularLanguages()
  // {
  //   attributes: { total: 10 },
  //   items:[
  //     { code: 'de', en: 'German' },
  //     { code: 'tt', en: 'Tatar' },
  //     ...
  //   ]
  // }
}

start().catch(err => console.log(err.stack));

Returns Promise<Object> The most popular languages

Api.pronouncedWordsSearch

This function gets words starting with a pattern alphabetically ordered with one or more pronunciations.

Parameters

  • parameters object Parameters object provided for forvo api
    • parameters.search string The pattern you want to search.
    • parameters.language string? To get only the pronunciations recorded in the given language.
    • parameters.pagesize number? Values: any integer number between 1-100. Set the page size in results. Default is 20.
    • parameters.page number? Values: any integer number. Set the page results you want to retrieve. Default is 1.

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
  const wordPronunciations = await forvo.pronouncedWordsSearch({ search: 'aus', language: 'de' })
  // {
  //   attributes: attributes: { page: 1, pagesize: 20, total_pages: 7, total: 121 },
  //   items:[
  //     { id: 20945, word: 'aus', original: 'aus', num_pronunciations: '4', standard_pronunciation: ... },
  //     { id: 20945, word: 'aus_dem_weg_gehen', original: 'aus dem Weg gehen', num_pronunciations ... }
  //     ...
  //   ]
  // }
}

start().catch(err => console.log(err.stack));

Returns Promise<Object> Words starting with a pattern alphabetically ordered with one or more pronunciations

Api.wordsSearch

This function gets words starting with a pattern alphabetically ordered.

Parameters

  • parameters object Parameters object provided for forvo api
    • parameters.search string The pattern you want to search.
    • parameters.language string? To get only the pronunciations recorded in the given language.
    • parameters.pagesize number? Values: any integer number between 1-100. Set the page size in results. Default is 20.
    • parameters.page number? Values: any integer number. Set the page results you want to retrieve. Default is 1.

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
  const wordPronunciations = await forvo.wordsSearch({ search: 'aus', language: 'de' })
  // {
  //   attributes: attributes: { page: 1, pagesize: 20, total_pages: 7, total: 121 },
  //   items:[
  //     { id: 20945, word: 'aus', original: 'aus', num_pronunciations: '4', standard_pronunciation: ... },
  //     { id: 20945, word: 'aus_dem_weg_gehen', original: 'aus dem Weg gehen', num_pronunciations ... }
  //     ...
  //   ]
  // }
}

start().catch(err => console.log(err.stack));

Returns Promise<Object> Words starting with a pattern alphabetically ordered

Api.popularPronouncedWords

This function gets the most popular words with, at least, one pronunciation.

Parameters

  • parameters object Parameters object provided for forvo api
    • parameters.language string? To get only the words in the given language.
    • parameters.limit number? Values: any integer number. Max. word returned. Default is 1000.

Examples

import forvoApi from 'forvo';

const forvo = forvoApi({ key: 'your api key' });
const start = async () => {
  const wordPronunciations = await forvo.popularPronouncedWords({ language: 'de' })
  // {
  //   attributes: { total: 993 },
  //   items:[
  //     { id: 5619, word: 'adidas', original: 'Adidas', num_pronunciations: '4' },
  //     { id: 3697234, word: 'airbagbereich', original: 'Airbagbereich', num_pronunciations: '3' }
  //     ...
  //   ]
  // }
}

start().catch(err => console.log(err.stack));

Returns Promise<Object> The most popular words with, at least, one pronunciation.

forvo's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

forvo's Issues

Update token

Hi man. Can't install your library due to security tokens, read the below.

https://status.npmjs.org/incidents/dn7c1fgrr7ng

C:\Users\karl\Documents\Development\langurama>npm i forgo
npm WARN notice Due to a recent security incident, all user tokens have been invalidated. Please see https://status.npmjs.org/incidents/dn7c1fgrr7ng for more details. To generate a new token, visit https://www.npmjs.com/settings/~/tokens or run "npm login".
npm ERR! code E404
npm ERR! 404 Not Found: forgo@latest

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\karl\AppData\Roaming\npm-cache\_logs\2018-07-17T20_13_12_985Z-debug.log

Spelled your library wrong

import forgoApi from 'forgo';

const forgo = forgoApi({ key: 'your api key' });
const start = async () => {
    const wordPronunciations = await forgo.standardPronunciation({ word: 'auf Wiederschauen', language: 'de' })
    // {
    //   items:[
    //     { id: 5943, word: 'auf_wiederschauen', original: 'auf Wiederschauen', pathmp3: 'https://apifree.forvo.com/audio/3h3h...
    //   ]
    // }
}

start().catch(err => console.log(err.stack));

You typed forgo instead of forvo!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.