The matra_wasm_app is a web-based application that uses WebAssembly (Wasm) to analyze Devanagari text. Built on top of the matra_lib Rust library, this app enables users to analyze syllabic patterns (matra), decompose text into its constituent components, and display structured insights in real time. It is particularly useful for those studying or composing poetry in the classical Indian tradition, such as Matrik Chhand.
- Matra Analysis in the Browser: Leverages WebAssembly to run Rust code directly in the browser for fast and efficient analysis.
- Detailed Insights: Breaks down input lines into their Varns (characters) and their respective Matra values, showing comprehensive line-level statistics.
- Interactive Interface: Provides an easy-to-use text box for entering Devanagari lines, with results displayed dynamically.
- Cross-Platform: Runs seamlessly on any modern browser without the need for additional installations.
- Powered by matra_lib: Uses the core functionalities of matra_lib for accurate matra analysis and text decomposition.
You can try the live demo hosted on GitHub Pages: matra_wasm_app Demo
To set up and run the app locally:
-
Install Rust and the
wasm-pack
tool:cargo install wasm-pack
-
A basic understanding of WebAssembly and how Rust integrates with it.
-
Clone the repository:
git clone <https://github.com/aknautiyal/matra_wasm_app.git cd matra_wasm_app
-
Build the WebAssembly package:
wasm-pack build --target web
-
Serve the app locally:
python -m http.server 8000
-
Open your browser and navigate to
http://localhost:8000
to test the app.
-
Switch to the
gh-pages
branch:git checkout gh-pages
-
Copy the contents of the
pkg
folder and theindex.html
file into the branch. -
Push the changes to GitHub:
git push origin gh-pages
-
Enable GitHub Pages in your repository settings and set the branch to
gh-pages
.
- Enter a Devanagari text line into the provided text box on the webpage.
- Press the "Analyze" button to view:
- Varns: The characters in the line, grouped by words.
- Matra: The corresponding syllabic values.
- Total Counts: Statistics like the total number of Varns and Matra for the entire line.
- Explore results displayed in a structured and formatted manner.
- Rust: Core logic and analysis.
- wasm-pack: To compile Rust code to WebAssembly.
- JavaScript: For interacting with the compiled WebAssembly module.
- HTML/CSS: For the user interface.
- matra_lib: The Rust library powering the matra analysis.