Example #1
0
	/**
	 * decoupled from the type of dictionary provided at the expense
	 * of no longer being a "one-file" program
	 */
	public function __construct( $dict_path, $force = false ) {
		$this->alphabet = str_split( $this->alphabet );
		$words = new WordTrainer( $dict_path, $force );
		$this->freq = $words->getFrequencies();
	}
	public function test_can_train_with_array() {
		$w = new WordTrainer( array( "this", "is", "a", "string", "of", "words" ) );
		$this->assertTrue( in_array( "string", array_keys( $w->getFrequencies() ) ) );
		$this->assertTrue( in_array( "this", array_keys( $w->getFrequencies() ) ) );
		$this->assertTrue( in_array( "words", array_keys( $w->getFrequencies() ) ) );
	}