Beispiel #1
0
void EntityTrackerXmlLogger::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)

{
  SELOGINIT;
  LDEBUG << "EntityTrackerXmlLogger::init";
  AbstractLinguisticLogger::init(unitConfiguration,manager);

  m_language=manager->getInitializationParameters().media;

  try
  {
    m_graph=unitConfiguration.getParamsValueAtKey("graph");
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& )
  {
    SELOGINIT;
    LWARN << "No 'graph' parameter in unit configuration '"
        << unitConfiguration.getName() << "' ; using AnalysisGraph";
    m_graph=string("AnalysisGraph");
  }
  try
  {
    string val=unitConfiguration.getParamsValueAtKey("compactFormat");
    if (val=="yes" || val=="true" || val=="1") {
      m_compactFormat=true;
    }
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) {} // do nothing: optional

}
Beispiel #2
0
void SimpleEventBuilder::init(Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
                              Manager* manager)

{

  EVENTANALYZERLOGINIT;
  MediaId language=manager->getInitializationParameters().media;
  try
  {
    m_segmData=unitConfiguration.getParamsValueAtKey("segmentationData");
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) 
  {
    LERROR << "No segmentationData specified in "<<unitConfiguration.getName()
           <<" configuration group for language " << language << LENDL;
  }
  
  try
  {
    m_segmentType=unitConfiguration.getParamsValueAtKey("segmentType");
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) 
  {
    LERROR << "No segmentType specified in "<<unitConfiguration.getName()
           <<" configuration group for language " << language << LENDL;
  }

  try
  {
    deque<string> entities = unitConfiguration.getListsValueAtKey("entities");
    for(deque<string>::iterator it=entities.begin(),it_end=entities.end();it!=it_end;it++)
    {
      try {
        m_entities.push_back(Common::MediaticData::MediaticData::single().getEntityType(Common::Misc::utf8stdstring2limastring(*it)));
      }
      catch (LimaException& ) {
        LERROR << "Error: unknown entity type '"<< *it << "' : ignored" << LENDL;
      }
    }
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) 
  {
    LERROR << "No entities specified in "<<unitConfiguration.getName()
           <<" configuration group for language " << language << LENDL;
  }
  
}
void SpecificEntitiesXmlLogger::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)

{
  SELOGINIT;
  LDEBUG << "SpecificEntitiesXmlLogger::init";
  AbstractTextualAnalysisDumper::init(unitConfiguration,manager);

  m_language=manager->getInitializationParameters().media;

  try
  {
    m_graph=unitConfiguration.getParamsValueAtKey("graph");
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& )
  {
    SELOGINIT;
    LWARN << "No 'graph' parameter in unit configuration '"
        << unitConfiguration.getName() << "' ; using PosGraph";
    m_graph=string("PosGraph");
  }
  try
  {
    string val=unitConfiguration.getParamsValueAtKey("compactFormat");
    if (val=="yes" || val=="true" || val=="1") {
      m_compactFormat=true;
    }
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) {} // do nothing: optional

  try { 
    std::string str=unitConfiguration.getParamsValueAtKey("followGraph"); 
    if (str=="1" || str=="true" || str=="yes") {
      m_followGraph=true;
    }
    else {
      m_followGraph=false;
    }
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) {} // keep default value
}
Beispiel #4
0
void SemanticRelationsXmlLogger::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)

{
  AbstractLinguisticLogger::init(unitConfiguration,manager);

  m_language=manager->getInitializationParameters().language;

  try
  {
    m_graph=unitConfiguration.getParamsValueAtKey("graph");
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& )
  {
    SEMLOGINIT;
    LWARN << "No 'graph' parameter in unit configuration '"
        << unitConfiguration.getName() << "' ; using PosGraph" << LENDL;
    m_graph=string("PosGraph");
  }
}
Beispiel #5
0
void DotGraphWriter::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)

{
  /** @addtogroup ProcessUnitConfiguration
   * - <b>&lt;group name="..." class="DotGraphWriter"&gt;</b>
   *    -  trigramMatrix : TrigramMatrix resource
   *    -  bigramMatrix : BigramMatrix resource
   *    -  outputSuffix : suffix for output file name. Default : '.graph.dot'
   */
  PTLOGINIT;
  m_language=manager->getInitializationParameters().media;
  try {
    string trigrams=unitConfiguration.getParamsValueAtKey("trigramMatrix");
    AbstractResource* res=LinguisticResources::single().getResource(m_language,trigrams);
    m_trigramMatrix=static_cast<PosTagger::TrigramMatrix*>(res);
  } catch (NoSuchParam& ) {
    LERROR << "No param 'trigramMatrix' in DotGraphWriter group for language " << (int)m_language;
    throw InvalidConfiguration();
  }
  try {
    string bigrams=unitConfiguration.getParamsValueAtKey("bigramMatrix");
    AbstractResource* res=LinguisticResources::single().getResource(m_language,bigrams);
    m_bigramMatrix=static_cast<PosTagger::BigramMatrix*>(res);
  } catch (NoSuchParam& ) {
    LWARN << "No param 'bigramMatrix' in DotGraphWriter group for language " << (int)m_language;
    throw InvalidConfiguration();
  }
  try
  {
    m_outputSuffix=unitConfiguration.getParamsValueAtKey("outputSuffix");
  }
  catch (NoSuchParam& )
  {
    LWARN << "No param 'outputSuffix' in DotGraphWriter group for language " << (int)m_language;
    LWARN << "use .graph.dot";
    m_outputSuffix=string(".graph.dot");
  }
  try
  {
    m_graphId=unitConfiguration.getParamsValueAtKey("graph");
  }
  catch (NoSuchParam& )
  {
    LWARN << "No param 'graph' in "<<unitConfiguration.getName() << " group for language " << (int)m_language;
    LWARN << "use PosGraph";
    m_graphId=string("PosGraph");
  }
  try
  {
    m_vertexDisplay=unitConfiguration.getListsValueAtKey("vertexDisplay");
  }
  catch (NoSuchList& )
  {
    // empty display
  }
  try 
  {
    m_graphDotOptions = unitConfiguration.getMapAtKey("graphDotOptions");
  }
  catch (NoSuchMap& ) {}
  
  try 
  {
    m_nodeDotOptions = unitConfiguration.getMapAtKey("nodeDotOptions");
  }
  catch (NoSuchMap& ) {}
  
  try 
  {
    m_edgeDotOptions = unitConfiguration.getMapAtKey("edgeDotOptions");
  }
  catch (NoSuchMap& ) {}
}