float GlobalLexicalModel::GetFromCacheOrScorePhrase( const TargetPhrase& targetPhrase ) const
{
  LexiconCache& m_cache = m_local->cache;
  const LexiconCache::const_iterator query = m_cache.find( &targetPhrase );
  if ( query != m_cache.end() ) {
    return query->second;
  }

  float score = ScorePhrase( targetPhrase );
  m_cache.insert( pair<const TargetPhrase*, float>(&targetPhrase, score) );
  //VERBOSE(2, "add to cache " << targetPhrase << ": " << score << endl);
  return score;
}
float GlobalLexicalModel::GetFromCacheOrScorePhrase( const TargetPhrase& targetPhrase ) const
{
	map< const TargetPhrase*, float >::const_iterator query = m_cache->find( &targetPhrase );
	if ( query != m_cache->end() )
	{
		return query->second;
	}
	
	float score = ScorePhrase( targetPhrase );
	m_cache->insert( pair<const TargetPhrase*, float>(&targetPhrase, score) );
	std::cerr << "add to cache " << targetPhrase << ": " << score << endl;
	return score;
}