Feature(symbol-palette): add local handwritten symbol recognition + enhanced symbol list - #90
Musicminion wants to merge 2 commits into
Conversation
- add browser-side recognition using a model trained by ayaka-notes - add a handwriting input panel to the symbol palette - add a script to generate the symbol sprite atlas
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd467087d0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export function rasterizeStrokes(strokes, config) { | ||
| const size = config.imageSize | ||
| const renderSize = size * config.supersample | ||
| const canvas = new OffscreenCanvas(renderSize, renderSize) |
There was a problem hiding this comment.
Provide a canvas fallback for Safari 15
The web package explicitly targets Safari 15, where OffscreenCanvas is unavailable. On that supported browser, every drawing reaches this constructor, throws, and is converted by the worker into “Recognition unavailable,” even though the draw control remains visible. Use a worker-compatible fallback, preprocess on a regular canvas on the main thread, or hide the feature when the required API is absent.
Useful? React with 👍 / 👎.
| const width = maxX - minX || 1 | ||
| const height = maxY - minY || 1 | ||
| const scale = coordinateSpace / Math.max(width, height) | ||
| const offsetX = (coordinateSpace - width * scale) / 2 | ||
| const offsetY = (coordinateSpace - height * scale) / 2 |
There was a problem hiding this comment.
Center single-point strokes during normalization
When the user makes a tap without pointer movement—for example, when drawing a dot—both extents are replaced with 1, making the scale equal to the entire coordinate space and both offsets zero. The only point is consequently rasterized near the upper-left margin rather than centered, so dot-like symbols are fed to the model in the wrong location. Handle a stroke whose overall width and height are both zero as a centered point.
Useful? React with 👍 / 👎.
- expand Unicode symbol catalog from 117 to 1188 entries - correct Unicode mappings for circ, setminus and varnothing - center single-point strokes during recognition preprocessing
Description
Add handwritten LaTeX symbol recognition to the symbol palette. Users can draw a symbol and select a matching command, with recognition running locally in the browser across 1,622 symbol classes.
Validated with 14 local frontend tests and browser regression checks for clock and empty-set recognition.
Related issues / Pull Requests
We also want to fix: #19
Contributor Agreement