<commit_before><?php
function getGlyphFilename( $glyphname ) {
	return __DIR__ . '/glyphs/' . $glyphname . '.png';
}

function glyphExists( $glyphname ) {
	return file_exists( getGlyphFilename( $glyphname ) );
}

if ( !empty( $_POST['glyphs'] ) ) {
	$input = explode( ' ', strtolower( trim( $_POST['glyphs'] ) ) );

	$glyphs = array();
	$linesize = 20;

	if ( !empty( $_POST['wrap'] ) ) {
		$linesize = $_POST['wrap'];
	}

	foreach ( $input as $glyph ) {
		if ( glyphExists( $glyph ) ) {
			$glyphs[] = $glyph;
		}
	}

	$im = new Imagick();

	foreach ( $glyphs as $glyph ) {
		$handle = file_get_contents( __DIR__ . '/glyphs/' . $glyph . '.png' );
		$im->readImageBlob( $handle );
	}

	$im->resetIterator();

	$draw = new ImagickDraw();

	$size = sizeof( $glyphs );

	if ( $size > $linesize ) {
		$size = $linesize;
	}

	$montage = $im->montageImage( $draw, $size . 'x', '50x55+0+0', imagick::MONTAGEMODE_UNFRAME, '0x0+0+0' );
	$montage->setImageFormat( 'png' );
	$montage->setImageBackgroundColor( 'rgba(0,0,0,255)' );

	header( 'Content-Type: image/png' );
	echo $montage;
} else {
?>
<html>
	<body>
		<form method="POST">
			<p>
				<label for="glyphs">Input a sentence with glyph names in it:</label>
				<input name="glyphs" id="glyphs" />
			</p>
			<p>
				<label for="wrap">How many glyphs per line?</label>
				<input name="wrap" id="wrap" />
			</p>

			<p>
				<input type="submit" value="Generate glyph sentence" />
			</p>
		</form>
	</body>
</html>
<?php
}
<commit_msg>Add note about glyph image source<commit_after><?php
function getGlyphFilename( $glyphname ) {
	return __DIR__ . '/glyphs/' . $glyphname . '.png';
}

function glyphExists( $glyphname ) {
	return file_exists( getGlyphFilename( $glyphname ) );
}

if ( !empty( $_POST['glyphs'] ) ) {
	$input = explode( ' ', strtolower( trim( $_POST['glyphs'] ) ) );

	$glyphs = array();
	$linesize = 20;

	if ( !empty( $_POST['wrap'] ) ) {
		$linesize = $_POST['wrap'];
	}

	foreach ( $input as $glyph ) {
		if ( glyphExists( $glyph ) ) {
			$glyphs[] = $glyph;
		}
	}

	$im = new Imagick();

	foreach ( $glyphs as $glyph ) {
		$handle = file_get_contents( __DIR__ . '/glyphs/' . $glyph . '.png' );
		$im->readImageBlob( $handle );
	}

	$im->resetIterator();

	$draw = new ImagickDraw();

	$size = sizeof( $glyphs );

	if ( $size > $linesize ) {
		$size = $linesize;
	}

	$montage = $im->montageImage( $draw, $size . 'x', '50x55+0+0', imagick::MONTAGEMODE_UNFRAME, '0x0+0+0' );
	$montage->setImageFormat( 'png' );
	$montage->setImageBackgroundColor( 'rgba(0,0,0,255)' );

	header( 'Content-Type: image/png' );
	echo $montage;
} else {
?>
<html>
	<body>
		<form method="POST">
			<p>
				<label for="glyphs">Input a sentence with glyph names in it:</label>
				<input name="glyphs" id="glyphs" />
			</p>
			<p>
				<label for="wrap">How many glyphs per line?</label>
				<input name="wrap" id="wrap" />
			</p>

			<p>
				<input type="submit" value="Generate glyph sentence" />
			</p>
		</form>

		<p style="font-size: small;">
			Glyph images from <a href="http://ingress.tv/glyphs.html">ingress.tv</a>, please be courteous when sharing their hard work and consider attributing them.
		</p>
	</body>
</html>
<?php
}

{'fraction_non_alphanumeric': 0.2054665409990575, 'fraction_numerical': 0.011310084825636193, 'mean_word_length': 3.581294964028777, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6358514', 'n_tokens_mistral': 1394, 'n_tokens_neox': 1231, 'n_words': 280}