public Entity(string text, int startPosition, EntityInfoBase entityInfo)
     : base(text, startPosition)
 {
     EntityInfo = entityInfo;
     IsUse      = true;
     _Children  = new EntitySortedTree();
     Role       = EntityRole.Undefined;
 }
        /// <summary>
        /// Создать сущность на основе свойств
        /// </summary>
        /// <returns>созданная сущность</returns>
        public Entity CreateEntity()
        {
            EntityInfoBase info = CreateEntityInfo(Type);

            SetMorphoInformation(info);
            info.Value = Value;
            return(new Entity(Text, Start, info)
            {
                Language = Language, SyntaxChildren = SyntaxChildren.Any() ? SyntaxChildren : null
            });
        }
 /// <summary>
 /// Задание морфологической информации для заданной информации о сущности
 /// </summary>
 /// <param name="info">информация о сущности</param>
 private void SetMorphoInformation(EntityInfoBase info)
 {
     info.Morpho = MorphoInfo.Select(_ => info.ParseMorphoInfo(_)).ToArray();
 }
        /// <summary>
        /// Создать информацию о сущности по типу сущности
        /// </summary>
        /// <param name="type">тип сущности</param>
        /// <returns>созданная информация о сущности</returns>
        private EntityInfoBase CreateEntityInfo(EntityType type)
        {
            EntityInfoBase result = null;

            switch (type)
            {
            case EntityType.Pretext:
                result = new PretextEntityInfo();
                break;

            case EntityType.Numeric:
                result = new NumericEntityInfo();
                break;

            case EntityType.Pronoun:
                result = new PronounEntityInfo();
                break;

            case EntityType.Quote:
                result = new QuoteEntityInfo();
                break;

            case EntityType.Verb:
                result = new VerbEntityInfo();
                break;

            case EntityType.Participle:
                result = new ParticipleEntityInfo();
                break;

            case EntityType.Deepr:
                result = new DeeprEntityInfo();
                break;

            case EntityType.Infinitive:
                result = new InfinitiveEntityInfo();
                break;

            case EntityType.Adverb:
                result = new AdverbEntityInfo();
                break;

            case EntityType.Predicative:
                result = new PredicativeEntityInfo();
                break;

            case EntityType.Conjunction:
                result = new ConjunctionEntityInfo(SubSentenceType.Default);
                break;

            case EntityType.QuestionWord:
                result = new QuestionWordEntityInfo();
                break;

            case EntityType.Adjective:
                result = new AdjectiveEntityInfo();
                break;

            case EntityType.ShortAdjective:
                result = new ShortAdjectiveEntityInfo();
                break;

            case EntityType.Comparative:
                result = new ComparativeEntityInfo();
                break;

            case EntityType.Superlative:
                result = new SuperlativeEntityInfo();
                break;

            case EntityType.Date:
                result = new DateEntityInfo();
                break;

            case EntityType.Homogeneous:
                result = new HomogeneousEntityInfo();
                break;

            case EntityType.Unknown:
                result = SetNamedEntityProperties(new UnknownEntityInfo());
                break;

            case EntityType.UnknownProper:
                result = SetNamedEntityProperties(new UnknownProperEntityInfo());
                break;

            case EntityType.NounVerb:
                result = SetNamedEntityProperties(new NounVerbEntityInfo());
                break;

            case EntityType.PersonName:
                result = SetPersonEntityProperties(new PersonNameEntityInfo());
                break;

            case EntityType.PersonInfo:
                result = SetPersonEntityProperties(new PersonInfoEntityInfo());
                break;

            case EntityType.PersonNoInfo:
                result = SetPersonEntityProperties(new PersonNoInfoEntityInfo());
                break;

            case EntityType.OrgName:
                result = SetOrgEntityProperties(new OrgNameEntityInfo());
                break;

            case EntityType.OrgAbbr:
                result = SetNamedEntityProperties(new OrgAbbrEntityInfo());
                break;

            case EntityType.OrgNoInfo:
                result = SetNamedEntityProperties(new OrgNoInfoEntityInfo());
                break;

            case EntityType.Product:
                result = SetNamedEntityProperties(new ProductEntityInfo());
                break;

            case EntityType.Event:
                result = SetNamedEntityProperties(new EventEntityInfo());
                break;

            case EntityType.PlaceName:
            {
                var entityInfo = new PlaceNameEntityInfo();
                entityInfo.LinkedPlaces = LinkedPlaces;
                result = SetNamedEntityProperties(entityInfo);
                break;
            }

            case EntityType.PlaceNoInfo:
                result = SetNamedEntityProperties(new PlaceNoInfoEntityInfo());
                break;

            case EntityType.Address:
            case EntityType.BankAccount:
            case EntityType.Building:
            case EntityType.Corps:
            case EntityType.Email:
            case EntityType.Flat:
            case EntityType.House:
            case EntityType.Index:
            case EntityType.INN:
            case EntityType.Money:
            case EntityType.Phone:
            case EntityType.Slogan:
            case EntityType.Street:
            case EntityType.URL:
                result = new AdditionalEntityInfo(type.ToString());
                break;

            default:
                throw new InvalidOperationException("No EntityInfo for type: " + type.ToString());
            }
            return(result);
        }