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


C# Keywords类代码示例

本文整理汇总了C#中Keywords的典型用法代码示例。如果您正苦于以下问题:C# Keywords类的具体用法?C# Keywords怎么用?C# Keywords使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GetNewsForDistrict

 public List<News> GetNewsForDistrict(string district)
 {
     var response = GetResponseForDistrict(district, "", 1000);
     var result = new List<News>();
     var scores = new Keywords();
     foreach (var document in response.Data.documents)
     {
         News news = new News();
         news.ID = document.identifier;
         if (document.entities != null && document.entities.keywords != null)
             foreach (var keyword in document.entities.keywords)
             {
                 int wordScore;
                 if (!scores.Scores.TryGetValue(keyword.lemma, out wordScore))
                 {
                     wordScore = new Random().Next(20)-10;
                 }
                 decimal score = wordScore*keyword.weight;
                 news.RawScore += score;
             }
         if (news.RawScore != 0)
         {
             result.Add(news);
         }
     }
     return result;
 }
开发者ID:mediahackday,项目名称:districtsintown,代码行数:27,代码来源:ArticleClient.cs

示例2: Token

		public Token(TokenType type, string ltoken, string token)
		{
			this.type = type;
			this.utoken = token;
			this.token = ltoken;
			this.keyword = Keywords.NotAKeyword;
		}
开发者ID:etinquis,项目名称:nexusmodmanager,代码行数:7,代码来源:Tokenizer.cs

示例3: GetKeywordsStats

        public ActionResult GetKeywordsStats(HomeModel homeModel)
        {
            string url = homeModel.RequestedUrl;

            //create stringbuilder for urlinfo
            StringBuilder sb = new StringBuilder();
            sb.Append("Wprowadź adres url");
            //basic validate
            if (String.IsNullOrWhiteSpace(url))
            {
                homeModel.UrlInfo = sb.ToString();

                //return to index with updated model
                return View("Index",homeModel);
            }
            if (Uri.IsWellFormedUriString(url, UriKind.Relative))
            {
                //append stringbuilder if url is not well formated
                sb.Append("<br />Wprowadź prawidłowy adres np. http://www.przyklad.pl");
                homeModel.UrlInfo = sb.ToString();
                //return to index with updated model
                return View("Index",homeModel);
            }

            //main process start
            HtmlAgilityPack.HtmlDocument doc = KeywordsStats.GetHtmlDoc("http://www.borbis.pl/");
            List<string> keywordsList = KeywordsStats.GetKeywords(doc);
            if (keywordsList.Count() < 1)
            {
                sb.Append("<br />Nie znaleziono słów kluczowych w nagłówku strony");
                homeModel.UrlInfo = sb.ToString();
                //return to index with updated model
                return View("Index", homeModel);
            }

            //getting body html
            string bodyText = KeywordsStats.GetBodyTextFromHtml(doc);

            //create keywords class list
            List<Keywords> KeywordsClassList = new List<Keywords>();
            int keywordCount = 0;
            foreach (var key in keywordsList)
            {
                keywordCount = KeywordsStats.CoutKeywordInText(key, bodyText);
                Keywords keyword = new Keywords(key, keywordCount);
                KeywordsClassList.Add(keyword);
            }
            //add test keyword object test
            KeywordsClassList.Add(new Keywords("test", 10));

            //create mdoel for stats view
            KeywordsStatsViewModel model = new KeywordsStatsViewModel();
            model.KeyWordsList = KeywordsClassList;
            //pass the model to view
            return View(model);
        }
开发者ID:michalszaula,项目名称:KeywordsScanner,代码行数:56,代码来源:HomeController.cs

示例4: LogEntry

 protected LogEntry(int eventId, Keywords keyword, Opcodes opcode, Tasks task, Levels level, EventSource eventSource, int version, string message, Payload payload, DateTime created)
 {
     Id = Guid.NewGuid();
     EventId = eventId;
     Keyword = keyword;
     Opcode = opcode;
     Task = task;
     Level = level;
     EventSource = eventSource;
     Version = version;
     Message = message;
     Payload = payload;
     Created = created;
 }
开发者ID:paulsmelser,项目名称:logging,代码行数:14,代码来源:LogEntry.cs

示例5: ErrorLogEntry

        protected ErrorLogEntry(Guid id, Guid accountId, int eventId, Keywords keyword, Opcodes opcode, Tasks task, Levels level,
			EventSource eventSource, int version, string message, string exceptionType, string exceptionMessage, string stackTrace, Payload payload, DateTime created)
        {
            Id = id;
            AccountId = accountId;
            EventId = eventId;
            Keyword = keyword;
            Opcode = opcode;
            Task = task;
            Level = level;
            EventSource = eventSource;
            Version = version;
            Message = message;
            ExceptionType = exceptionType;
            ExceptionMessage = exceptionMessage;
            StackTrace = stackTrace;
            Payload = payload;
            Created = created;
        }
开发者ID:paulsmelser,项目名称:logging,代码行数:19,代码来源:ErrorLogEntry.cs

