protected ITermLemma makeTempLemma(string term)
        {
            var md = new TempLemma(term);

            md.type = pos_type.TEMP.ToString();

            return(md);
        }
Пример #2
0
        public ITermLemma makeTempLemma(string term)
        {
            var md = new TempLemma(term);

            md.type = pos_type.TEMP.ToString();
            // List<String> fails = new   //new String[] { md.name }

            return(md);
        }
Пример #3
0
        public List <ILexiconItem> exploreAndSave(string term, ILogBuilder loger, bool shortExplore = true, bool debug = true, params termExploreItemEnumFlag[] flagsToSave)
        {
            List <ILexiconItem> output = new List <ILexiconItem>();

            if (lexicalItemRegistry.ContainsKey(term))
            {
                return(lexicalItemRegistry[term]);
            }


            if (!manager.settings.doAutoexplore)
            {
                output.Add(makeTempLemma(term));
                if (loger != null)
                {
                    loger.AppendLine("Autoexplore off [" + term + "] is temporarly created.");
                }
                return(output);
            }

            var res = failedList.Search(term, false, 1);

            if (res.getLineContentList().Contains(term))
            {
                output.Add(makeTempLemma(term));
                if (loger != null)
                {
                    loger.AppendLine("Term [" + term + "] is on black list - making temp term.");
                }
                return(output);
            }


            List <termExploreModel> models = explore(term, loger, shortExplore, debug);

            if (flagsToSave == null)
            {
                flagsToSave = new termExploreItemEnumFlag[] { termExploreItemEnumFlag.aper, termExploreItemEnumFlag.namedEntity, termExploreItemEnumFlag.srWNet }
            }
            ;

            foreach (termExploreModel model in models)
            {
                if (debug)
                {
                    manager.constructor.saveTermModel(model);
                }
                if (flagsToSave.Contains(model.flags))
                {
                    manager.constructor.output.AppendLine("New term for Lexicon: " + model.inputForm);
                    manager.constructor.addTermModelToLexicon(model);
                    if (manager.settings.doAutoMakeSynonymRelationship)
                    {
                        manager.constructor.addSynonymsAndConceptLinks(model, true);
                    }
                    output.AddRange(manager.getLexiconItems(model.inputForm, loger, false));
                }
                else
                {
                    output.Add(modelToLemma(model));
                }
            }

            if (!output.Any())
            {
                var md = new TempLemma(term);
                output.Add(makeTempLemma(term));
                md.type = pos_type.TEMP.ToString();

                failedList.Append(new string[] { md.name });

                if (loger != null)
                {
                    loger.AppendLine("Term [" + term + "] not found. Using single-instance spark.");
                }
            }

            lexicalItemRegistry.Add(term, output);


            return(output);
        }