KwTermEqual Class Reference
Collaboration diagram for KwTermEqual:

Public Member Functions

 KwTermEqual (const int max_distance, const KwsTerm &inst)
 
bool operator() (const KwsTerm &left, const KwsTerm &right)
 
bool operator() (const KwsTerm &right)
 

Private Attributes

const int max_distance_
 
const KwsTerm inst_
 

Detailed Description

Definition at line 46 of file kws-scoring.cc.

Constructor & Destructor Documentation

◆ KwTermEqual()

KwTermEqual ( const int  max_distance,
const KwsTerm inst 
)
inline

Definition at line 48 of file kws-scoring.cc.

48  :
49  max_distance_(max_distance), inst_(inst) {}

Member Function Documentation

◆ operator()() [1/2]

bool operator() ( const KwsTerm left,
const KwsTerm right 
)
inline

Definition at line 51 of file kws-scoring.cc.

References KwsTerm::end_time(), KwsTerm::kw_id(), KwsTerm::start_time(), and KwsTerm::utt_id().

51  {
52  bool ret = true;
53 
54  ret &= (left.kw_id() == right.kw_id());
55  ret &= (left.utt_id() == right.utt_id());
56 
57  float center_left = (left.start_time() + left.end_time())/2;
58  float center_right = (right.start_time() + right.end_time())/2;
59 
60 // This was an old definition of the criterion "the hyp is within
61 // max_distance_ area from the ref". The positive thing about the
62 // definition is, that it allows binary search through the collection
63 // ret &= fabs(left.tbeg - right.tbeg) <= max_distance_;
64 // ret &= fabs(left.tend - right.tend) <= max_distance_;
65 
66 // This is the newer definition -- should be equivalent to what F4DE uses
67  ret &= fabs(center_left - center_right) <= max_distance_;
68 
69  return ret;
70  }

◆ operator()() [2/2]

bool operator() ( const KwsTerm right)
inline

Definition at line 72 of file kws-scoring.cc.

72  {
73  return (*this)(inst_, right);
74  }

Member Data Documentation

◆ inst_

const KwsTerm inst_
private

Definition at line 78 of file kws-scoring.cc.

◆ max_distance_

const int max_distance_
private

Definition at line 77 of file kws-scoring.cc.


The documentation for this class was generated from the following file: