예제 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            var myHomePage = new contentPage();
        }
        public IContentPage tokenizeContent(string content, basicLanguage language)
        {
            contentPage output = new contentPage();

            return(output);
        }
예제 #3
0
        /// <summary>
        /// Vrsi tokenizaciju String/PlainText sadrzaja.
        /// </summary>
        /// <param name="resources">Preporuceni resursi: String content, basicLanguage language, node page </param>
        /// <returns></returns>
        public IContentPage tokenizeContent(params object[] resources)
        {
            string        content  = resources.getFirstOfType <string>();
            basicLanguage language = resources.getFirstOfType <basicLanguage>();
            node          page     = resources.getFirstOfType <node>();


            contentPage output = new contentPage();

            // output.sourceContent = content;

            output.acceptSourcePage(page);


            try
            {
                string source = content;

                // preprocess
                source = compressNewLines(source);
                output.sourceContent = source;
                //  source = imbFilterModuleEngine.executeSimple(settings.contentFilter, source);

                output.content = source;


                string[] blocks = source.Split(new string[] { Environment.NewLine + Environment.NewLine },
                                               StringSplitOptions.RemoveEmptyEntries);

                if (blocks.Count() == 0)
                {
                    blocks[0] = source;
                }
                List <contentParagraph> pars = null;
                foreach (string bl in blocks)
                {
                    string blc = bl.StripHTML();

                    // blc = imbStringReporting.imbHtmlDecode(blc);

                    blc = SecurityElement.Escape(blc);

                    contentBlock tmpBlock = new contentBlock();
                    tmpBlock.sourceContent = blc;

                    tmpBlock.content = blc;
                    output.items.Add(tmpBlock);
                }

                foreach (IContentBlock bl in output.items)
                {
                    // getting paragraphs
                    string[] paragraphs = bl.sourceContent.Split(new string[] { Environment.NewLine },
                                                                 StringSplitOptions.RemoveEmptyEntries);
                    foreach (string par in paragraphs)
                    {
                        if (string.IsNullOrEmpty(par))
                        {
                            continue;
                        }

                        contentParagraph po = new contentParagraph(par, output);

                        po.setParagraphFromContent <contentSentence, contentSubSentence, contentToken>(output, paragraphDetectionFlag.dropSentenceWithNoToken,
                                                                                                       sentenceDetectionFlag.
                                                                                                       setSentenceToParagraph,
                                                                                                       sentenceDetectionFlag.
                                                                                                       preprocessParagraphContent,
                                                                                                       tokenDetectionFlag.standardDetection,
                                                                                                       contentPreprocessFlag.standard);

                        if (po.items.Any())
                        {
                            output.paragraphs.Add(po);

                            foreach (IContentSentence sn in po.items)
                            {
                                output.sentences.Add(sn);
                                foreach (IContentToken tk in sn.items)
                                {
                                    output.tokens.Add(tk);
                                }
                            }
                            //output.tokens.AddRange();
                            bl.setItem(po);
                        }
                    }
                }



                output.primaryFlaging(resources);

                output.secondaryFlaging(resources);

                output.generalSemanticsFlaging(resources);

                output.specialSematicsFlaging(resources);



                //tokenCategorization.tokenAnalysis(output, settings, language);

                //if (settings.doTokenTypeDetection_basic)
                //{
                //
                //}

                //if (settings.doSentenceDetection)
                //{
                //    blokCategorization.sentenceAnalysis(output, settings, language);
                //}
            }
            catch (Exception ex)
            {
                var isb = new StringBuilder();
                isb.AppendLine("plainTextTokenizator error");
                isb.AppendLine("Language: " + language.toStringSafe());
                // devNoteManager.note(this, ex, isb.ToString(), "plainTextTokenizator", devNoteType.tokenization);
            }

            return(output);
        }
예제 #4
0
 PerformMasterPageComposition(contentPage, masterPage);