当前位置: 首页>>代码示例>>C++>>正文


C++ AnalysisContent类代码示例

本文整理汇总了C++中AnalysisContent的典型用法代码示例。如果您正苦于以下问题:C++ AnalysisContent类的具体用法?C++ AnalysisContent怎么用?C++ AnalysisContent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AnalysisContent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: process

// Each token of the specified path is
// searched into the specified dictionary.
LimaStatusCode FullTokenXmlLogger::process(
  AnalysisContent& analysis) const
{
  TimeUtils::updateCurrentTime();
  LinguisticMetaData* metadata=static_cast<LinguisticMetaData*>(analysis.getData("LinguisticMetaData"));
  if (metadata == 0)
  {
    DICTIONARYLOGINIT;
    LERROR << "no LinguisticMetaData ! abort" << LENDL;
    return MISSING_DATA;
  }

  AnalysisGraph* tokenList=static_cast<AnalysisGraph*>(analysis.getData(m_graphId));
  std::ofstream fout;
  if (!openLogFile(fout,metadata->getMetaData("FileName"))) {
    MORPHOLOGINIT;
    LERROR << "Error: cannot open log file" << LENDL;
    return CANNOT_OPEN_FILE_ERROR;
  }

  dump(fout, *tokenList);
  fout.close();
  TimeUtils::logElapsedTime("FullTokenXmlLogger");
  return SUCCESS_ID;
}
开发者ID:pquentin,项目名称:lima,代码行数:27,代码来源:FullTokenXmlLogger.cpp

示例2: addRelations

bool SemanticRelationData::addRelations(AnalysisContent& analysis)
{
#ifdef DEBUG_LP
  SEMANTICANALYSISLOGINIT;
#endif
  auto annotationData = static_cast< AnnotationData* >(
    analysis.getData("AnnotationData"));

  if (annotationData->dumpFunction("SemanticRelation") == 0)
  {
    annotationData->dumpFunction("SemanticRelation", 
                                 new DumpSemanticRelation());
  }
  auto recoData=static_cast<RecognizerData*>(
    analysis.getData("RecognizerData"));

  for (auto i = m_relations.begin(); i != m_relations.end(); i++) 
  {
    LinguisticGraphVertex vertex1 = i->get<0>();
    LinguisticGraphVertex vertex2 = i->get<1>();

    auto matchesVtx1 = annotationData->matches(recoData->getGraphId(),
                                               vertex1,
                                               "annot");
    auto matchesVtx2 = annotationData->matches(recoData->getGraphId(),
                                               vertex2,
                                               "annot");

    if (!annotationData->hasAnnotation(*(matchesVtx1.begin()), 
                                       *(matchesVtx2.begin()),
                                       "SemanticRelation"))
    {
      SemanticRelationAnnotation annot(i->get<2>());
      GenericAnnotation ga(annot);
      annotationData->annotate(*(matchesVtx1.begin()), 
                               *(matchesVtx2.begin()),
                               "SemanticRelation", 
                               ga);
    }
    else
    {
      auto annot = annotationData->annotation(*(matchesVtx1.begin()), 
                               *(matchesVtx2.begin()),
                               "SemanticRelation").pointerValue<SemanticRelationAnnotation>();
      SEMANTICANALYSISLOGINIT;
      LWARN << "SemanticRelationData::addRelations There is already a SemanticRelation between" 
            << *(matchesVtx1.begin()) << "and" << *(matchesVtx2.begin()) << annot->type();
      LWARN << "Adding new type" << i->get<2>();
      QString type = QString::fromUtf8(annot->type().c_str());
      QStringList typeList = type.split(',');
      typeList << i->get<2>().c_str();
      typeList.sort();
      typeList.removeDuplicates();
      annot->type(typeList.join(',').toUtf8().constData());
      LWARN << "Adding type is now" << annot->type();
    }
  }
  m_relations.clear();
  return true;
}
开发者ID:aymara,项目名称:lima,代码行数:60,代码来源:SemanticRelationData.cpp

示例3: process

// Each token of the specified path is
// searched into the specified dictionary.
LimaStatusCode DotGraphWriter::process(AnalysisContent& analysis) const
{
  TimeUtils::updateCurrentTime();
  AnalysisGraph* anagraph=static_cast<AnalysisGraph*>(analysis.getData(m_graphId));
  LinguisticMetaData* metadata=static_cast<LinguisticMetaData*>(analysis.getData("LinguisticMetaData"));
  if (metadata == 0) {
      PTLOGINIT;
      LERROR << "no LinguisticMetaData ! abort";
      return MISSING_DATA;
  }
  if (anagraph == 0) {
      PTLOGINIT;
      LERROR << "no AnalysisGraph named " << m_graphId << " ! ";
      return MISSING_DATA;
  }
  string outputFileName=metadata->getMetaData("FileName") + m_outputSuffix;
  PosTagger::PosTaggingGraphWriter gw(
    anagraph->getGraph(),
    m_language,
    m_trigramMatrix,
    m_bigramMatrix);
  gw.setOptions(m_graphDotOptions,m_nodeDotOptions,m_edgeDotOptions);
  gw.writeToDotFile(outputFileName,m_vertexDisplay);

  TimeUtils::logElapsedTime("DotGraphWriter");
  return SUCCESS_ID;
}
开发者ID:FaizaGara,项目名称:lima,代码行数:29,代码来源:dotGraphWriter.cpp

示例4: process

LimaStatusCode EntityTrackerXmlLogger::process(
  AnalysisContent& analysis) const
{
  SELOGINIT;
  LDEBUG << "EntityTrackerXmlLogger::process";
  TimeUtils::updateCurrentTime();
  /* permet de récupérer les annotations */
  //AnnotationData* annotationData = static_cast< AnnotationData* >(analysis.getData("AnnotationData"));

  /* recupérer le graph après l'analyse */
  //const LinguisticAnalysisStructure::AnalysisGraph& graph = *(static_cast<LinguisticAnalysisStructure::AnalysisGraph*>(analysis.getData(m_graph)));

  LinguisticMetaData* metadata=static_cast<LinguisticMetaData*>(analysis.getData("LinguisticMetaData"));
  if (metadata == 0) {
      SELOGINIT;
      LERROR << "no LinguisticMetaData ! abort";
      return MISSING_DATA;
  }

  CoreferenceData* corefData=static_cast<CoreferenceData*>(analysis.getData("CoreferenceData"));
  if (corefData == 0) {
      SELOGINIT;
      LERROR << "no CoreferenceData ! abort";
      return MISSING_DATA;
  }

  ofstream out;
  if (!openLogFile(out,metadata->getMetaData("FileName"))) {
    SELOGINIT;
    LERROR << "Can't open log file '" << metadata->getMetaData("FileName") << "'";
    return UNKNOWN_ERROR;
  }

  out << "<coreference>" << endl;
  for (CoreferenceData::const_iterator it=corefData->begin(), 
         it_end=corefData->end(); it != it_end; it++)
  {
    out << "<entity mentions=\"" << (*it).size() << "\">" << endl;
    for (vector<Token>::const_iterator it2=(*it).begin(), it2_end=(*it).end();
         it2 != it2_end; it2++)
    {
      out << "  <entity_mention>" 
          << limastring2utf8stdstring((*it2).stringForm())
          <<"</entity_mention>";
    }
    out << "<entity>" <<endl;
  }
  out.close();

  return SUCCESS_ID;
}
开发者ID:aymara,项目名称:lima,代码行数:51,代码来源:EntityTrackerXmlLogger.cpp

示例5: process

LimaStatusCode LinearTextRepresentationDumper::process(
    AnalysisContent& analysis) const {

    DUMPERLOGINIT;
    // get metadata    
    LinguisticMetaData* metadata=dynamic_cast<LinguisticMetaData*>(analysis.getData("LinguisticMetaData"));
    if (metadata == 0) {
        LERROR << "LinearTextRepresentationDumper::process: no LinguisticMetaData ! abort" << LENDL;
        return MISSING_DATA;
    }
    // get the analysis graph    
    AnalysisGraph* anaGraph = dynamic_cast<AnalysisGraph*>(analysis.getData("PosGraph"));
    if (anaGraph == 0) {
        LERROR << "LinearTextRepresentationDumper::process: no AnalysisGraph ! abort" << LENDL;
        return MISSING_DATA;
    }
    // get sentence boundaries    
    SegmentationData* sb = dynamic_cast<SegmentationData*>(analysis.getData("SentenceBoundaries"));
    if (sb == 0) {
        LERROR << "LinearTextRepresentationDumper::process: no SentenceBounds ! abort" << LENDL;
        return MISSING_DATA;
    }
    // build LTRText
    LTR_Text textRep;
    LTRTextBuilder builder(m_language, m_stopList);
    builder.buildLTRTextFrom(
        *(anaGraph->getGraph()),
        sb,
        anaGraph->lastVertex(),
        &textRep,
        metadata->getStartOffset());
    // write LTR_Text
    LDEBUG << "handler will be: " << m_handler << LENDL;
//     MediaId langid = static_cast<const  Common::MediaticData::LanguageData&>(Common::MediaticData::MediaticData::single().mediaData(metadata->getMetaData("Lang"))).getMedia();
    AnalysisHandlerContainer* h = static_cast<AnalysisHandlerContainer*>(analysis.getData("AnalysisHandlerContainer"));
    AbstractTextualAnalysisHandler* handler = static_cast<AbstractTextualAnalysisHandler*>(h->getHandler(m_handler));
    if (handler == 0) {
      LERROR << "LinearTextRepresentationDumper::process: handler " << m_handler << " has not been given to the core client" << LENDL;
      return MISSING_DATA;
    }    
    handler->startAnalysis();
    HandlerStreamBuf hsb(handler);
    ostream out(&hsb);
    LDEBUG << textRep << LENDL;
    textRep.binaryWriteOn(out);
    out.flush();
    handler->endAnalysis();
    return SUCCESS_ID;
}
开发者ID:pquentin,项目名称:lima,代码行数:49,代码来源:linearTextRepresentationDumper.cpp

示例6: process

LimaStatusCode EnchantSpellingAlternatives::process(AnalysisContent& analysis) const
{
  TimeUtils::updateCurrentTime();
  MORPHOLOGINIT;
  LINFO << "MorphologicalAnalysis: starting process EnchantSpellingAlternatives";
  
  FsaStringsPool& sp=Common::MediaticData::MediaticData::changeable().stringsPool(m_d->m_language);
  AnalysisGraph* tokenList=static_cast<AnalysisGraph*>(analysis.getData("AnalysisGraph"));
  LinguisticGraph* g=tokenList->getGraph();
  VertexDataPropertyMap dataMap=get(vertex_data,*g);
  VertexTokenPropertyMap tokenMap=get(vertex_token,*g);
  LinguisticGraphVertexIt it,itEnd;
  for (boost::tie(it,itEnd)=vertices(*g) ; it != itEnd ; it++)
  {
    LDEBUG << "EnchantSpellingAlternatives::process processing vertex " << *it;
    Token* currentToken=tokenMap[*it];
    MorphoSyntacticData* msd=dataMap[*it];
    
    if (currentToken!=0)
    {
      if (msd->empty())
      {
        m_d->setEnchantSpellingAlternatives(
          currentToken,
          msd,
          sp);
      }
    }
  }
  LINFO << "MorphologicalAnalysis: ending process EnchantSpellingAlternatives";
  return SUCCESS_ID;
}
开发者ID:FaizaGara,项目名称:lima,代码行数:32,代码来源:EnchantSpellingAlternatives.cpp

示例7: process

