Tiny FinglishJavaScriptv0.1.0

Type salam.
See سلام.

Persian words, typed with Latin letters. Turn Finglish into Persian script in the browser, with alternative spellings and control over what stays unchanged.

salam
سلام
Same word. Another script.

YOUR WORDS, ON YOUR DEVICE

A little room to write.

Real library · local conversion
Aa
26 / 400 characters
آ
Model + rules + word tables
protect: ['google']

The demo loads when you reach it.

Look at the words

Choose a word to inspect its candidates. Outlined tokens were kept unchanged.

Other whole-text suggestions

These are alternatives returned by the engine, not corrections confirmed to be right.

The engine and its data download from this website. Conversion runs in a browser worker; this demo does not send your text to a server. Review names and ambiguous words before using the result.

Change the script, not the language.

Finglish is Persian written with Latin letters. This is transliteration, not English-to-Persian translation or a tool that rewrites your sentences.

Some text should stay as it is.

The tokenizer protects links, email addresses, mentions, code and numbers. Add your own tokens with protect when a product name should stay in Latin letters.

Keep the choices visible.

Finglish can be ambiguous. The API returns alternatives and per-span candidates so your interface can let people review the spelling.

A LIBRARY FOR YOUR INTERFACE

Give your text field a Persian option.

Use it alongside a message composer, a writing tool or a form. Keep the original input available and let the person decide whether to use the conversion.

Text in, structured result outNo runtime dependenciesNo conversion API key
Which engine does this demo use?

The hybrid configuration: the model ranked together with rules, plus frequency and vowel tables. The optional bigram table and lexicon are not loaded. A bare transliterate() call uses rules only, so its output can differ.

How reliable are the suggestions?

Spelling habits, names and mixed-language text can produce mistakes. Confidence values rank the engine’s candidates; they are not a measured probability that a sentence is correct. Test it on the writing your users actually produce.

Read the evaluation notes
JavaScriptThe same configuration as the demo
// After loading the model and both word tables:
const engine = new Transliterator({
  model: weights,
  frequency: decodeFrequencyTable(frequencyBytes),
  vowels: decodeVowelTable(vowelBytes),
});

const result = engine.transliterate(input, {
  protect: ['google'],
  alternatives: 2,
});

result.text;         // Persian output
result.alternatives; // Other whole-text suggestions
result.spans;        // Each input span and its result
Load the model and tables
import {
  Transliterator,
  decodeFrequencyTable,
  decodeVowelTable,
} from 'tiny-finglish';

// Vite-style asset URLs; fetch these when needed.
import modelUrl from 'tiny-finglish/weights.json?url';
import frequencyUrl from 'tiny-finglish/frequency.bin?url';
import vowelsUrl from 'tiny-finglish/vowels.bin?url';

async function load(url) {
  const response = await fetch(url);
  if (!response.ok) throw new Error('Asset unavailable');
  return response;
}

const [weights, frequency, vowels] = await Promise.all([
  load(modelUrl).then(r => r.json()),
  load(frequencyUrl).then(r => r.arrayBuffer()),
  load(vowelsUrl).then(r => r.arrayBuffer()),
]);
const frequencyBytes = new Uint8Array(frequency);
const vowelBytes = new Uint8Array(vowels);

Our demo runs this setup in a worker, loaded only on this product page. The model and tables are fetched when you reach the demo.

Try it with the way you write.

This demo runs Tiny Finglish v0.1.0. Download the package from its GitHub release and follow the installation guide. It is not published on npm yet.

Share a tricky conversionJavaScript · TypeScript types · MITLicense and data credits