示例6: GetNewProfilesDefinition

    /// <summary>
    /// Initialize all of the internal objects inside of the query definition
    /// </summary>
    /// <returns>A new instance of type QueryDefinition</returns>
    public static Profiles GetNewProfilesDefinition()
    {
        QueryDefinition qd = new QueryDefinition();
        Profiles profiles = new Profiles();

        Name name = new Name();
        name.FirstName = new FirstName();
        name.LastName = new LastName();
        qd.Name = name;

        OutputOptions oo = new OutputOptions();
        oo.SortType = OutputOptionsSortType.QueryRelevance;
        oo.StartRecord = "0";

        Affiliation affiliation = new Affiliation();
        AffiliationList affList = new AffiliationList();

        //affiliations.AffiliationList = affList;
        affList.Affiliation = new List<Affiliation>();
        affList.Affiliation.Add(affiliation);

        FacultyRankList ftList = new FacultyRankList();
        ftList.FacultyRank = new List<string>();

        KeywordString kws = new KeywordString();
        Keywords kw = new Keywords();
        kw.KeywordString = new KeywordString();
        kw.KeywordString = kws;

        profiles.QueryDefinition = qd;
        profiles.QueryDefinition.AffiliationList = affList;
        profiles.QueryDefinition.Keywords = kw;
        profiles.QueryDefinition.Name = name;

        profiles.OutputOptions = oo;

        //its hard wired for 2 in this version.
        profiles.Version = 2;

        return profiles;
    }
开发者ID:EricMeeks,项目名称:ProfilesRNSBeta,代码行数:45,代码来源:ProfileHelper.cs

示例7: CreateKeywords

 public static Keywords CreateKeywords(global::System.Guid keywordsId, string text)
 {
     Keywords keywords = new Keywords();
     keywords.KeywordsId = keywordsId;
     keywords.Text = text;
     return keywords;
 }
开发者ID:scjunkie,项目名称:Console,代码行数:7,代码来源:SitecoreAnalytics.Designer.cs

示例8: AddToKeywords

 public void AddToKeywords(Keywords keywords)
 {
     base.AddObject("Keywords", keywords);
 }
开发者ID:scjunkie,项目名称:Console,代码行数:4,代码来源:SitecoreAnalytics.Designer.cs

