Lasso Soft Inc. > Home

[decode_koremutake]

Linkdecode_koremutake
AuthorJohan Solve
CategoryEncoding
Version8.x
LicensePublic Domain
Posted12 Feb 2008
Updated09 Jul 2008
More by this author...

Description

This tag decodes a Koremutake-encoded memorable string into an integer.

The term "Memorable Random String" was thought up by Sean B. Palmer as a name for those strings like dopynl, glargen, glonknic, spoopwiddle, and kebble etc. that dont have any conventional sense, but can be used as random identifiers, especially in URIs to keep them persistent. See http://infomesh.net/2001/07/MeRS/

Koremutake is a MeRS algorithm which is used by Shorl (http://shorl.com/koremutake). As they explain: "It is, in plain language, a way to express any large number as a sequence of syllables. The general idea is that word-sounding pieces of information are a lot easier to remember than a sequence of digits."

The tag returns -1 if an invalid string is provided.

Sample Usage

decode_koremutake: 'ROMENABRA';

Result: 145513306

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

define_tag: 'decode_koremutake', -description='Decodes a Koremutake Memorable Random String string into an integer, see http://infomesh.net/2001/07/MeRS and http://shorl.com/koremutake',
	-required='input', -type='string', -copy;

	// http://shorl.com/koremutake

	local: 'phonemes'='BA BE BI BO BU BY DA DE DI DO DU DY FA FE FI FO FU FY GA GE GI GO GU GY HA HE HI HO HU HY JA JE JI JO JU JY KA KE KI KO KU KY LA LE LI LO LU LY MA ME MI MO MU MY NA NE NI NO NU NY PA PE PI PO PU PY RA RE RI RO RU RY SA SE SI SO SU SY TA TE TI TO TU TY VA VE VI VO VU VY BRA BRE BRI BRO BRU BRY DRA DRE DRI DRO DRU DRY FRA FRE FRI FRO FRU FRY GRA GRE GRI GRO GRU GRY PRA PRE PRI PRO PRU PRY STA STE STI STO STU STY TRA TRE' 
		-> split(' ');
	
	local: 'base' = #phonemes -> size - 1,
		'output'=integer,
		'input_syllables'=array,
		'syllable_temp'=string;

	#syllable_temp=string;
	iterate: #input, local: 'char';
		#syllable_temp += #char;
		if: 'AEIOUY' >> #char;
			#input_syllables -> insert(#syllable_temp);
			#syllable_temp=string;
		/if;
	/iterate;
	#syllable_temp -> size ? #input_syllables -> insert(#syllable_temp);
	iterate: #input_syllables, #syllable_temp;
		#phonemes !>> #syllable_temp ? return: -1;
		#output += #base * #output + (#phonemes -> findindex(#syllable_temp) -> first - 1);
	/iterate;
	return: #output;
/define_tag;

Related Tags

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft