示例#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

}
示例#2
0
void ParagraphBoundariesFinder::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* /*manager*/)

{
  /** @addtogroup ProcessUnitConfiguration
   * - <b>&lt;group name="..." class="ParagraphBoundariesFinder"&gt;</b>
   */  
  try
  {
    m_graph=unitConfiguration.getParamsValueAtKey("graph");
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& )
  {
    // optional: keep default
  }

  try
  {
    m_paragraphSeparator=Common::Misc::utf8stdstring2limastring(unitConfiguration.getParamsValueAtKey("paragraphSeparator"));
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& )
  {
    // optional: keep default
  }
}
示例#3
0
//***********************************************************************
void SpecificEntitiesLoader::
init(Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
          Manager* manager)
  
{
  LOGINIT("LP::SpecificEntities");

  m_language=manager->getInitializationParameters().media;
  
  AnalysisLoader::init(unitConfiguration,manager);
  try {
    m_graph=unitConfiguration.getParamsValueAtKey("graph");
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) {} // keep default value

  try {
    // may need to initialize a modex, to know about the entities in external file
    deque<string> modex=unitConfiguration.getListsValueAtKey("modex");
    for (deque<string>::const_iterator it=modex.begin(),it_end=modex.end();it!=it_end;it++) {
      LDEBUG << "loader: initialize modex " << *it;
      string filename=Common::MediaticData::MediaticData::single().getConfigPath()+"/"+*it;
      Common::XMLConfigurationFiles::XMLConfigurationFileParser parser(filename);
      Common::MediaticData::MediaticData::changeable().initEntityTypes(parser);
    }
  }
  catch (Common::XMLConfigurationFiles::NoSuchList& ) {
    LWARN << "loader: no modex specified in parameter: types in file loaded may not be known";
  }

  //  Create a SAX parser object. 
  m_parser = new QXmlSimpleReader();
}
示例#4
0
void GreedyPosTagger::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)

{
  /** @addtogroup ProcessUnitConfiguration
   * - <b>&lt;group name="..." class="GreedyPosTagger"&gt;</b>
   *    -  trigramMatrix : TrigramMatrix resource
   *    -  bigramMatrix : BigramMatrix resource
   *    -  ponctuforte : micro category for ponctu forte. default : 'PONCTU_FORTE'
   */
  PTLOGINIT;
  m_language=manager->getInitializationParameters().media;
  m_macroAccessor=&(static_cast<const Common::MediaticData::LanguageData&>(Common::MediaticData::MediaticData::single().mediaData(m_language)).getPropertyCodeManager().getPropertyAccessor("MACRO"));
  m_microAccessor=&(static_cast<const Common::MediaticData::LanguageData&>(Common::MediaticData::MediaticData::single().mediaData(m_language)).getPropertyCodeManager().getPropertyAccessor("MICRO"));
  try
  {
    string trigrams=unitConfiguration.getParamsValueAtKey("trigramMatrix");
    AbstractResource* res=LinguisticResources::single().getResource(m_language,trigrams);
    m_trigramMatrix=static_cast<TrigramMatrix*>(res);
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& )
  {
    LERROR << "No param 'trigramMatrix' in GreedyPosTagger 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<BigramMatrix*>(res);
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& )
  {
    LWARN << "No param 'bigramMatrix' in GreedyPosTagger group for language " << (int)m_language;
    throw InvalidConfiguration();
  }

  try
  {
    std::string id=unitConfiguration.getParamsValueAtKey("ponctuforte");
    m_microCatPonctuForte=static_cast<const Common::MediaticData::LanguageData&>(Common::MediaticData::MediaticData::single().mediaData(m_language)).getPropertyCodeManager().getPropertyManager("MICRO").getPropertyValue(id);
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& )
  {
    LWARN << "No ponctuforte microcateg category for GreedyPosTagger ! use category PONCTU_FORTE";
    m_microCatPonctuForte=static_cast<const Common::MediaticData::LanguageData&>(Common::MediaticData::MediaticData::single().mediaData(m_language)).getPropertyCodeManager().getPropertyManager("MICRO").getPropertyValue("PONCTU_FORTE");
  }

}
void EnchantSpellingAlternatives::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)
{
  MORPHOLOGINIT;
  m_d->m_language = manager->getInitializationParameters().media;
  try
  {
    m_d->m_enchantDictionary = enchant::Broker::instance()->request_dict(Common::MediaticData::MediaticData::changeable().getMediaId(m_d->m_language).substr(0,2));
  }
  catch (enchant::Exception& e)
  {
    LERROR << "Cannot get Enchant dictionary for language" << Common::MediaticData::MediaticData::changeable().getMediaId(m_d->m_language);
    throw LimaException();
  }
  try
  {
    std::string dico=unitConfiguration.getParamsValueAtKey("dictionary");
    AbstractResource* res= LinguisticResources::single().getResource(m_d->m_language,dico);
    m_d->m_dictionary=static_cast<AbstractAnalysisDictionary*>(res);
  }
  catch (NoSuchParam& )
  {
    LERROR << "no param 'dictionary' in EnchantSpellingAlternatives group for language " << (int) m_d->m_language;
    throw InvalidConfiguration();
  }
}
示例#6
0
/** @addtogroup ResourceConfiguration
 * - <b>&lt;group name="..." class="SentenceBoundsFinder"&gt;</b>
 */
void StopList::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
                     Manager* manager)

{
  LIMA_UNUSED(manager);
  DUMPERLOGINIT;
  const string& resourcesPath=Common::MediaticData::MediaticData::single().getResourcesPath();
  string stopListFileName;
  try
  {
    stopListFileName=resourcesPath+"/"+unitConfiguration.getParamsValueAtKey("file");
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& )
  {
    LERROR << "No param 'file' in StopList configuration group ! ";
    throw InvalidConfiguration();
  }

  std::ifstream stopListFile(stopListFileName.c_str(), std::ifstream::binary);
  if (!stopListFile) {
    LERROR << "invalid file " << stopListFileName;
    throw InvalidConfiguration();
  }
  
  LimaString wword = Common::Misc::utf8stdstring2limastring(Common::Misc::readLine(stopListFile));
  LDEBUG << "Loading stop list file: " << stopListFileName;
  while (!wword.isEmpty())
  {
    insert(wword);
    wword = Common::Misc::utf8stdstring2limastring(Common::Misc::readLine(stopListFile));
  }
}
示例#7
0
void FsaAccessResource::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)
{
  /** @addtogroup ResourceConfiguration
   * - <b>&lt;group name="..." class="FsaAccess"&gt;</b>
   *    -  keyFile : file containing the compiled access keys
   */
    
  ANALYSISDICTLOGINIT;
  try
  {
    string keyfile=Common::MediaticData::MediaticData::single().getResourcesPath() + "/" + unitConfiguration.getParamsValueAtKey("keyFile");
    FsaAccess::FsaAccessSpare16* fsaAccess=new FsaAccess::FsaAccessSpare16();
    LDEBUG << "FsaAccessResource::init read keyFile" << keyfile.c_str();
    fsaAccess->read(keyfile);
    m_fsaAccess=fsaAccess;
  }
  catch (NoSuchParam& )
  {
    LERROR << "no param 'keyFile' in FsaAccessResource group for language " << (int)  manager->getInitializationParameters().language << LENDL;
    throw InvalidConfiguration();
  }
  catch (AccessByStringNotInitialized& )
  {
    LERROR << "keyfile "
           << Common::MediaticData::MediaticData::single().getResourcesPath()
           << "/"
           << unitConfiguration.getParamsValueAtKey("keyFile")
           << " no found for language " 
           << (int)  manager->getInitializationParameters().language << LENDL;
    throw InvalidConfiguration();
  }
}
示例#8
0
//***********************************************************************
void CRFSegmentLoader::init(Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
                            Manager* manager)

{
    AnalysisLoader::init(unitConfiguration,manager);

    try {
        m_dataName=unitConfiguration.getParamsValueAtKey("data");
    }
    catch (Common::XMLConfigurationFiles::NoSuchParam& ) {} // keep default value

    try {
        m_fromDataName=unitConfiguration.getParamsValueAtKey("fromData");
    }
    catch (Common::XMLConfigurationFiles::NoSuchParam& ) {} // keep default value

}
void SyntacticAnalyzerSimplify::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)

{
  m_language=manager->getInitializationParameters().media;
  std::string rules=unitConfiguration.getParamsValueAtKey("simplifyAutomaton");
  m_recognizer = static_cast<Automaton::Recognizer*>(LinguisticResources::single().getResource(m_language,rules));
}
示例#10
0
void OrthographicAlternatives::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)
{
  MORPHOLOGINIT;
  m_language = manager->getInitializationParameters().language;
  try
  {
    string dico=unitConfiguration.getParamsValueAtKey("dictionary");
    AbstractResource* res= LinguisticResources::single().getResource(m_language,dico);
    m_dictionary=static_cast<AbstractAnalysisDictionary*>(res);
  }
  catch (NoSuchParam& )
  {
    LERROR << "no param 'dictionary' in OrthographicAlternatives group for language " << (int) m_language;
    throw InvalidConfiguration();
  }

  try
  {
    string dico=unitConfiguration.getParamsValueAtKey("charChart");
    AbstractResource* res= LinguisticResources::single().getResource(m_language,dico);
    m_charChart=static_cast<CharChart*>(res);
  }
  catch (NoSuchParam& )
  {
    LERROR << "no param 'charChart' in OrthographicAlternatives group for language " << (int) m_language;
    throw InvalidConfiguration();
  }

  try
  {
    string confident=unitConfiguration.getParamsValueAtKey("confidentMode");
    m_confidentMode=(confident=="true");
  }
  catch (NoSuchParam& )
  {
    LWARN << "no param 'confidentMode' in OrthographicAlternatives group for language " << (int) m_language;
    LWARN << "use default value : 'true'";
    m_confidentMode=true;
  }

}
示例#11
0
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
}
示例#12
0
//************************************************************************
bool 
getBooleanParameter(Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
                    const std::string& param) {
  string value=unitConfiguration.getParamsValueAtKey(param);
  if (value == "yes" ||
    value == "true" ||
    value == "1") {
    return true;
  }
  return false;
}
示例#13
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");
  }
}
void LinearTextRepresentationDumper::init(
    Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
    Manager* manager) {

    DUMPERLOGINIT;
    m_language = manager->getInitializationParameters().media;
    // a stop list is used ?
    bool useStopList = false;
    try {
        string stopFlag = unitConfiguration.getParamsValueAtKey("useStopList");
        useStopList = (stopFlag == "true");
    }
    catch (NoSuchParam& ) {
        LWARN << "No param 'useStopList' in ltrDumper configuration group for language "
              << m_language << LENDL;
        LWARN << "use default value: false" << LENDL;
    }

    if (useStopList) {
        try {
            string stoplist = unitConfiguration.getParamsValueAtKey("stopList");
            m_stopList = static_cast<StopList*>(LinguisticResources::single().getResource(m_language, stoplist));
        }
        catch (NoSuchParam& ) {
            LERROR << "LinearTextRepresentationDumper::init:  No param 'stopList' in LinearTextRepresentationDumper configuration group for language " << m_language << LENDL;
            throw InvalidConfiguration();
        }
    }
    else {
        m_stopList = 0;
    }
    try {
      m_handler = unitConfiguration.getParamsValueAtKey("handler");
    }
    catch (NoSuchParam& ) {
      DUMPERLOGINIT;
      LERROR << "LinearTextRepresentationDumper::init: Missing parameter handler in LinearTextRepresentationDumper configuration" << LENDL;
      throw InvalidConfiguration();
    }    
}
示例#15
0
void EasyXmlDumper::init(Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
                         Manager* manager)
{
  DUMPERLOGINIT;
  LDEBUG << "EasyXmlDumper:: easyXmlDumper init!";
  m_language = manager->getInitializationParameters().media;
  m_propertyCodeManager = &(static_cast<const Common::MediaticData::LanguageData&>(Common::MediaticData::MediaticData::single().mediaData(m_language)).getPropertyCodeManager());
  try
  {
    m_typeMapping = unitConfiguration.getMapAtKey("typeMapping");
    m_srcTag = unitConfiguration.getMapAtKey("srcTag");
    m_tgtTag = unitConfiguration.getMapAtKey("tgtTag");
  }
  catch (NoSuchParam& )
  {
    LERROR << "EasyXmlDumper::init: parameter not found (typeMapping, srcTag and tgtTag must be specified)";
    return;
  }
  try
  {
    m_graph = unitConfiguration.getParamsValueAtKey("graph");
  }
  catch (NoSuchParam& )
  {
    LDEBUG << "EasyXmlDumper:: graph parameter not found, using PosGraph";
    m_graph = string("PosGraph");
  }
  try
  {
    m_handler=unitConfiguration.getParamsValueAtKey("handler");
  }
  catch (NoSuchParam& )
  {
    DUMPERLOGINIT;
    LERROR << "EasyXmlDumper::init: Missing parameter handler in EasyXmlDumper configuration";
    throw InvalidConfiguration();
  }
}
//***********************************************************************
void AbstractTextualAnalysisDumper::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)
  
{
  m_language = manager->getInitializationParameters().media;

  try
  {
    m_handlerName=unitConfiguration.getParamsValueAtKey("handler");
  }
  catch (NoSuchParam& )  { }  // do nothing, optional

  try
  {
    m_outputSuffix=unitConfiguration.getParamsValueAtKey("outputSuffix");
  }
  catch (NoSuchParam& ) {} // do nothing, optional

  try
  {
    m_outputFile=unitConfiguration.getParamsValueAtKey("outputFile");
  }
  catch (NoSuchParam& ) {} // do nothing, optional

  try
  {
    string val=unitConfiguration.getParamsValueAtKey("append");
    if (val=="true" || val=="yes" || val=="1") {
      m_append=true;
    }
    else {
      m_append=false;
    }
  }
  catch (NoSuchParam& ) {} // keep default value
}
示例#17
0
//***********************************************************************
void SegmentationDataXmlLogger::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)

{
  LOGINIT("LP::Segmentation");
  LDEBUG << "SegmentationDataXmlLogger::init" << LENDL;

  AbstractLinguisticLogger::init(unitConfiguration,manager);

  try {
    m_data=unitConfiguration.getParamsValueAtKey("data");
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) {} // do nothing, keep default
}
示例#18
0
void FullTokenXmlLogger::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)

{
  AbstractLinguisticLogger::init(unitConfiguration,manager);
  try
  {
    m_graphId=unitConfiguration.getParamsValueAtKey("graph");
  }
  catch (NoSuchParam& )
  {
    m_graphId=string("AnalysisGraph");
  }
  m_language=manager->getInitializationParameters().media;
  m_propertyCodeManager= &(static_cast<const Common::MediaticData::LanguageData&>(Common::MediaticData::MediaticData::single().mediaData(m_language)).getPropertyCodeManager());
}
//***********************************************************************
void EventTemplateDataXmlLogger::init(Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
                          Manager* manager)
  
{
  LOGINIT("LP::EventAnalysis");
  LDEBUG << "EventTemplateDataXmlLogger::init";

  AbstractTextualAnalysisDumper::init(unitConfiguration,manager);

  try {
    m_eventData=unitConfiguration.getParamsValueAtKey("eventTemplateData");
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) {
    LDEBUG << "EventTemplateDataXmlLogger: no parameter 'eventTemplateData', use default ('"<<m_eventData << "')";
    // not an error, keep default
  }
}
示例#20
0
void WordSenseXmlLogger::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)

{
  AbstractLinguisticLogger::init(unitConfiguration,manager);
  try
  {
    // DTD
    m_outputSuffix=unitConfiguration.getParamsValueAtKey("outputSuffix");
  }
  catch (NoSuchParam& )
  {
    m_outputSuffix=string(".senses")+".xml";
  }
  m_language=manager->getInitializationParameters().media;


}
示例#21
0
void CorefSolvingXmlLogger::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)

{
  AbstractLinguisticLogger::init(unitConfiguration,manager);
  try
  {
    // DTD
    m_outputSuffix=unitConfiguration.getParamsValueAtKey("outputSuffix")+".xml";
  }
  catch (NoSuchParam& )
  {
    m_outputSuffix=string(".coref")+".xml";
  }
  m_language=manager->getInitializationParameters().media;


  //m_propertyCodeManager= &(static_cast<const Common::MediaticData::LanguageData&>(Common::MediaticData::MediaticData::single().mediaData(m_language)).getPropertyCodeManager());
}
示例#22
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;
  }
  
}
示例#23
0
void GeoDumper::init(Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
                      Manager* manager)

{
  m_language=manager->getInitializationParameters().media;
  std::string m_graph;  try
  {
    m_graph=unitConfiguration.getParamsValueAtKey("graph");
  }
  catch (NoSuchParam& ) { } // optional (default value exists)
  // read handler in conf file
  try
  {
    m_handler=unitConfiguration.getParamsValueAtKey("handler");
  }
  catch (NoSuchParam& )
  {
    DUMPERLOGINIT;
    LERROR << "GeoDumper::init: Missing parameter handler in BowDumper configuration";
    throw InvalidConfiguration();
  }

  //optional parameters to configure output format
  try { 
    m_sep=unitConfiguration.getParamsValueAtKey("separator"); 
  } 
  catch (NoSuchParam) { } 
  try { 
    m_sepPOS=unitConfiguration.getParamsValueAtKey("separatorPOS"); 
  } 
  catch (NoSuchParam) { }
  try { 
    std::string str=unitConfiguration.getParamsValueAtKey("printPosition"); 
    if (str=="1" || str=="yes") { m_printPosition=true; }
  }
  catch (NoSuchParam&) { }
  try { 
    m_property=unitConfiguration.getParamsValueAtKey("property"); 
  }
  catch (NoSuchParam&) { }
  

m_propertyAccessor=&static_cast<const Common::MediaticData::LanguageData&>(Common::MediaticData::MediaticData::single().mediaData(m_language)).getPropertyCodeManager().getPropertyAccessor(m_property);
  m_propertyManager=&static_cast<const Common::MediaticData::LanguageData&>(Common::MediaticData::MediaticData::single().mediaData(m_language)).getPropertyCodeManager().getPropertyManager(m_property);  

}
示例#24
0
文件: Automaton.cpp 项目: aymara/lima
void Automaton::init(
                     Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
                     Manager* manager)
    
{
  TOKENIZERLOGINIT;
  LDEBUG << "Creating a Tokenizer Automaton (loads file)";
  MediaId language=manager->getInitializationParameters().language;

  try {
    QString charChartFileName=Common::Misc::findFileInPaths(Common::MediaticData::MediaticData::single().getResourcesPath().c_str(),unitConfiguration.getParamsValueAtKey("automatonFile").c_str());
    loadFromFile(charChartFileName.toUtf8().constData());
  } catch (Common::XMLConfigurationFiles::NoSuchParam& )
  {
    LERROR << "no parameter 'automatonFile' in tokenizer group for language " << (int) language << " !";
    throw InvalidConfiguration();
  }
}
示例#25
0
void ExternalProcessUnit::init(
  Common::XMLConfigurationFiles::GroupConfigurationStructure& unitConfiguration,
  Manager* manager)

{
  LOGINIT("LP:External");
  LDEBUG << "Initialization" << LENDL;

  MediaId language=manager->getInitializationParameters().media;
  try {
    string dumperName=unitConfiguration.getParamsValueAtKey("dumper");
    // create the dumper
    m_dumper=manager->getObject(dumperName);
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) {
    LERROR << "Missing 'dumper' parameter in ExternalProcessUnit group for language "
           << (int)language << " !" << LENDL;
    throw InvalidConfiguration();
  }

  try {
    string loaderName=unitConfiguration.getParamsValueAtKey("loader");
    // create the loader
    m_loader=manager->getObject(loaderName);
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) {
    LERROR << "Missing 'loader' parameter in ExternalProcessUnit group for language "
           << (int)language << " !" << LENDL;
    throw InvalidConfiguration();
  }

  try {
    m_useTemporaryFile=getBooleanParameter(unitConfiguration,"useTmpFile");
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) {
    // optional parameter: keep default value
  }

  try {
    m_cleanTemporaryFile=getBooleanParameter(unitConfiguration,"cleanTmpFile");
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) {
    // optional parameter: keep default value
  }

  try {
    m_tmpFileName=unitConfiguration.getParamsValueAtKey("tmpFileName");
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) {
    // optional parameter: keep default value
  }

  try {
    m_commandLine=unitConfiguration.getParamsValueAtKey("command");
  }
  catch (Common::XMLConfigurationFiles::NoSuchParam& ) {
    LERROR << "Missing 'command' parameter in ExternalProcessUnit group for language "
           << (int)language << " !" << LENDL;
    throw InvalidConfiguration();
  }
}
示例#26
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& ) {}
}