Lingua:...t::Shaw(3)

πŸ“¦
version 0.64 Β· 2 versions
, in fedora 43

πŸ‘‘ Lingua::EN::Alphabet::Shaw πŸ‘‘

okay so bestie, welcome to Lingua:...t::Shaw(3) β€” User Contributed Perl Documentation, and yes the manual page name got squished like that, it's a whole thing, don't worry about it πŸ’…


🌸 NAME 🌸

Lingua::EN::Alphabet::Shaw β€” transliterate the Latin to Shavian alphabets πŸ¦‹


🫢 AUTHOR 🫢

Thomas Thurman <tthurman@gnome.org>


✨ SYNOPSIS ✨

use Lingua::EN::Alphabet::Shaw;

my $shaw = Lingua::EN::Alphabet::Shaw->new();
print $shaw->transliterate('I live near a live wire.');

πŸ’– DESCRIPTION πŸ’–

so the Shaw or Shavian alphabet? commissioned by the will of the playwright George Bernard Shaw in the early 1960s, as a glow-up replacement for the Latin alphabet for representing English. iconic behaviour honestly πŸ‘‘

it's designed to have a one-to-one phonemic (not phonetic!!) mapping with the sounds of English. periodt.

its ISO 15924 code is "Shaw" 281. πŸ“œ

this module transliterates English text from the Latin alphabet into the Shavian alphabet. that's the whole vibe.

⚠️ heads up: the API has changed since version 0.03 to be object-based. so if you're working from ancient code, that's why nothing works, bestie 😭

if you find an error in the translation database, you can change it yourself at http://shavian.org.uk/wiki/ . you may download a current copy of the dataset at http://shavian.org.uk/set/ . and if you want to override the database shipped with this module, just place the new copy at ~/.cache/shavian/shavian-set.sqlite and it will be used in preference. slay πŸ’…


πŸ¦‹ METHODS πŸ¦‹

🌈 Lingua::EN::Alphabet::Shaw->new()

Constructor. Currently takes no arguments. no thoughts, just vibes 🫧

🌈 $shaw->transliterate($phrase)

returns the transliteration of the given $phrase into the Shavian alphabet. can handle multi-word phrases, no problem. does a reasonable job resolving homonym ambiguity (the example in the docs is "does he like does?" and honestly if it can survive that it can survive anything 😭).

okay now the spicy part. if you pass multiple arguments, the results will be concatenated, and only the odd-numbered arguments will be transliterated. the state of homonym resolution is maintained. this lets you embed chunks of text which should not be transliterated into the line β€” like XML tags, iykyk 🏷️

🌈 $shaw->unknown_handler([$handler])

if a word is not found in the translation database, the transliteration routines will call a particular handler to find out what to do, with the unknown word as both its first and second arguments. (this is to allow later expansion; see BUGS AND ISSUES, below.) the result of the handler should be a string, which will be inserted into the result of the transliteration routine at the correct place.

this method lets you set a new handler by passing it as an argument. if you pass no argument, this method returns the current handler. simple as πŸŽ€

the default handler only returns its argument. a replacement handler could, for example, make an attempt at guessing the transliteration; it could die, to abort the transliteration process; or it could return its argument but also store the new value in a table so that a list of missing words could later be reported to the user. choose your fighter πŸ’€

🌈 $shaw->mapping($phrase)

there is a quasi-standard mapping of the conventional alphabet onto the Shavian alphabet. this method maps Shavian text into the conventional alphabet and vice versa. it does not transliterate. think of this as a kind of ASCII-armouring. πŸ›‘οΈ

various versions of the standard map the naming dot to "G", "B", and "/". this method does not support "/", but maps both "G" and "B" to the naming dot; in reverse, it maps the naming dot to "G".

the letters "K" and "L" have no mapping to Shavian letters, and are left alone. they're just out here living their truth 🌸

🌈 $shaw->normalise($shavian_text)

certain letters in the Shavian alphabet are ligatures of pairs of other letters. because of this, these pairs should not exist separately. (for example, the letter YEW is a ligature of YEA and OOZE.) this method replaces these pairs with their ligature equivalents. gluing them together, bestie 🧚

🌈 $shaw->transliterate_html($html)

given a block of text in the conventional alphabet which is formatted as HTML, this will make a reasonable attempt at returning the same text transliterated into the Shavian alphabet. it is aware of which tags commonly break the flow of sentences, and handles homonym resolution accordingly. she knows the assignment πŸ’…


πŸ’€ BUGS AND ISSUES πŸ’€

