public ActionResult Index(int userId, int pageIndex = 1) { var wordsData = new WordsManager().GetAllUserWords(userId); var pageList = new PagedList <Words>(wordsData == null ? new List <Words>():wordsData, pageIndex, pageSize); return(View(pageList)); }
public MainModel(MainWindow mainWindow) { this.mainWindow = mainWindow; wordsManager = WordsManager.Instance; config = wordsManager.GetConfig(); RunTask(); GoogleTranslator googleTranslator = new GoogleTranslator(); }
public ActionResult GetWord(string wordId) { var manager = new WordsManager(); Words word = manager.GetWord(wordId); string result = word == null ? "" : word.Answer; return(Content(result)); }
public WordsManagerTests() { _mock = new Mock <IArgumentVerifier>(); _wordsLoaderMock = new Mock <IWordsLoader>(); _subwordsProcessorMock = new Mock <ISubwordsProcessor>(); Instance = new WordsManager(_mock.Object, _subwordsProcessorMock.Object); }
public ActionResult Edit(string wordId, string reply) { var manager = new WordsManager(); int ret = manager.UpdateReply(wordId, reply); string msg = ret == 1 ? "编辑成功!" : "编辑失败!"; return(Content(msg)); //return Content("<script>alert('" + msg + "');location.href='/Admin?userId=" + (Session["admin"] as User).LoginId + "';</script>"); }
private void Awake() { if (Instance != null) { Debug.LogError("WordsManger is existing!"); return; } Instance = this; }
static List <int> GetRawSearchResult(WordsManager wordsManager, List <string> words) { HashSet <int> pages = new HashSet <int>(); foreach (string word in words) { pages.UnionWith(wordsManager.QueryAllPages(word).Keys); } return(pages.ToList()); }
private void Awake() { // if the singleton hasn't been initialized yet if (instance != null && instance != this) { Destroy(this.gameObject); } instance = this; DontDestroyOnLoad(this.gameObject); }
void LoadWordManager() { wordsManager = new WordsManager(); wordsManager.LoadFromLocal(); WordsManagerLoaded = true; if (DataLoaded) { MessageBox.Show(String.Format("初始化完成,用时 {0:F3} s", GetTimeElapsed())); } }
public ActionResult Detail(int houseId) { House houseInfo = new HouseManager().GetHouse(houseId); List <Words> words = new WordsManager().GetAllWordsByHouseId(houseId); List <Comment> comments = new CommentManager().GetAllCommentByHouseId(houseId); var result = new DetailItem { HouseInfo = houseInfo, Words = words, Comments = comments }; return(View(result)); //return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 计算出相关参数并且保存到本地 ///// 参数包括 词的倒排表、页面RP /// </summary> /// <param name="reader"></param> /// <param name="idx">要求的页面idx列表</param> static void CalculateArgument(DBReader reader, List <int> idx = null) { Console.WriteLine("start arguments calculating."); CalculatePageRank(reader, idx, epsilon: 0.000001); Console.WriteLine("page rank calculated."); Rank.SaveToLocal(); WordsManager wordsManager = CalculateWords(reader, idx); Console.WriteLine("words calculated."); wordsManager.SaveToLocal(); }
public ActionResult AddWords(string content, int userid, int houseid) { Words words = new Words() { Id = Guid.NewGuid(), Name = "", Theme = "", Content = content, PublishTime = DateTime.Now, UserId = userid, HouseId = houseid }; int result = new WordsManager().Add(words); return(Content(result.ToString())); }
static WordsManager CalculateWords(DBReader reader, List <int> idxs = null) { if (idxs == null) { idxs = reader.GetAllIndex(); } WordsManager wordsManager = new WordsManager(); foreach (int idx in idxs) { string content = reader.GetPageByIndex(idx).raw_source; string text = htmlParser.Html2PlainText(content); wordsManager.Add(idx, Splitter.GetWords(text)); } return(wordsManager); }
static void Main(string[] args) { //LaunchSpider("http://www.nwpu.edu.cn"); DBReader reader = new DBReader(); reader.ReadDBIndex(); reader.ReadDBContent(); //CalculateArgument(reader); WordsManager wordsManager = new WordsManager(); wordsManager.LoadFromLocal(); Rank.LoadFromLocal(); Console.WriteLine("初始化完成"); while (true) { string text = Console.ReadLine(); if (text.ToLower() == "exit") { break; } List <string> words = Splitter.GetWords(text); List <int> results = GetRawSearchResult(wordsManager, words); List <int> wordidxs = wordsManager.GetWordsIndex(words); results = Rank.SortResult(wordsManager, results, wordidxs, 0.001); Console.WriteLine(String.Join("\n", reader.PageIdx2Description(results))); } }
// Use this for initialization void Start() { wordsManager = GameObject.Find("_GameManager").GetComponent<WordsManager>(); }