示例#1
0
文件: test.php 项目: hctpbl/alizephp
<?php

require __DIR__ . '/../src/AlizePHP.php';
use alizephp\AlizePHP;
$audio_file = "xaaf.pcm";
$speakerrec = new AlizePHP("person", $audio_file);
$speakerrec->cleanUserFiles();
$speakerrec2 = new AlizePHP("person2", $audio_file);
$speakerrec2->cleanUserFiles();
try {
    $speakerrec->extractFeatures();
    $speakerrec->normaliseEnergy();
    $speakerrec->detectEnergy();
    $speakerrec->normaliseFeatures();
    $speakerrec->trainTarget();
    //$speakerrec->ivExtractor();
} catch (Exception $e) {
    print $e->getMessage();
    print $e->getCode();
}
try {
    $speakerrec2->extractFeatures();
    $speakerrec2->normaliseEnergy();
    $speakerrec2->detectEnergy();
    $speakerrec2->normaliseFeatures();
    //$speakerrec2->trainTarget();
    $speakerrec2->computeTest("person");
    //$speakerrec2->ivExtractor();
    //$speakerrec2->ivTest("person");
} catch (Exception $e) {
    print "<pre>" . $e . "</pre>";
示例#2
0
 /**
  * Tries to use the computeTest method to test a user against
  * another, with the former not having a normalised features file
  * generated
  * @expectedException \alizephp\AlizePHPException
  */
 public function testFailComputeTestNoFeatures()
 {
     $otheruser = new AlizePHP($this->nameTwo, $this->filePathTwo);
     $otheruser->trainTarget($this->nameOne);
 }