Beispiel #1
0
        public List <termExploreItem> GetItems(morphRuleMatch match, string excludeForm)
        {
            Dictionary <string, gramCaseSet> output = new Dictionary <string, gramCaseSet>();
            List <termExploreItem>           items  = new List <termExploreItem>();

            foreach (morphRule rule in rules)
            {
                string form = rule.GetForm(match.root, match.stem, SharpSufix);
                if (excludeForm != form)
                {
                    if (!output.ContainsKey(form))
                    {
                        output.Add(form, new gramCaseSet());
                    }
                    output[form].Add(rule.gramEntry);
                }
            }

            foreach (string form in output.Keys)
            {
                termExploreItem item = new termExploreItem(form);
                item.gramSet = output[form];
                items.Add(item);
            }
            return(items);
        }
Beispiel #2
0
        public termExploreItem exploreEntities(String form, termExploreModel exploreModel)
        {
            tokenQuery         tq             = new tokenQuery(form, null, tokenQuerySourceEnum.imb_namedentities);
            tokenQueryResponse responseEntity = languageManagerDBNamedEntities.manager.exploreToken(tq);

            termExploreItem item = exploreModel.instances[form];

            if (item == null)
            {
                item = new termExploreItem(form);
            }

            if (responseEntity.status == tokenQueryResultEnum.accept)
            {
                exploreModel.lemmaForm = item.inputForm;
                String  gset    = "";
                Boolean __found = true;
                foreach (namedEntity ctf in responseEntity.flags)
                {
                    Boolean keepSearching = false;
                    __found = true;
                    switch (ctf)
                    {
                    //case namedEntity.businessDomain:
                    //    gset = gset.add("N+Comp", "|"); ;
                    //    exploreModel.wordnetPrimarySymsets.Add("MC04-CON-BD");
                    //    break;
                    case namedEntity.countryName:
                        gset = gset.add("N+Top", "|");;
                        exploreModel.wordnetPrimarySymsets.Add("MC04-GEO-C");
                        break;

                    case namedEntity.languageName:
                        gset = gset.add("N+Lang", "|");;
                        exploreModel.wordnetPrimarySymsets.Add("MC04-GEO-LN");
                        break;

                    case namedEntity.personalName:
                        gset = gset.add("N+First", "|");;
                        exploreModel.wordnetPrimarySymsets.Add("MC04-HUM-PN");
                        break;

                    case namedEntity.personalPosition:
                        gset = gset.add("N+Hum", "|");;
                        exploreModel.wordnetPrimarySymsets.Add("MC04-HUM-PP");
                        break;

                    case namedEntity.presonalLastName:
                        gset = gset.add("N+Last", "|");;
                        exploreModel.wordnetPrimarySymsets.Add("MC04-HUM-LN");
                        break;

                    case namedEntity.title:
                        gset = gset.add("N", "|");;
                        exploreModel.wordnetPrimarySymsets.Add("MC04-CON-AD-TITLE");
                        break;

                    case namedEntity.townName:
                        gset = gset.add("N+PGr1", "|");
                        exploreModel.wordnetPrimarySymsets.Add("MC04-CON-AD-TN");
                        break;

                    case namedEntity.townZip:
                        gset = gset.add("NUMnumerical+Top", "|");;
                        exploreModel.wordnetPrimarySymsets.Add("MC04-CON-AD-TZ");
                        break;

                    default:
                        keepSearching = true;
                        __found       = false;
                        break;
                    }
                    if (!keepSearching)
                    {
                        break;
                    }
                }

                item.gramSet.SetAll(gset);

                if (__found)
                {
                    exploreModel.instances.Add(item);

                    if (exploreModel.lemma == null)
                    {
                        exploreModel.lemma = item;
                    }

                    exploreModel.synonyms.AddRange(responseEntity.dataTokens.getTokens());

                    exploreModel.flags = termExploreItemEnumFlag.namedEntity;
                }

                return(item);
            }

            return(item);
        }