[decode_koremutake]

Description

Link: [decode_koremutake]
Author: Johan Sölve
Category: Encoding
Version: 8.x
License: Public Domain
Posted: Feb. 12, 2008
Updated: Jul. 09, 2008
More by this author...
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.

Parameters

-input string, required

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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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

none

Email:


Password:



Newest

Most Popular