LimaStatusCode OrthographicAlternatives::process(
  AnalysisContent& analysis) const
{

  TimeUtils::updateCurrentTime();
  MORPHOLOGINIT;
  LINFO << "MorphologicalAnalysis: starting process OrthographicAlternatives";

  StringsPool& sp=Common::LinguisticData::LinguisticData::changeable().stringsPool(m_language);
  AnalysisGraph* tokenList=static_cast<AnalysisGraph*>(analysis.getData("AnalysisGraph"));
  LinguisticGraph* g=tokenList->getGraph();
  LinguisticGraphVertexIt it,itEnd;
  VertexDataPropertyMap dataMap=get(vertex_data,*g);
  VertexTokenPropertyMap tokenMap=get(vertex_token,*g);
  boost::tie(it,itEnd)=vertices(*g);
  for (;it!=itEnd;it++)
  {
    LDEBUG << "processing vertex " << *it;
    MorphoSyntacticData* currentTokenData=dataMap[*it];
    Token* tok=tokenMap[*it];
    if (currentTokenData!=0)
    {

      // if in confidentMode and token has already ling infos, skip
      if ( m_confidentMode && (currentTokenData->size()>0) ) continue;

      // set orthographic alternatives given by dictionary
      // using the alternatives directly given by the morphosyntactic data
      {
        LDEBUG << "processing alternatives from dico";
        DictionaryEntry* entry=tok->dictionaryEntry();
        entry->reset();
        if (entry->hasAccented()) {
          LimaString oa = entry->nextAccented();
          while ( oa.size() > 0 )
          {
            createAlternative(tok,currentTokenData,oa,m_dictionary,sp);
            oa = entry->nextAccented();
          }
        }
      }

      // if in confidentMode and token has already ling infos, skip
      if (m_confidentMode && (currentTokenData->size() > 0) ) continue;

      // if no ling infos, then lower and unmark string
      LDEBUG << "set unmark alternatives";
      setOrthographicAlternatives(
        tok,
        currentTokenData,
        m_dictionary,
        m_charChart,
        sp);
    }
  }
  LINFO << "MorphologicalAnalysis: ending process OrthographicAlternatives";
  TimeUtils::logElapsedTime("OrthographicAlternatives");
  return SUCCESS_ID;
}
开发者ID:aymara,项目名称:lima,代码行数:59,代码来源:OrthographicAlternatives.cpp

示例8: process

LimaStatusCode SpecificEntitiesLoader::
process(AnalysisContent& analysis) const
{
  // get analysis graph
  AnalysisGraph* graph=static_cast<AnalysisGraph*>(analysis.getData(m_graph));
  if (graph==0)
  {
    LOGINIT("LP::SpecificEntities");
    LERROR << "no graph '" << m_graph << "' available !";
    return MISSING_DATA;
  }

  //create a RecognizerData (such as in ApplyRecognizer) to be able to use
  //CreateSpecificEntity actions
  RecognizerData* recoData=new RecognizerData;
  analysis.setData("RecognizerData",recoData);
  RecognizerResultData* resultData=new RecognizerResultData(m_graph);
  recoData->setResultData(resultData);
  
  try
  {
    SpecificEntitiesLoader::XMLHandler handler(m_language,analysis,graph);
    m_parser->setContentHandler(&handler);
    m_parser->setErrorHandler(&handler);
    QFile file(getInputFile(analysis).c_str());
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
      throw XMLException();
    if (!m_parser->parse( QXmlInputSource(&file)))
    {
      throw XMLException();
    }
  }
  catch (const XMLException& )
  {
    LOGINIT("LP::SpecificEntities");
    LERROR << "Error: failed to parse XML input file";
  }

  // remove recognizer data (used only internally to this process unit)
  recoData->deleteResultData();
  resultData=0;
  analysis.removeData("RecognizerData");

  return SUCCESS_ID;
}
开发者ID:FaizaGara,项目名称:lima,代码行数:45,代码来源:SpecificEntitiesLoader.cpp

示例9: process