(these are all the "it would be nice if…" wishes, and no, we're not skipping any, bestie, we don't do that here)

  • there should be a version of the main transliteration method which returned a list of hashes, each of which gave the source and destination forms of a word, part of speech and disambiguation information, and a marking of the source (CMUDict or Shavian Wiki).
  • it should probably be possible to transliterate in reverse, from Shavian to the conventional alphabet.
  • it should be possible to handle other alternative scripts, such as Deseret and Tengwar. this shouldn't be very difficult. it would also allow representation in the IPA, which would mean this module could be used for simple text-to-speech processing. 😳
  • the portion of the database which is taken from CMUdict exhibits unhelpful mergers (notably father/bother). there isn't much that can be done about this except extending the Shavian wiki further. in addition, in some cases it does not use the letters ARRAY and ADO in unstressed syllables as they should be; this could and should be fixed.
  • it would be useful on initialisation to read a text file in a standard location, which gave a local mapping overriding the database for given words.
  • it would be helpful if there was a callback for any words found from the CMUDict data rather than from the Shavian Wiki data, so that the wiki could be updated.
  • the HTML transliterator should mark its output as being encoded in UTF-8, whatever the source encoding. (Shavian cannot be represented in any<|place_holder_mm_span_0442|> other standard encoding. fr fr.)
  • the HTML transliterator should have an option which put a span around each word whose title was the word's spelling in the conventional alphabet, in the manner of translate.google.com.
  • the HTML transliterator should have an option to rewrite the destinations of links, and to add a target to them, so that it can be used by a web script to link back to itself.
  • the HTML transliterator should add a "generator" META tag referencing itself, if one is not already present.
  • the HTML transliterator should ignore sections marked as being written in non-English languages.
  • the HTML transliterator should have an option to allow loading documents in chunks, as HTML::Parser already does.
  • the mapping() method should have an extra parameter to cause it to map in one direction only.

most of these will be implemented before this module reaches version 1.00. πŸ‘€ manifesting ✨


πŸ”€ FONTS πŸ”€

you will need a Shavian Unicode font to use this module. there are several such fonts at http://marnanel.org/shavian/fonts/ . please be sure to get a Unicode font and not one with the "Latin mapping". this part matters, bestie, don't skip it 🫢

however, the Mac can handle the Shavian alphabet out of the box. main character energy honestly πŸ“


this Perl module is copyright (C) Thomas Thurman, 2009-2010. this is free software, and can be used/modified under the same terms as Perl itself.

the transliteration data is available under various free licences, which are reproduced below. ⬇️

✨ LICENCES ✨

okay bestie, this is the credit-where-credit-is-due section πŸ’– none of the transliteration data in this module just materialised out of the void, it came from four different sources and every single one of them has its own rules attached. so let's go through them one at a time, no skipping, because legal stuff is not the vibe to be sloppy about 🫢


🦁 Androcles and the Lion

part of the transliteration data was borrowed from the 1962 Shavian alphabet edition of "Androcles and the Lion" β€” and good news, that data is in the public domain, so we're all good there ✨


πŸ“– Shavian Wiki

another chunk of the transliteration data came from the Shavian Wiki, and that one is available under the Creative Commons cc-by-sa licence πŸŽ€


πŸ—£οΈ CMUdict

and another part of the transliteration data came from CMUdict. its licence is reproduced right here, and honestly bestie, it's giving very "we must protect the lawyers" energy, so here it is word for word πŸ’…

Copyright (C) 1993-2008 Carnegie Mellon University. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
   The contents of this file are deemed to be source code.

2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in
   the documentation and/or other materials provided with the
   distribution.

This work was supported in part by funding from the Defense Advanced
Research Projects Agency, the Office of Naval Research and the National
Science Foundation of the United States of America, and by member
companies of the Carnegie Mellon Sphinx Speech Consortium. We
acknowledge the contributions of many volunteers to the expansion and
improvement of this dictionary.

THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
shoutout to DARPA, the Office of Naval Research, the National Science Foundation of the United States of America, and all the member companies of the Carnegie Mellon Sphinx Speech Consortium πŸ’œ and a big one to the many volunteers who kept expanding and improving this dictionary β€” icons only πŸ‘‘

🏷️ Brown tagger

the part-of-speech data came from the Brown tagger β€” and here's a cute little plot twist: the tagger built into this model is not the Brown tagger, so its first sentence is inaccurate πŸ™ˆ noted, moving on. its licence is also reproduced below:

This software was written by Eric Brill.

This software is being provided to you, the LICENSEE, by the
Massachusetts Institute of Technology (M.I.T.) under the following
license.  By obtaining, using and/or copying this software, you agree
that you have read, understood, and will comply with these terms and
conditions:

Permission to [use, copy, modify and distribute, including the right to
grant others rights to distribute at any tier, this software and its
documentation for any purpose and without fee or royalty] is hereby
granted, provided that you agree to comply with the following copyright
notice and statements, including the disclaimer, and that the same
appear on ALL copies of the software and documentation, including
modifications that you make for internal use or for distribution:

Copyright 1993 by the Massachusetts Institute of Technology and the
University of Pennsylvania.  All rights reserved.

THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS
OR WARRANTIES, EXPRESS OR IMPLIED.  By way of example, but not
limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.

The name of the Massachusetts Institute of Technology or M.I.T. may NOT
be used in advertising or publicity pertaining to distribution of the
software.  Title to copyright in this software and any associated
documentation shall at all times remain with M.I.T., and USER agrees to
preserve same.
note the ALL CAPS bits β€” that's not me being dramatic for the aesthetic, that's the actual legal emphasis, and yes M.I.T. really did write it that way πŸ’€ respect the commitment fr fr.

and that's the whole page bestie!! πŸŽ‰ you made it all the way to the end of Lingua::...t::Shaw(3) β€” this was perl v5.42.0, dated 2025-07-25, and you absolutely ate that read-through. go forth and transliterate something iconic πŸŒˆπŸ’–βœ¨ periodt.

πŸ“¦ where this page comes from