//Metodas uzpildo KeyWord objekta t.y. daugiausiai pasikartojanti zodi, //su juo susijusias nuorodas ir ju kieki static void getFinalResult(List <LinkDetails> linkDetails, List <String> commonWords, List <KeyWord> keyWords) { for (int i = 0; i < commonWords.Count; i++) { int hits = 0; var keyWord = new KeyWord(); keyWord.Word = commonWords[i]; for (int j = 0; j < linkDetails.Count; j++) { foreach (var word in linkDetails[j].Words) { if (commonWords[i].Equals(word)) { hits++; keyWord.Urls.Add(linkDetails[j].Url); break; } } } keyWord.Hits = hits; keyWords.Add(keyWord); } }
public Memory(String Name_, KeyWord Key_, String Value_, byte[] Bytes_) { Bytes = Bytes_; Name = Name_; Key = Key_; Value = Value_; }
//Deserialization constructor public Memory(SerializationInfo info, StreamingContext ctxt) { Bytes = (byte[])info.GetValue("Bytes", typeof(byte[])); Name = (String)info.GetValue("Name", typeof(String)); Key = (KeyWord)info.GetValue("Key", typeof(KeyWord)); Value = (String)info.GetValue("Value", typeof(String)); }
public Memory(String Name_, KeyWord Key_, String Value_) { Bytes = null; Name = Name_; Key = Key_; Value = Value_; }
public string GetOpenClassCode() { var items = new List <string>(); if (IsAbstract && KeyWord == UmlTypes.UmlClass) { items.Add("abstract"); } items.Add(KeyWord.ToString().ToLower().Substring(3)); items.Add(Name.AddQuotesIfNecessary()); var spot = Spot?.PlantUmlCode; if (!string.IsNullOrEmpty(spot)) { items.Add(spot); } { var code = Background?.GetCode(); if (!string.IsNullOrEmpty(code)) { items.Add(code); } } return(string.Join(" ", items)); }
public ActionResult Create(FormCollection collection, KeyWord model) { try { model.Id = Public.GetID2(); model.Word = collection["Word"]; model.GroupWordId = collection["GroupWordId"]; if (db.KeyWords.Where(e => e.Word.Trim().ToLower().Equals(model.Word) && e.GroupWordId.Trim() == model.GroupWordId).ToList().Count <= 0) { model.Type = 0; model.C1 = 0; model.C2 = 0; model.C3 = 0; model.C4 = 0; model.C5 = 0; model.P1 = 0; model.P2 = 0; model.P3 = 0; model.P4 = 0; model.P5 = 0; db.KeyWords.Add(model); db.SaveChanges(); TempData["success"] = "Thêm thành công."; } return(RedirectToAction("List")); } catch { TempData["error"] = "Thêm lỗi."; return(RedirectToAction("List")); } }
public void MyBind() { if (string.IsNullOrEmpty(KeyWord) || KeyWord.Equals("请输入关键字")) { nonemsg.Visible = true; return; } //DataTable dt = GetDT(); //count = dt.Rows.Count; //dt = dtHelper.PageDT(dt, PageSize, CPage); DataTable dt = SelPage(out count); if (count > 0) { this.PShow.Visible = false; string hrefTlp = "<a href='javascript:;' onclick='LoadByAjax(\"@query\",@page);' title=''>@text</a>"; RPT.DataSource = dt; RPT.DataBind(); Page_Lit.Text = PageCommon.CreatePageHtml(PageHelper.GetPageCount(count, PageSize), CPage, 10, hrefTlp); } else { this.PShow.Visible = true; } }
public Memory this[KeyWord KeyWord] { get { int i = IndexOf(KeyWord); if (i > -1) { return((Memory)allMemorys[i]); } else { return(null); } } set { int i = IndexOf(KeyWord); if (i > -1) { allMemorys[i] = value; } else { throw new InvalidOperationException("Invalid Memory KeyWord: " + KeyWord.ToString()); } } }
private bool getCONTROLTYPE(String line) { String[] options = { "continuous", "indexed", "union", "endunion" }; KeyWord keyValue = getKey(line, options); switch (keyValue.index) { case 0: typeValue = ControlType.Continuous; break; case 1: typeValue = ControlType.Indexed; break; case 2: typeValue = ControlType.Union; break; case 3: typeValue = ControlType.EndUnion; break; } return(keyValue.found()); }
private void AddKeyWords2Book(TreeViewItem_Attribute attr, Book book) { KeyWord keyWord; if (string.IsNullOrEmpty(attr.AttributeValue) || string.IsNullOrWhiteSpace(attr.AttributeValue)) { return; } string[] words = attr.AttributeValue.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var word in words) { if (string.IsNullOrEmpty(word) || string.IsNullOrWhiteSpace(word)) { continue; } keyWord = new KeyWord() { Word = word }; if (book.KeyWords.Contains(keyWord)) { continue; } book.KeyWords.Add(keyWord); } }
private IEnumerator PlaySub(KeyWord key_word) { act = true; last_key = key_word; var script = ScriptManager.Instance.GetText(key_word); var duration = ScriptManager.Instance.GetFloat(key_word); AudioManager.Instance.Voice.Play(key_word); //Debug.Log("<color=#0000ff>PlaySub</color>"); for (int i = 0; i < script.Length; i++) { yield return(new WaitForSeconds(0.05f)); subPlay.SetText(script[i]); yield return(new WaitForSeconds(duration[i] - 0.05f)); subPlay.Clear(); } act = false; if (TalkDone != null) { TalkDone(); } }
public List <KeyWord> GetKeyWords(int charid) { Console.WriteLine("Hello From " + Thread.CurrentThread.Name); List <KeyWord> keywords = new List <KeyWord>(); MySqlConnection keyWordConnection; MySqlDataReader dataReader; keyWordConnection = dBControl.getConnection(); keyWordConnection.Open(); using (MySqlCommand cmd = new MySqlCommand("SELECT * FROM KeywordsView WHERE char_id = @charID", keyWordConnection)) { cmd.Parameters.AddWithValue("@charID", charid); dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { KeyWord newKeyWord = new KeyWord(dataReader.GetInt16(0), dataReader.GetString(3)); keywords.Add(newKeyWord); Console.WriteLine("* " + newKeyWord.KeyWordText); } } keyWordConnection.Close(); Console.WriteLine("Goodbye From " + Thread.CurrentThread.Name); return(keywords); }
public static Expression Parse() { Expression result; if (piece == "(") { NextPiece(); result = OperatorO.Parse(); if (piece == null) { throw new Exception("Sintax Error"); } if (piece != ")") { throw new Exception("Sintax Error"); } NextPiece(); } else { result = KeyWord.Parse(); } return(result); }
public int GetKeyWordID(KeyWord keyWord) { int keyWordID = 0; connection = dBControl.getConnection(); MySqlDataReader dataReader; connection.Open(); using (MySqlCommand cmd = new MySqlCommand("SELECT keyword_id FROM Keywords WHERE keyword = @ruleText", connection)) { cmd.Parameters.AddWithValue("@ruleText", keyWord.KeyWordText); dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { keyWordID = dataReader.GetInt16(0); Console.WriteLine("The ID for this Rule is " + keyWordID); } connection.Close(); } return(keyWordID); }
public void OnGUI() { GUILayout.Space(40); GUIStyle s = new GUIStyle(GUI.skin.label); s.fontSize = 100; // myStyle.font = myFont; // GUI.Label(new Rect(10,10, 100, 30), "Hello World!", myStyle); GUILayout.BeginHorizontal(); if (GUILayout.Button("None")) { state = State.None; } if (GUILayout.Button("Learn")) { state = State.Learn; } if (GUILayout.Button("Recognize")) { state = State.Recognize; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); foreach (var item in Enum.GetValues(typeof(KeyWord)).Cast<KeyWord>()) { if (GUILayout.Button(item.ToString())) { keyword = item; } } // for (int i = 0; i < keyword.; i++) // { // f // } // if (GUILayout.Button("One")) // { // keyword = KeyWord.One; // } // if (GUILayout.Button("Two")) // { // keyword = KeyWord.Two; // } // if (GUILayout.Button("Three")) // { // keyword = KeyWord.Three; // } // if (GUILayout.Button("Four")) // { // keyword = KeyWord.Four; // } // if (GUILayout.Button("Five")) // { // keyword = KeyWord.Five; // } GUILayout.EndHorizontal(); GUILayout.Label(Display, s); }
//Read keyword list from file. private List <string> GetKeywords() { List <string> keyword; if (KeyWord != "") { keyword = new List <string>(KeyWord.Split(' ')); } else { keyword = new List <string>(); StreamReader reader = new StreamReader(KeyFile); try { do { keyword.Add(reader.ReadLine()); }while (reader.Peek() != -1); } finally { reader.Close(); } } return(keyword); }
public void AddKeyWord(KeyWord keyWord) { if (keyWord != null) { _context.KeyWords.Add(keyWord); _context.SaveChanges(); } }
private static int getKeyWord(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); PanelManager panelManager = (PanelManager)LuaScriptMgr.GetUnityObjectSelf(L, 1, "SimpleFramework.Manager.PanelManager"); KeyWord keyWord = panelManager.getKeyWord(); LuaScriptMgr.PushObject(L, keyWord); return 1; }
public ActionResult DeleteConfirmed(int id) { KeyWord keyWord = db.KeyWords.Find(id); db.KeyWords.Remove(keyWord); db.SaveChanges(); return(RedirectToAction("Index")); }
public static KeyWordVm ToVm(this KeyWord keyWord) { return(new KeyWordVm { Id = keyWord.Id, Word = keyWord.Word }); }
private void AddKeyWordButton_Click(object sender, EventArgs e) { KeyWord newKeyWord = (KeyWord)keyWordCombo.SelectedItem; newCharacter.AddKeyWord(newKeyWord); keyWordsListBox.DataSource = null; keyWordsListBox.DataSource = newCharacter.KeyWords; keyWordsListBox.DisplayMember = "keyWordText"; }
private bool CanExecute_Search(object arg) { if (KeyWord != null) { if (KeyWord.Trim().Length != 0) return true; } return false; }
private void DeleteKeyWord(KeyWord keyword) { if (keyword == null) { return; } _context.KeyWords.Remove(keyword); _context.SaveChanges(); }
public void ChangeKeyWord(KeyWord keyword) { if (keyword == null) { return; } _context.Entry(keyword).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); }
public DisPoseLine(string str) { Line_Str = str; i = 0; keyword = new KeyWord(); tokens = new List <Token>(); symbles = new List <Symble>(); errors = new List <Error>(); }
private static KeyWord mapper(DataRow row) { KeyWord keyWord = new KeyWord(); keyWord.Id = row["id"]; keyWord.Name = row["name"].ToString(); keyWord.ParentId = row["parentId"]; keyWord.Type = row["type"]; return(keyWord); }
internal Event(String Source_FullyQualifiedName , KeyWord KeyWord , Memories Memories , Double WhenSent , Double WhenRcvd , KeyWord Importance , KeyWord DeliveryState) { _Source_FullyQualifiedName = Source_FullyQualifiedName; _DeliveryState = DeliveryState; _Importance = Importance; _Keyword = KeyWord; _Memories = Memories; _WhenSent = WhenSent; _WhenRcvd = WhenRcvd; }
private void Run_Activated(object sender, EventArgs e) { KeyWord.Focus(); xml = new XMLTool("data.xml"); data = xml.getData(); AutoCompleteStringCollection autoCompleteCollection = new AutoCompleteStringCollection(); autoCompleteCollection.AddRange(data.Keys.ToArray()); KeyWord.AutoCompleteCustomSource = autoCompleteCollection; }
public BlogRepository(DbContext context, UserRepository repository) : base(context) { blog = new Blog(); post = new Post(); keyword = new KeyWord(); k2b = new KeywordAndBlog(); message = new Message(); bg = new BlogsAndGooders(); userRepository = repository; }
public ActionResult Edit([Bind(Include = "KeyWordID,KeyWordName")] KeyWord keyWord) { if (ModelState.IsValid) { db.Entry(keyWord).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(keyWord)); }
//Deserialization constructor public Event(SerializationInfo info , StreamingContext ctxt) { _WhenSent = ( Double ) info.GetValue("_WhenSent" , typeof(Double)); _WhenRcvd = ( Double ) info.GetValue("_WhenRcvd" , typeof(Double)); _Importance = ( KeyWord ) info.GetValue("_Importance" , typeof(KeyWord)); _Memories = ( Memories ) info.GetValue("_Memories" , typeof(Memories)); _Keyword = ( KeyWord ) info.GetValue("_Keyword" , typeof(KeyWord)); _DeliveryState = ( KeyWord ) info.GetValue("_DeliveryState" , typeof(KeyWord)); _Source_FullyQualifiedName = ( String ) info.GetValue("_Source_FullyQualifiedName" , typeof(String)); }
//Deserialization constructor public Event(SerializationInfo info, StreamingContext ctxt) { _WhenSent = ( Double )info.GetValue("_WhenSent", typeof(Double)); _WhenRcvd = ( Double )info.GetValue("_WhenRcvd", typeof(Double)); _Importance = ( KeyWord )info.GetValue("_Importance", typeof(KeyWord)); _Memories = ( Memories )info.GetValue("_Memories", typeof(Memories)); _Keyword = ( KeyWord )info.GetValue("_Keyword", typeof(KeyWord)); _DeliveryState = ( KeyWord )info.GetValue("_DeliveryState", typeof(KeyWord)); _Source_FullyQualifiedName = ( String )info.GetValue("_Source_FullyQualifiedName", typeof(String)); }
internal Event(String Endpoint, String Source_FullyQualifiedName, KeyWord KeyWord, Memories Memories, Double WhenSent, Double WhenRcvd, KeyWord Importance, KeyWord DeliveryState, EventTransfer IntendedRecipients) { _Endpoint = Endpoint; _Source_FullyQualifiedName = Source_FullyQualifiedName; _DeliveryState = DeliveryState; _Importance = Importance; _Keyword = KeyWord; _Memories = Memories; _WhenSent = WhenSent; _WhenRcvd = WhenRcvd; _IntendedRecipients = IntendedRecipients; }
public Memory this[KeyWord KeyWord] { get { int i = IndexOf(KeyWord); if (i > -1) return (Memory)allMemorys[i]; else return null; } set { int i = IndexOf(KeyWord); if (i > -1) allMemorys[i] = value; else throw new InvalidOperationException("Invalid Memory KeyWord: " + KeyWord.ToString()); } }
public int IndexOf(KeyWord KeyWord) { for (int i = 0; i < allMemorys.Count; i++) { if (((Memory)allMemorys[i]).Key == KeyWord) { return i; } } return -1; }
public static void AddKeyword(KeyWord keyword) { using (WeChatDbContext entity = new WeChatDbContext()) { entity.KeyWords.Add(keyword); entity.SaveChanges(); } }
public static void EditKeyword(KeyWord keyword) { using (WeChatDbContext entity = new WeChatDbContext()) { var oldKeyword = (from item in entity.KeyWords where item.KeyWordId == keyword.KeyWordId select item).SingleOrDefault(); if (oldKeyword != null) { entity.Entry(oldKeyword).State = System.Data.Entity.EntityState.Modified; oldKeyword.Title = keyword.Title; oldKeyword.ResultUrl = keyword.ResultUrl; oldKeyword.MsgKeyValue = keyword.MsgKeyValue; oldKeyword.LastUpdateTime = DateTime.Now; oldKeyword.Content = keyword.Content; entity.SaveChanges(); } } }
public static bool tryGetCommonField(ref Memories Memories, String KeyS, KeyWord KeyK, System.Type OutValueType, thing.Parts.Memory.MemoryComponents InPart, thing.Parts.Memory.MemoryComponents OutPart, ref object outVar) { try { //lock (Memories) //{ String TYPE_STRING = typeof(System.String).ToString(); String TYPE_INT = typeof(System.Int32).ToString(); String TYPE_BOOL = typeof(System.Boolean).ToString(); String TYPE_KEYWORD = typeof(thing.KeyWord).ToString(); String OUT_VALUE_TYPE = OutValueType.ToString(); Object o = null; // lock (Memories) // { o = tryGetCommonField(ref Memories, KeyS, KeyK, InPart, OutPart); // } string s = String.Empty; if (object.Equals(null, o)) { return false; } if (OUT_VALUE_TYPE == TYPE_STRING) { s = (String)o; outVar = s; return true; } else if (OUT_VALUE_TYPE == TYPE_BOOL) { s = (String)o; if (s != String.Empty) { outVar = Boolean.Parse(s); return true; } else { outVar = false; return false; } } else if (OUT_VALUE_TYPE == TYPE_INT) { s = (String)o; if (s != String.Empty) { outVar = System.Int32.Parse(s); return true; } else { outVar = 0; return false; } } else if (OUT_VALUE_TYPE == TYPE_KEYWORD) { outVar = (thing.KeyWord)o; return true; } else { outVar = null; return false; } //} } catch //(Exception e) { // _Log(e.ToString()); return false; } }
public static string OperateKeyWord(JObject keyword) { if (keyword != null) { KeyWord newKeyword = new KeyWord(); newKeyword.Title = keyword.SelectToken("title").ToString(); newKeyword.Content = keyword.SelectToken("content").ToString(); newKeyword.LastUpdateTime = DateTime.Now; if (keyword.SelectToken("resulturl") != null) { newKeyword.ResultUrl = keyword.SelectToken("resulturl").ToString(); } newKeyword.MsgKeyValue = keyword.SelectToken("keyvalue").ToString(); if ((keyword.SelectToken("keywordid").ToString() == "") || (Int32.Parse(keyword.SelectToken("keywordid").ToString()) == 0)) { newKeyword.CreateTime = DateTime.Now; AddKeyword(newKeyword); return "success"; } else { newKeyword.KeyWordId = Int32.Parse(keyword.SelectToken("keywordid").ToString()); EditKeyword(newKeyword); return "success"; } } return "error"; }
//text parsing constructor public Line(String line) { original = line; keyword = getKey(line, keyWords); if (keyword.found()) { String right = line.Remove(0, keyword.pos + keyWords[keyword.index].Length); if (getValue(right, keyword.index)) //look to the right of the keyword for the value { state = lineState.DONE; } else //nothin' there { state = lineState.NOVALUE; } } else //no keyword { state = lineState.NOKEY; findValue(line); //try to detect a value } }
//finds the earliest occurence of a matching keyword private static KeyWord getKey(String line, String[] options) { //check against all keywords line = line.ToLower(); KeyWord answer = new KeyWord(); answer.pos = line.Length; //looking for lowest, preset at max for (int i = 0; i < options.Length; i++) { int search = find(line, options[i]); if ((search != -1) && (search < answer.pos)) { answer.pos = search; answer.index = i; } } return answer; }
public Union unionValue; //used & built externally by buildUnions(); #endregion Fields #region Constructors //empty line constructor (used by buildUnions() to construct union lines) public Line() { original = ""; state = lineState.DONE; keyword = new KeyWord(); }
/** * Adds expression token * Method is caleld by the tokenExpressionString() * while parsing string expression * * @param tokenStr the token string * @param keyWord the key word */ private void addToken(String tokenStr, KeyWord keyWord) { Token token = new Token(); initialTokens.Add(token); token.tokenStr = tokenStr; token.keyWord = keyWord.wordString; token.tokenId = keyWord.wordId; token.tokenTypeId = keyWord.wordTypeId; if (token.tokenTypeId == Argument.TYPE_ID) token.tokenValue = argumentsList[token.tokenId].argumentValue; else if (token.tokenTypeId == ParserSymbol.NUMBER_TYPE_ID) { token.tokenValue = Double.Parse(token.tokenStr, NumberStyles.Float, CultureInfo.InvariantCulture); token.keyWord = ParserSymbol.NUMBER_STR; } }
private static object tryGetCommonField(ref Memories MemoryHaystack, String KeyS, KeyWord KeyK, thing.Parts.Memory.MemoryComponents InPart, thing.Parts.Memory.MemoryComponents OutPart) { thing.Parts.Memory MemoryNeedle = new thing.Parts.Memory(KeyS, KeyK, String.Empty); foreach (thing.Parts.Memory Memory in MemoryHaystack) { switch (InPart) { case thing.Parts.Memory.MemoryComponents.KEY: if (!Object.Equals(null, KeyK)) { if (KeyK != KeyWord.NIL) { if (compare(Memory, MemoryNeedle, InPart)) { return get(Memory, OutPart); } } } if (!Object.Equals(null, KeyS)) { if (KeyS != String.Empty) { if (compare(Memory, MemoryNeedle, InPart)) { return get(Memory, OutPart); } } } break; case thing.Parts.Memory.MemoryComponents.NAME: if (!Object.Equals(null, KeyK)) { if (KeyK != KeyWord.NIL) { if (compare(Memory, MemoryNeedle, InPart)) { return get(Memory, OutPart); } } } if (!Object.Equals(null, KeyS)) { if (KeyS != String.Empty) { if (compare(Memory, MemoryNeedle, InPart)) { return get(Memory, OutPart); } } } break; } } return null; }