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


C# Annotation.ToString方法代码示例

本文整理汇总了C#中Annotation.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Annotation.ToString方法的具体用法?C# Annotation.ToString怎么用?C# Annotation.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Annotation的用法示例。


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

示例1: Parse

        /// <summary>
        /// Parses the sentence.
        /// </summary>
        /// <param name="annotation"></param>
        /// <returns></returns>
        public List<NotenizerNote> Parse(Annotation annotation)
        {
            List<NotenizerNote> sentencesNoted = new List<NotenizerNote>();
            List<NotenizerNote> notesToSave = new List<NotenizerNote>();

            Article article = GetArticle(annotation.ToString().Trim());

            // ================== REFACTORED PART HERE ======================
            foreach (Annotation sentenceLoop in annotation.get(typeof(CoreAnnotations.SentencesAnnotation)) as ArrayList)
            {
                NotenizerSentence sentence = new NotenizerSentence(sentenceLoop, article);
                Note matchedNote;

                NotenizerNoteRule rule = GetRuleForSentence(sentence, out matchedNote);

                if (rule != null && rule.Structure.Dependencies != null && rule.Structure.Dependencies.Count > 0)
                {
                    NotenizerNote parsedNote = ApplyRule(sentence, rule);
                    parsedNote.Note = matchedNote;

                    if (parsedNote.Note.AndRuleID != DBConstants.BsonNullValue)
                        parsedNote.AndRule = GetAndRuleForSentence(rule, parsedNote.Note.AndRuleID);

                    //Console.WriteLine("Parsed note: " + parsedNote.OriginalSentence + " ===> " + parsedNote.Text);
                    sentencesNoted.Add(parsedNote);

                    continue;
                }

                NotenizerNote note = _staticParser.Parse(sentence);
                notesToSave.Add(note);
            }

            // inserting into DB AFTER ALL sentences from article were processed
            // to avoid processed sentence to affect processing other sentences from article
            foreach (NotenizerNote sentenceNotedLoop in notesToSave)
            {
                // save rule's structure
                NotenizerNoteRule rule = sentenceNotedLoop.CreateRule();
                sentenceNotedLoop.CreateStructure();
                rule.Structure.Structure.ID = DB.InsertToCollection(DBConstants.StructuresCollectionName, DocumentCreator.CreateStructureDocument(rule)).Result;

                // save sentence's structure
                NotenizerStructure sentenceStructure = sentenceNotedLoop.OriginalSentence.Structure;
                sentenceStructure.Structure.ID = DB.InsertToCollection(DBConstants.StructuresCollectionName, DocumentCreator.CreateStructureDocument(sentenceStructure)).Result;

                // save rule
                rule.ID = DB.InsertToCollection(DBConstants.RulesCollectionName, DocumentCreator.CreateRuleDocument(rule)).Result;

                // save note
                Note note = sentenceNotedLoop.CreateNote();
                note.ID = DB.InsertToCollection(DBConstants.NotesCollectionName, DocumentCreator.CreateNoteDocument(
                    sentenceNotedLoop,
                    rule.ID,
                    String.Empty)).Result;

                // save sentence
                sentenceNotedLoop.OriginalSentence.Sentence.ID = DB.InsertToCollection(DBConstants.SentencesCollectionName, DocumentCreator.CreateSentenceDocument(
                    sentenceNotedLoop.OriginalSentence,
                    sentenceStructure.Structure.ID,
                    article.ID,
                    rule.ID,
                    String.Empty,
                    note.ID)).Result;

                Console.WriteLine("Parsed note: " + sentenceNotedLoop.OriginalSentence + " ===> " + sentenceNotedLoop.Text);
                sentencesNoted.Add(sentenceNotedLoop);
            }

            return sentencesNoted;
        }
开发者ID:nemcek,项目名称:notenizer,代码行数:76,代码来源:Notenizer.cs

示例2: annotationManager_AnnotationAdded

 void annotationManager_AnnotationAdded(Annotation annotation)
 {
     if (annotation is TextAnnotation)
     {
         ListViewItem item = new ListViewItem(annotation.ToString());
         item.Tag = annotation as TextAnnotation;
         this.annotationList.Items.Add(item);
     }
 }
开发者ID:selfwalker,项目名称:dicom,代码行数:9,代码来源:PictureView.cs

示例3: UsingPInvoke

        private static void UsingPInvoke()
        {
            Console.WriteLine("exgetann Using PInvoke");
            var annotator = new Annotator();
            var annotation = new Annotation();

            annotator.Name = "atr";
            annotator.Stat = Stat.Read;
            var ret = PInvoke.annopen("data/100s", ref annotator, 1);
            if (ret < 0)
                return;
            while (PInvoke.getann(0, ref annotation) == 0)
            {
                Console.WriteLine(annotation.ToString());
            }
            PInvoke.wfdbquit();
        }
开发者ID:BoutemineOualid,项目名称:WfdbCsharpWrapper,代码行数:17,代码来源:exgetann.cs


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