Skip to content

🌐 [translation-sync] [numpy.md] Update np.random → Generator API#122

Open
mmcky wants to merge 2 commits into
mainfrom
translation-sync-2026-05-13T10-47-24-pr-549
Open

🌐 [translation-sync] [numpy.md] Update np.random → Generator API#122
mmcky wants to merge 2 commits into
mainfrom
translation-sync-2026-05-13T10-47-24-pr-549

Conversation

@mmcky
Copy link
Copy Markdown
Contributor

@mmcky mmcky commented May 13, 2026

Automated Translation Sync

This PR contains automated translations from QuantEcon/lecture-python-programming.

Source PR

#549 - [numpy.md] Update np.random → Generator API

Files Updated

  • ✏️ lectures/numpy.md
  • ✏️ .translate/state/numpy.md.yml

Details

  • Source Language: en
  • Target Language: fa
  • Model: claude-sonnet-4-6

This PR was created automatically by the translation action.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 13, 2026

Deploy Preview for majestic-griffin-10b166 ready!

Name Link
🔨 Latest commit 639e6e4
🔍 Latest deploy log https://app.netlify.com/projects/majestic-griffin-10b166/deploys/6a0456c3b8cdd70008032c7f
😎 Deploy Preview https://deploy-preview-122--majestic-griffin-10b166.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 13, 2026

✅ Translation Quality Review

Verdict: PASS | Model: claude-sonnet-4-6 | Date: 2026-05-13


📝 Translation Quality

Criterion Score
Accuracy 9/10
Fluency 9/10
Terminology 9/10
Formatting 9/10
Overall 9/10

Summary: The Persian translation of the modified sections is of high quality. All five changed sections (Mutability, Making Copies, Universal Functions, Sub-packages, Implicit Multithreading, and Exercises) are accurately translated with natural Farsi phrasing and consistent technical terminology. Formatting is well-preserved with no syntax errors. Minor fluency improvements are possible in a few places but do not significantly impact comprehension. The translation successfully balances technical precision with natural Persian academic prose. Consistent and accurate use of established Persian technical terminology throughout all modified sections (e.g., 'قابلیت تغییر' for Mutability, 'توابع جهانی' for Universal Functions, 'بسته‌های فرعی' for Sub-packages, 'چندنخی ضمنی' for Implicit Multithreading) Mathematical content, LaTeX equations, and code blocks are perfectly preserved across all modified sections with no formatting errors The Exercises section is translated with high accuracy, preserving the logical structure of multi-part problems and solution hints Deep copy terminology ('deep copy' kept with Persian explanation 'کپی مستقل') is handled appropriately in the Making Copies section, balancing technical precision with readability The translation maintains a consistent academic register appropriate for a technical programming tutorial throughout all modified sections

Suggestions:

  • Mutability section: 'We already saw examples of multability above' → The Persian translation 'قبلاً نمونه‌هایی از قابلیت تغییر را در بالا دیدیم' correctly translates this, but the original English has a typo 'multability' which was silently corrected in translation - this is fine and acceptable.

  • Universal Functions section: 'Not all user-defined functions will act element-wise' is translated as 'همه توابع تعریف شده توسط کاربر به صورت عنصر به عنصر عمل نخواهند کرد' - while accurate, a more fluent phrasing would be 'نه همه توابع تعریف‌شده توسط کاربر به صورت عنصر‌به‌عنصر عمل می‌کنند' to better match Persian natural negation patterns.

  • Sub-packages section: 'Generate standard normals' is translated as 'تولید توزیع نرمال استاندارد' but more accurately should be 'تولید اعداد تصادفی نرمال استاندارد' since it refers to random numbers, not a distribution object.

  • Implicit Multithreading section: 'neatly splits up the tasks' is translated as 'به زیبایی وظایف را تقسیم می‌کند' - a more technical and appropriate rendering would be 'به‌خوبی وظایف را تقسیم‌بندی می‌کند' which sounds more natural in technical Persian.


🔍 Diff Quality

Check Status
Scope Correct
Position Correct
Structure Preserved
Heading-map Correct
Overall 10/10

Summary: The translation document correctly mirrors all source changes: the deprecated np.random.randn calls are replaced with rng.standard_normal and related RNG updates, the DiscreteRV class gains seed parameter and uses self.rng, the Sub-packages section text is updated, and the exercise solutions use the new RNG API — all at the correct positions, with structure and heading-map unchanged.


This review was generated automatically by action-translation review mode.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR syncs the Persian translation of the NumPy lecture with upstream changes that migrate examples from the legacy np.random.* API to NumPy’s Generator-based random API, and updates the translation sync state metadata accordingly.

Changes:

  • Replaced uses of np.random.randn, np.random.binomial, and np.random.seed with np.random.default_rng() + Generator methods like standard_normal and binomial.
  • Updated the DiscreteRV exercise solution to use an instance RNG (default_rng(seed)) and rng.uniform(...).
  • Updated translation sync state (source-sha, sync date, model, tool version).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lectures/numpy.md Updates random-number generation examples to the Generator API and adjusts related exercise solution code.
.translate/state/numpy.md.yml Updates translation-sync bookkeeping (source SHA, sync timestamp, model/mode, tool version).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lectures/numpy.md
Comment on lines +1255 to +1262
def __init__(self, q, seed=None):
"""
آرگومان q یک آرایه NumPy است، یا شبیه آرایه، غیر منفی و جمع
به 1 می‌شود
"""
self.q = q
self.Q = cumsum(q)
self.rng = np.random.default_rng(seed)
@github-actions
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants