SpecificEntityAnnotation::
SpecificEntityAnnotation(const RecognizerMatch& entity,
                         FsaStringsPool& sp) :
m_head(0),
m_type(entity.getType()),
m_features(entity.features()),
m_string(sp[entity.getString()]),
m_normalizedString(sp[entity.getNormalizedString(sp)]),
m_normalizedForm(0),
m_position(entity.positionBegin()),
m_length(entity.length())
{
  Automaton::EntityFeatures::const_iterator 
    f=entity.features().find(DEFAULT_ATTRIBUTE);
  if (f!=entity.features().end()) {
    m_normalizedForm=sp[boost::any_cast<const LimaString&>((*f).getValue())];
  }

  if (entity.getHead() == 0)
  {
    m_head = entity[0].m_elem.first;
  }
  else
  {
    m_head = entity.getHead();
  }

  m_vertices.reserve(entity.size());

  Automaton::RecognizerMatch::const_iterator it, it_end;
  it = entity.begin(); it_end = entity.end();
  for (; it != it_end; it++)
  {
    if ( (*it).m_elem.second )
    {
      m_vertices.push_back((*it).m_elem.first);
    }
  }
}