public function writeLanguageFile( $ngrams, $outfile ) {
		$out = fopen( $outfile, "w" );
		// write original array as "$ngrams"
		fwrite( $out, '<?php $ngrams = ' . var_export( $ngrams, true ) . ";\n" );
		// write reduced array as "$ranks"
		$rank = 1;
		$ranks = array_map( function ( $x ) use ( &$rank ) {
			return $rank++;
		}, $ngrams );
		fwrite( $out, '$ranks = ' . var_export( $ranks, true ) . ";\n" );
		fclose( $out );
	}
public function writeLanguageFile( $ngrams, $outfile ) {
		$out = fopen( $outfile, "w" );
		// write original array as "$ngrams"
		fwrite( $out, '<?php $ngrams = ' . var_export( $ngrams, true ) . ";\n" );
		// write reduced array as "$ranks"
		$rank = 1;
		$ranks = array_map( function ( $x ) use ( &$rank ) {
			return $rank++;
		}, $ngrams );
		fwrite( $out, '$ranks = ' . var_export( $ranks, true ) . ";\n" );
		fclose( $out );
	}
public function writeLanguageFile ( $ ngrams , $ outfile ) { $ out = fopen ( $ outfile , "w" ) ; // write original array as "$ngrams" fwrite ( $ out , '<?php $ngrams = ' . var_export ( $ ngrams , true ) . ";\n" ) ; // write reduced array as "$ranks" $ rank = 1 ; $ ranks = array_map ( function ( $ x ) use ( & $ rank ) { return $ rank ++ ; } , $ ngrams ) ; fwrite ( $ out , '$ranks = ' . var_export ( $ ranks , true ) . ";\n" ) ; fclose ( $ out ) ; }
Write ngrams to file in PHP format
@param int[] $ngrams
@param string $outfile Output filename
Write ngrams to file in PHP format