示例9: SetValue

        /// <summary>
        /// The function will modify private member only, not base[key].
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="value"></param>
        /// <returns>value, coerced as needed to the stored type.</returns>
        private object SetValue(Keywords keyword, object value)
        {
            try
            {
                switch (keyword)
                {
                    case Keywords.Host:
                        return this._host = Convert.ToString(value);
                    case Keywords.Port:
                        return this._port = Convert.ToInt32(value);
                    case Keywords.Protocol:
                        return this._protocol = ToProtocolVersion(value);
                    case Keywords.Database:
                        return this._database = Convert.ToString(value);
                    case Keywords.UserName:
                        return this._username = Convert.ToString(value);
                    case Keywords.Password:
                        this._password.Password = value as string;
                        return value as string;
                    case Keywords.SSL:
                        return this._ssl = ToBoolean(value);
                    case Keywords.SslMode:
                        return this._sslmode = ToSslMode(value);
            #pragma warning disable 618
                    case Keywords.Encoding:
                        return Encoding;
            #pragma warning restore 618
                    case Keywords.Timeout:
                        return this._timeout = ToInt32(value, 0, TIMEOUT_LIMIT, keyword);
                    case Keywords.SearchPath:
                        return this._searchpath = Convert.ToString(value);
                    case Keywords.Pooling:
                        return this._pooling = ToBoolean(value);
                    case Keywords.ConnectionLifeTime:
                        return this._connection_life_time = Convert.ToInt32(value);
                    case Keywords.MinPoolSize:
                        return this._min_pool_size = ToInt32(value, 0, POOL_SIZE_LIMIT, keyword);
                    case Keywords.MaxPoolSize:
                        return this._max_pool_size = ToInt32(value, 0, POOL_SIZE_LIMIT, keyword);
                    case Keywords.SyncNotification:
                        return this._sync_notification = ToBoolean(value);
                    case Keywords.CommandTimeout:
                        return this._command_timeout = Convert.ToInt32(value);
                    case Keywords.Enlist:
                        return this._enlist = ToBoolean(value);
                    case Keywords.PreloadReader:
                        return this._preloadReader = ToBoolean(value);
                    case Keywords.UseExtendedTypes:
                        return this._useExtendedTypes = ToBoolean(value);
                    case Keywords.IntegratedSecurity:
                        return this._integrated_security = ToIntegratedSecurity(value);
                    case Keywords.Compatible:
                        Version ver = new Version(value.ToString());
                        if (ver > THIS_VERSION)
                            throw new ArgumentException("Attempt to set compatibility with version " + value +
                                                        " when using version " + THIS_VERSION);
                        return _compatible = ver;
                    case Keywords.ApplicationName:
                        return this._application_name = Convert.ToString(value);
                    case Keywords.AlwaysPrepare:
                        return this._always_prepare = Convert.ToBoolean(value);
                }
            }
            catch (InvalidCastException exception)
            {
                string exception_template = string.Empty;

                switch (keyword)
                {
                    case Keywords.Port:
                    case Keywords.Timeout:
                    case Keywords.ConnectionLifeTime:
                    case Keywords.MinPoolSize:
                    case Keywords.MaxPoolSize:
                    case Keywords.CommandTimeout:
                        exception_template = resman.GetString("Exception_InvalidIntegerKeyVal");
                        break;
                    case Keywords.SSL:
                    case Keywords.Pooling:
                    case Keywords.SyncNotification:
                        exception_template = resman.GetString("Exception_InvalidBooleanKeyVal");
                        break;
                    case Keywords.Protocol:
                        exception_template = resman.GetString("Exception_InvalidProtocolVersionKeyVal");
                        break;
                }

                if (!string.IsNullOrEmpty(exception_template))
                {
                    string key_name = GetKeyName(keyword);

                    throw new ArgumentException(string.Format(exception_template, key_name), key_name, exception);
                }

//.........这里部分代码省略.........
开发者ID:kristofen,项目名称:Npgsql,代码行数:101,代码来源:NpgsqlConnectionStringBuilder.cs

示例10: CheckFor

			/// <see cref="Translator.CheckFor"/>
			internal override bool CheckFor( Keywords nodeId, Keywords parentId )
			{
				return nodeId == Keywords.ID_TEXTURE_UNIT && parentId == Keywords.ID_PASS;
			}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:5,代码来源:TextureUnitTranslator.cs

示例11: GetAt

        private object GetAt(Keywords index)
        {
            switch (index)
            {
                case Keywords.DataSource:
                    return DataSource;

                case Keywords.Cache:
                    return Cache;

                default:
                    Debug.Fail("Unexpected keyword: " + index);
                    return null;
            }
        }
开发者ID:RonFrick,项目名称:Microsoft.Data.Sqlite,代码行数:15,代码来源:SqliteConnectionStringBuilder.cs

示例12: GetKeywords

        public Keywords GetKeywords(string documentId)
        {
            var keywords = new Keywords();

            var uDocument = App.Core.GetDocumentByID(long.Parse(documentId));
            foreach (KeywordRecord uKeywordRecord in uDocument.KeywordRecords.Where(x => x.KeywordRecordType.RecordType != RecordType.MultiInstance))
            {
                foreach (Keyword uKeyword in uKeywordRecord.Keywords)
                {
                    var keywordType = new KeywordType(uKeyword.KeywordType.ID,
                                                                    uKeyword.KeywordType.Name,
                                                                    GetSystemTypeFromUnityType(uKeyword.KeywordType.DataType),
                                                                    uKeyword.KeywordType.DefaultValue);
                    ObjectLibrary.Keyword keyword = null;
                    switch (uKeyword.KeywordType.DataType)
                    {
                        case KeywordDataType.AlphaNumeric:
                            keyword = new ObjectLibrary.Keyword(keywordType, uKeyword.AlphaNumericValue);
                            break;
                        case KeywordDataType.Currency:
                        case KeywordDataType.SpecificCurrency:
                            keyword = new ObjectLibrary.Keyword(keywordType, uKeyword.CurrencyValue);
                            break;
                        case KeywordDataType.Date:
                        case KeywordDataType.DateTime:
                            keyword = new ObjectLibrary.Keyword(keywordType, uKeyword.DateTimeValue);
                            break;
                        case KeywordDataType.FloatingPoint:
                            keyword = new ObjectLibrary.Keyword(keywordType, uKeyword.FloatingPointValue);
                            break;
                        case KeywordDataType.Numeric20:
                            keyword = new ObjectLibrary.Keyword(keywordType, uKeyword.Numeric20Value);
                            break;
                        case KeywordDataType.Numeric9:
                            keyword = new ObjectLibrary.Keyword(keywordType, uKeyword.Numeric9Value);
                            break;
                    }
                    keywords.Add(keyword);
                }
            }

            return keywords;
        }
开发者ID:JeffroeBodine,项目名称:WebAPI,代码行数:43,代码来源:OnBaseModel.cs

示例13: GetKeyName

		internal static string GetKeyName(Keywords keyword)
		{
		    switch(keyword)
		    {
		        case Keywords.UserName:
    				return "USER ID";
                case Keywords.IntegratedSecurity:
    				return "INTEGRATED SECURITY";
                default:
    				return keyword.ToString().ToUpperInvariant();
		    }
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:12,代码来源:NpgsqlConnectionStringBuilder.cs

示例14: ContainsKey

 public bool ContainsKey(Keywords keyword)
 {
     return base.ContainsKey(GetKeyName(keyword));
 }
开发者ID:kristofen,项目名称:Npgsql,代码行数:4,代码来源:NpgsqlConnectionStringBuilder.cs

示例15: GetDefaultValue

 internal static object GetDefaultValue(Keywords keyword)
 {
     return valueDescriptions[keyword].ExplicitDefault;
 }
开发者ID:kristofen,项目名称:Npgsql,代码行数:4,代码来源:NpgsqlConnectionStringBuilder.cs


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