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

Suggest post language correction #2486

Merged
merged 7 commits into from
Jan 12, 2024
Merged

Conversation

pfrazee
Copy link
Collaborator

@pfrazee pfrazee commented Jan 11, 2024

Building on #2484

  • Factors out into a separate component
  • Tunes the lande confidence to reduce false positives
  • Tweaks the UI a smidge
  • Polyfills the requestIdleCallback for safari.

Final Screenshot:

CleanShot 2024-01-10 at 22 19 08@2x


Copying over original description:

Fixes #2449

  • Adds code3ToCode2Strict mapping function because it seems that lande returns language codes that we don't have in our mapping, we should just filter those out. (Mixed English+Japanese seems to be returning cmn and I can't figure out what language is)
  • It skips over short posts (currently set to length < 10) because lande is going to return incorrect matches for them anyway
  • lande is being run in a requestIdleCallback, not sure if this is the right call, perhaps a timeout would be a better idea instead?
  • I'm hoping that a threshold of 0.85 should be "correct" enough, but we could probably bump this up to 0.90

image

@mary-ext
Copy link
Contributor

Fixes #2387

Copy link
Member

@estrattonbailey estrattonbailey left a comment

Choose a reason for hiding this comment

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

This is super nice! Works great

@pfrazee pfrazee merged commit 95d771b into main Jan 12, 2024
4 checks passed
@pfrazee pfrazee deleted the mary-ext-feat/composer-auto-lang branch January 12, 2024 18:20
estrattonbailey added a commit that referenced this pull request Jan 18, 2024
* origin/main: (44 commits)
  Patch `@lingui/core` to fix `unraw` import resolution error (#2548)
  1.65
  Fix the fallback to discover behavior on the home feed (#2546)
  Bump android version code
  Bump ios build number
  Add a new home feed-api wrapper and give a header indicating the fallback behavior (#2534)
  Add accept-language header (#2457)
  rss: filter out replies server-side (#2518)
  feat: show muted/blocked status on list card (#2523)
  1.64 (#2521)
  Bump react-native@0.73.2 (#2519)
  Create a profile record on new user (#2520)
  fix: truncate long email address (#2493)
  fix: set html lang according to app language (#2496)
  Ensure sessions and tokens are synced between tabs (#2498)
  package.json: cp --verbose doesn't exist on macos (#2501)
  Suggest post language correction (#2486)
  (optional) In app browser  (#2490)
  Toggle minimal shell on any scroll for web (#2499)
  ✨ New report type, appeal (#2455)
  ...
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

Successfully merging this pull request may close these issues.

Detect language during authoring and suggest a correction if needed
3 participants