GithubHelp home page GithubHelp logo

Comments (4)

addohm avatar addohm commented on June 30, 2024

I think I found the source for the information. Contained within a lesson explanation, there is a HTML table which basically contains the voice names within the html anchor links. Could probably use bs4 to scrape it out easily if you didn't want to do it manually. self.user_data['language_data'][lang]['skills'][n]['explanation']. These links, however, are not in every explanation, so it might be necessary to iterate through the skill explanations to isolate the name.

"explanation": "<p>There are four main tones and one neutral tone in Mandarin Chinese to distinguish words and grammatical uses. </p>\n<table>\n<thead>\n<tr>\n<th>Tone</th>\n<th>Tone mark</th>\n<th>Pronunciation</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>The 1st tone</td>\n<td>“ˉ” like in mā</td>\n<td>High and flat (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/9420c9f11f68a53c9f3aab785935be99\">listen</a>)</td>\n</tr>\n<tr>\n<td>The 2nd tone</td>\n<td>“ˊ” like in má</td>\n<td>Rising (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/44d0791f329ed28a30a9d17fa4b4f158\">listen</a>)</td>\n</tr>\n<tr>\n<td>The 3rd tone</td>\n<td>“ˇ” like in mǎ</td>\n<td>Low then rising (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/11f22731028012457e2458e65ca5a2a5\">listen</a>)</td>\n</tr>\n<tr>\n<td>The 4th tone</td>\n<td>“ˋ” like in mà</td>\n<td>Falling (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/abcf3dcc7397a7cb12ff77d6614f05d3\">listen</a>)</td>\n</tr>\n<tr>\n<td>The neutral tone</td>\n<td>No mark like in ma</td>\n<td>Light (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/d34296b796bfcede214f232fcb77f84a\">listen</a>)</td>\n</tr>\n</tbody>\n</table>\n<p>Sometimes Chinese tones change based on the tone that follows it. There are three main places where you will see this: with all 3rd tones (low then rising tones), with the character 一 yī (1/one), and with the character 不 bù (no, not). Here we’ll take a quick look at how the 3rd tone changes. </p>\n<p>There are two main rules for how to pronounce the 3rd tone:\nWhen you have two 3rd tones together, the first one becomes a 2nd tone (rising tone).\nWhen you have a 3rd tone followed by any other non-3rd tone syllable, it only lowers, it doesn’t rise at the end.</p>\n<table>\n<thead>\n<tr>\n<th>Chinese</th>\n<th>Pinyin</th>\n<th>Actual Pronunciation</th>\n<th>English</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>你好。</td>\n<td>Nǐ hǎo.</td>\n<td>Ní hǎo. (nǐ becomes 2nd tone) (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/37bcad7a490df8f0d11ddbbd9f77fb65\">listen</a>)</td>\n<td>Hello.</td>\n</tr>\n<tr>\n<td>我的名字是Duo。</td>\n<td>Wǒde míngzi shì Duo.</td>\n<td>Wǒde míngzi shì Duo. (no rise in tone for wǒ) (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/b5ff52ec161bca3b2bc3c33683d460c1\">listen</a>)</td>\n<td>My name is Duo.</td>\n</tr>\n<tr>\n<td>我是Duo。</td>\n<td>Wǒ shì Duo.</td>\n<td>Wǒ shì Duo. (no rise in tone for wǒ) (<a href=\"https://d1vq87e9lcf771.cloudfront.net/jiaoling/7e463b2d7668bf02a1348a245bc3b7e0\">listen</a>)</td>\n<td>I am Duo.</td>\n</tr>\n</tbody>\n</table>",

from duolingo.

addohm avatar addohm commented on June 30, 2024

Here is a gist that does what I expect.

get_word_audio_url('你') outputs this url: 'https://d7mj4aqfscim2.cloudfront.net/tts/zs/jiaoling/你'

This requires the user to be logged in and assumes the requested language and word is in the users vocabulary. Without knowing more about the API, this is the best I could come up with in a couple hours. I've forked this package and will weave this in as I find time.

from duolingo.

SpangleLabs avatar SpangleLabs commented on June 30, 2024

Looks like your gist is no longer working, as there's no links in explanations anymore?

from duolingo.

SpangleLabs avatar SpangleLabs commented on June 30, 2024

This is fixed and tested now, closing ticket

from duolingo.

Related Issues (20)

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.