LimaStatusCode LinearTextRepresentationLogger::process(
    AnalysisContent& analysis) const {

    DUMPERLOGINIT;
    // get metadata
    LinguisticMetaData* metadata=dynamic_cast<LinguisticMetaData*>(analysis.getData("LinguisticMetaData"));
    if (metadata == 0) {
        LERROR << "no LinguisticMetaData ! abort";
        return MISSING_DATA;
    }
    // get the analysis graph
    AnalysisGraph* anaGraph = dynamic_cast<AnalysisGraph*>(analysis.getData("PosGraph"));
    if (anaGraph == 0) {
        LERROR << "no AnalysisGraph ! abort";
        return MISSING_DATA;
    }
    // get sentence boundaries
    SegmentationData* sb = dynamic_cast<SegmentationData*>(analysis.getData("SentenceBoundaries"));
    if (sb == 0) {
      LDEBUG << "LinearTextRepresentationDumper::process: no SentenceBounds available: ignored";
      // sentence bounds ignored: null pointer passed to LTRTextBuilder will be handled there
    }
    // build LTRText
    LTR_Text textRep;
    LTRTextBuilder builder(m_language, m_stopList);
    builder.buildLTRTextFrom(
        *(anaGraph->getGraph()),
        sb,
        anaGraph->firstVertex(),
        anaGraph->lastVertex(),
        &textRep,
        metadata->getStartOffset());

    // write LTR_Text
    string textFileName = metadata->getMetaData("FileName");
    string outputFile = textFileName + m_outputSuffix;
    ofstream out(outputFile.c_str(), std::ofstream::binary);
    if (!out.good()) {
        throw runtime_error("can't open file " + outputFile);
    }
    textRep.binaryWriteOn(out);
    out.flush();
    out.close();
    return SUCCESS_ID;
}
开发者ID:aymara,项目名称:lima,代码行数:45,代码来源:linearTextRepresentationLogger.cpp

示例10: operator

bool CreateSemanticRelation::
operator()(const LinguisticAnalysisStructure::AnalysisGraph& anagraph,
           const LinguisticGraphVertex& vertex1,
           const LinguisticGraphVertex& vertex2,
           AnalysisContent& analysis ) const
{
  LIMA_UNUSED(anagraph);
  SemanticRelationData * semanticData=static_cast<SemanticRelationData*>(analysis.getData("SemanticRelationData"));
  if (semanticData==0)
  {
    semanticData=new SemanticRelationData();
    analysis.setData("SemanticRelationData",semanticData);
    
  }
  
  return semanticData->relation(vertex1,vertex2,m_semanticRelationType);

}
开发者ID:Geekking,项目名称:lima,代码行数:18,代码来源:ConstraintFunction.cpp

示例11: update

void SegmentFeatureEntity::
update(const AnalysisContent& analysis) {
  m_annotationData = static_cast<const AnnotationData*>(analysis.getData("AnnotationData"));
  if (m_annotationData==0)
  {
    LOGINIT("LP::Segmentation");
    LERROR << "no annotation graph available !" << LENDL;
  }
}
开发者ID:pquentin,项目名称:lima,代码行数:9,代码来源:TemporalSegmentationFeatures.cpp

示例12: process

LimaStatusCode EventTemplateDataDumper::process(AnalysisContent& analysis) const
{
  LOGINIT("LP::EventAnalysis");
  LDEBUG << "EventTemplateDataDumper::process" << LENDL;
  TimeUtils::updateCurrentTime();

  // initialize output
  DumperStream* dstream=AbstractTextualAnalysisDumper::initialize(analysis);
  ostream& out=dstream->out();

  const AnnotationData* annotationData = static_cast< AnnotationData* >(analysis.getData("AnnotationData"));
  if (annotationData==0)
  {
    LERROR << "no annotation graph available !" << LENDL;
    return MISSING_DATA;
  }
  
  if (! m_eventData.empty()) {
    const AnalysisData* data =analysis.getData(m_eventData);
    if (data!=0) {
      // see if the data is of type Events
      const EventTemplateData* eventData=dynamic_cast<const EventTemplateData*>(data);
      if (eventData==0) {
        LOGINIT("LP::EventAnalysis");
        LERROR << "data '" << m_eventData << "' is neither of type EventData nor Events" << LENDL;
        return MISSING_DATA;
      }
      else {
        Events *events=eventData->convertToEvents(annotationData);
        events->write(out);
      }
    }
    else {
      LOGINIT("LP::EventAnalysis");
      LERROR << "no data of name " << m_eventData << LENDL;
    }
  }
  
  delete dstream;
  TimeUtils::logElapsedTime("EventTemplateDataDumper");
  return SUCCESS_ID;
}
开发者ID:pquentin,项目名称:lima,代码行数:42,代码来源:EventTemplateDataDumper.cpp

示例13: process

// Datas are extracted from word sense annotations and written on the xml file according to the given dtd format
LimaStatusCode WordSenseXmlLogger::process(
  AnalysisContent& analysis) const
{
  TimeUtils::updateCurrentTime(); 
  LinguisticMetaData* metadata=static_cast<LinguisticMetaData*>(analysis.getData("LinguisticMetaData"));
  if (metadata == 0)
  {
    LOGINIT("WordSenseDisambiguator");
    LERROR << "no LinguisticMetaData ! abort";
    return MISSING_DATA;
  }

  string textFileName = metadata->getMetaData("FileName");
  string outputFile = textFileName + m_outputSuffix;
  ofstream out(outputFile.c_str(), std::ofstream::binary);
  if (!out.good()) {
      throw runtime_error("can't open file " + outputFile);
  }
   AnalysisGraph* /*anagraph=static_cast<AnalysisGraph*>(analysis.getData("SimpleGraph"));
   if (anagraph==0)*/
  
    anagraph=static_cast<AnalysisGraph*>(analysis.getData("PosGraph"));
    if (anagraph==0)
    {
        LOGINIT("WordSenseDisambiguator");
        LERROR << "no AnalysisGraph ! abort";
        return MISSING_DATA;
    }
  

  dump(out, anagraph,/* static_cast<SyntacticData*>(analysis.getData("SyntacticData")),*/ static_cast<AnnotationData*>(analysis.getData("AnnotationData")));
  out.flush();
  out.close();  
  TimeUtils::logElapsedTime("WordSenseDisambiguatorXmlLogger");
  return SUCCESS_ID;
}
开发者ID:FaizaGara,项目名称:lima,代码行数:37,代码来源:WordSenseXmlLogger.cpp

示例14: operator

bool SaveSemanticRelation::operator()(AnalysisContent& analysis ) const
{
#ifdef DEBUG_LP
  SEMLOGINIT;
  LDEBUG << "SaveSemanticRelation::operator()";
#endif
  SemanticRelationData * semanticData=static_cast<SemanticRelationData*>(analysis.getData("SemanticRelationData"));
  if (semanticData==0)
  {
    return false;
  }
  else
  {
    return semanticData->addRelations(analysis);
  }
}
开发者ID:aymara,项目名称:lima,代码行数:16,代码来源:ConstraintFunction.cpp

示例15: update

void SegmentFeaturePosition::
update(const AnalysisContent& analysis) {
  // update offset from metadata
  const LinguisticMetaData* metadata=static_cast<const LinguisticMetaData*>(analysis.getData("LinguisticMetaData"));
  if (metadata == 0) {
    LOGINIT("LP::Segmentation");
    LWARN << "no LinguisticMetaData ! abort" << LENDL;
  }
  else {
    try {
      m_offset=atoi(metadata->getMetaData("StartOffset").c_str());
    }
    catch (LinguisticProcessingException& ) {
      // do nothing: not set in analyzeText (only in analyzeXmlDocuments)
    }
  }
}
开发者ID:pquentin,项目名称:lima,代码行数:17,代码来源:SegmentFeatureExtractor.cpp


注:本文中的AnalysisContent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。