本文整理汇总了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;
}
示例2: Token
public Token(TokenType type, string ltoken, string token)
{
this.type = type;
this.utoken = token;
this.token = ltoken;
this.keyword = Keywords.NotAKeyword;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例7: CreateKeywords
public static Keywords CreateKeywords(global::System.Guid keywordsId, string text)
{
Keywords keywords = new Keywords();
keywords.KeywordsId = keywordsId;
keywords.Text = text;
return keywords;
}
示例8: AddToKeywords
public void AddToKeywords(Keywords keywords)
{
base.AddObject("Keywords", keywords);
}
示例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);
}
//.........这里部分代码省略.........
示例10: CheckFor
/// <see cref="Translator.CheckFor"/>
internal override bool CheckFor( Keywords nodeId, Keywords parentId )
{
return nodeId == Keywords.ID_TEXTURE_UNIT && parentId == Keywords.ID_PASS;
}
示例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;
}
}
示例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;
}
示例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();
}
}
示例14: ContainsKey
public bool ContainsKey(Keywords keyword)
{
return base.ContainsKey(GetKeyName(keyword));
}
示例15: GetDefaultValue
internal static object GetDefaultValue(Keywords keyword)
{
return valueDescriptions[keyword].ExplicitDefault;
}