コード例 #1
0
        /**
         * This method creates a Ranker Options object,and sets the options of the Ranker, and returns
         * the created object.
         * It gets the options from the data base.
         * note:In case the returned values from the data base are nulls or
         *      the operation mode of the crawler is manual this
         *      method will set defualt numbers.
         */
        private static void getRankerOptions()
        {
            if (WorkDetails.getOperationMode() == operationMode_t.Auto)
            {
                String alpha = StorageSystem.StorageSystem.getInstance().getProperty(WorkDetails.getTaskId(),
                                                                                     TaskProperty.RAN_ALPHA.ToString());
                String betta = StorageSystem.StorageSystem.getInstance().getProperty(WorkDetails.getTaskId(),
                                                                                     TaskProperty.RAN_BETA.ToString());
                String gamma = StorageSystem.StorageSystem.getInstance().getProperty(WorkDetails.getTaskId(),
                                                                                     TaskProperty.RAN_GAMMA.ToString());
                String delta = StorageSystem.StorageSystem.getInstance().getProperty(WorkDetails.getTaskId(),
                                                                                     TaskProperty.RAN_DELTA.ToString());

                if (isRealNum(alpha))
                {
                    RankerOptions.ALPHA = Convert.ToDouble(alpha);
                }
                if (isRealNum(betta))
                {
                    RankerOptions.BETTA = Convert.ToDouble(betta);
                }
                if (isRealNum(gamma))
                {
                    RankerOptions.GAMMA = Convert.ToDouble(gamma);
                }
                if ((delta != null) && (delta != "") && (!Convert.IsDBNull(delta)) && ((Convert.ToInt16(delta)) >= 0))
                {
                    RankerOptions.ConfidenceLevelOfAnchor = Convert.ToInt16(delta);
                }
            }
        }
コード例 #2
0
        /**
         * Set Flag Method
         * this functions gets flag and value it will process the flag parameters
         * as listed in the value
         */
        private static bool SetFlag(string flag, string value)
        {
            switch (flag)
            {
            case "numThreads":
                try
                {
                    _numWorkers = Convert.ToInt16(value);
                }
                catch (Exception e)
                {
                    System.Console.WriteLine("ERROR: Cannot Convert to Integer Value " + value);
                    return(false);
                }
                break;

            case "refreshRate":
                try
                {
                    _refreshRate = Convert.ToInt16(value);
                }
                catch (Exception e)
                {
                    System.Console.WriteLine("ERROR: Cannot Convert to Integer Value " + value);
                    return(false);
                }
                break;

            case "seedList":
                _seedList.Clear();
                foreach (String seed in value.Split(','))
                {
                    _seedList.Add("http://" + seed);
                }
                break;

            case "operationMode":
                if (value.Equals("Auto") == true)
                {
                    _operationMode = operationMode_t.Auto;
                    WorkDetails.setOperationMode(operationMode_t.Auto);
                }
                else if (value.Equals("Manual") == true)
                {
                    _operationMode = operationMode_t.Manual;
                    WorkDetails.setOperationMode(operationMode_t.Manual);
                }
                else
                {
                    System.Console.WriteLine("ERROR: Unknown Operation Mode " + value);
                    return(false);
                }
                break;

            default:
                System.Console.WriteLine("ERROR: Unknown Flag " + flag);
                return(false);
            }
            return(true);
        }
コード例 #3
0
        public async Task <ActionResult <WorkDetails> > PostWorkDetails(WorkDetails workDetails)
        {
            _context.WorkDetails.Add(workDetails);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetWorkDetails", new { id = workDetails.Id }, workDetails));
        }
コード例 #4
0
        public async Task <IActionResult> PutWorkDetails(int id, WorkDetails workDetails)
        {
            if (id != workDetails.Id)
            {
                return(BadRequest());
            }

            _context.Entry(workDetails).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WorkDetailsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #5
0
        /**
         * This method creates Categorizer Options and returns it.
         * The values of the variables of the new object are brought from the data base.
         * Note : In case the operation mode is manual the variables will be default ones,
         *        such is the case when the returns values from the data base are nulls.
         */
        private CategorizerOptions getCategorizerOptions()
        {
            CategorizerOptions options = new CategorizerOptions();

            if (WorkDetails.getOperationMode() == operationMode_t.Auto)
            {
                options.ALPHA            = RankerOptions.CAT_ALPHA;
                options.BETA             = RankerOptions.CAT_BETA;
                options.GAMMA            = RankerOptions.CAT_GAMMA;
                options.MIN_WORDS_LIMIT  = RankerOptions.CAT_MIN;
                options.MIN_WORDS_PENLTY = RankerOptions.CAT_PENLTY;
            }
            return(options);
        }
コード例 #6
0
        private WorkDetails getWorkentites(WorkDetails workDetails)
        {
            workDetails.work = recognizerResult.Entities["직업"]?.FirstOrDefault()?.ToString().Replace(" ", "");
            JArray sebu = (JArray)recognizerResult.Entities.SelectToken("세부능력");
            int    i    = 0;

            try
            {
                foreach (JArray value in sebu)
                {
                    workDetails.sebu.Add(value?.FirstOrDefault().ToString().Replace(" ", ""));
                }
            }
            catch (Exception e)
            {
            }
            return(workDetails);
        }
コード例 #7
0
        /**
         * This method creates Categorizer Options and returns it.
         * The values of the variables of the new object are brought from the data base.
         * Note : In case the operation mode is manual the variables will be default ones,
         *        such is the case when the returns values from the data base are nulls.
         */
        private CategorizerOptions getOptions(String optionsType)
        {
            CategorizerOptions options = new CategorizerOptions();

            if (WorkDetails.getOperationMode() == operationMode_t.Auto)
            {
                switch (optionsType)
                {
                case "anchor":
                    options.ALPHA              = RankerOptions.ANC_ALPHA;
                    options.BETA               = RankerOptions.ANC_BETA;
                    options.GAMMA              = RankerOptions.ANC_GAMMA;
                    options.MIN_WORDS_LIMIT    = RankerOptions.ANC_MIN;
                    options.MIN_WORDS_PENLTY   = RankerOptions.ANC_PENLTY;
                    options.isRank             = true;
                    options.NONZERO_MAX_EFFECT = 0;
                    break;

                case "wholeContent":
                    options.ALPHA            = RankerOptions.CAT_ALPHA;
                    options.BETA             = RankerOptions.CAT_BETA;
                    options.GAMMA            = RankerOptions.CAT_GAMMA;
                    options.MIN_WORDS_LIMIT  = RankerOptions.CAT_MIN;
                    options.MIN_WORDS_PENLTY = RankerOptions.CAT_PENLTY;
                    options.isRank           = true;
                    break;

                case "nearby":
                    options.ALPHA              = RankerOptions.NER_ALPHA;
                    options.BETA               = RankerOptions.NER_BETA;
                    options.GAMMA              = RankerOptions.NER_GAMMA;
                    options.MIN_WORDS_LIMIT    = RankerOptions.NER_MIN;
                    options.MIN_WORDS_PENLTY   = RankerOptions.NER_PENLTY;
                    options.NONZERO_MAX_EFFECT = 40;
                    options.isRank             = true;
                    break;

                default:
                    goto case "wholeContent";
                }
            }

            return(options);
        }
コード例 #8
0
        public ActionResult BookWorker(int?id)
        {
            if (Session["Mobile"] == null)
            {
                return(RedirectToAction("Index"));
            }
            string mobilenumber = Session["Mobile"].ToString();

            FixesAppContext context = new FixesAppContext();
            var             user    = context.User.SingleOrDefault(x => x.MobileNumber == mobilenumber);
            var             worker  = context.Worker.Include("Servicess").SingleOrDefault(x => x.WorkerId == id);

            if (user.Location == null || user.Address == null)
            {
                this.AddNotification("Please Fill Location and Address", NotificationType.ERROR);
                return(RedirectToAction("EditUserProfile", user));
            }
            else if (user.Location != worker.Location)
            {
                this.AddNotification("This worker cannot provide service to your location, Please Book worker of your location", NotificationType.ERROR);
                return(RedirectToAction("WorkerProfile", new { id = id }));
            }
            else if (user.Location == worker.Location)
            {
                WorkDetails workDetails = new WorkDetails
                {
                    UserMobile   = Session["Mobile"].ToString(),
                    WorkerMobile = worker.MobileNumber,
                    UserId       = user.UserId,
                    WorkerId     = worker.WorkerId,
                    RequestDT    = DateTime.Now,
                    ServiceName  = worker.Servicess.ServiceName,
                    WorkerName   = worker.WorkerName,
                    UserName     = user.UserName,
                    cost         = worker.CostPerHour
                };
                context.WorkDetails.Add(workDetails);
                context.SaveChanges();
                SendSms(mobilenumber, user.UserName);
                this.AddNotification("Booking Successful", NotificationType.SUCCESS);
                return(RedirectToAction("WorkerProfile", new { id = id }));
            }
            return(RedirectToAction("Main"));
        }
コード例 #9
0
        /**
         * This method sets ALL the constants needed for the task.
         */
        public static void SetAllConstants()
        {
            //sets the number of threads
            SetNumberOfThreads();

            //get anchor options
            CategorizerOptions anchorOptions = getOptions("anchor");

            RankerOptions.ANC_ALPHA  = anchorOptions.ALPHA;
            RankerOptions.ANC_BETA   = anchorOptions.BETA;
            RankerOptions.ANC_GAMMA  = anchorOptions.GAMMA;
            RankerOptions.ANC_MIN    = anchorOptions.MIN_WORDS_LIMIT;
            RankerOptions.ANC_PENLTY = anchorOptions.MIN_WORDS_PENLTY;

            //get nearby options
            CategorizerOptions nearbyOptions = getOptions("nearby");

            RankerOptions.NER_ALPHA  = nearbyOptions.ALPHA;
            RankerOptions.NER_BETA   = nearbyOptions.BETA;
            RankerOptions.NER_GAMMA  = nearbyOptions.GAMMA;
            RankerOptions.NER_MIN    = nearbyOptions.MIN_WORDS_LIMIT;
            RankerOptions.NER_PENLTY = nearbyOptions.MIN_WORDS_PENLTY;

            //get category Options
            CategorizerOptions categoryOptions = getOptions("Category");

            RankerOptions.CAT_ALPHA  = categoryOptions.ALPHA;
            RankerOptions.CAT_BETA   = categoryOptions.BETA;
            RankerOptions.CAT_GAMMA  = categoryOptions.GAMMA;
            RankerOptions.CAT_MIN    = categoryOptions.MIN_WORDS_LIMIT;
            RankerOptions.CAT_PENLTY = categoryOptions.MIN_WORDS_PENLTY;

            //get Ranker options
            getRankerOptions();
            //set symmitric line
            String symmetric = StorageSystem.StorageSystem.getInstance().getProperty(WorkDetails.getTaskId()
                                                                                     , TaskProperty.SYMMETRIC_LINE.ToString());
            //TODO:continue the assigning of symmitric line
        }
コード例 #10
0
 private async Task <DialogTurnResult> WorkJobCheckAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
 {
     client = new GraphClient(new Uri(GRAPHDB_ENDPOINT), new HttpClientWrapper(GRAPHDB_USERNAME, GRAPHDB_PASSWORD, new HttpClient()
     {
         Timeout = GRAPHDB_HTTP_TIMEOUT
     }));
     client.Connect();
     //그래프 데이터 클라이언트 연동
     workDetails = (WorkDetails)stepContext.Options;
     //루이즈로 받아온 엔터티 저장
     if (workDetails.work == null)
     {
         return(await stepContext.PromptAsync(nameof(TextPrompt),
                                              new PromptOptions
         {
             Prompt = MessageFactory.Text("알고싶은 직무를 입력해 주십시오")
         }, cancellationToken));
     }
     else
     {
         return(await stepContext.NextAsync(cancellationToken));
     }
 }
コード例 #11
0
        /**
         * Main method of the console application
         */
        public static void Main(String[] args)
        {
            bool toContinue = ParseArguements(args), needToRestart = false;

            if (toContinue == false)
            {
                return;
            }
            Queue <int> keepAlive = new Queue <int>();
            String      currentUser = "******", currentTask = "";

            LogDebuggerControl.getInstance().debugCategorization = false;
            LogDebuggerControl.getInstance().debugCategorizationInRanker = false;
            LogDebuggerControl.getInstance().debugRanker = false;

            while (true)
            {
                // select which task to invoke
                SelectTask(ref currentUser, ref currentTask);

                //update the WorkDetails class with the new taskId
                WorkDetails.setTaskId(currentTask);

                //Set ALL constants of the task
                SetAllConstants();

                // getting init data
                SetInitializer(currentTask);

                // init queues
                InitQueues(currentTask);

                // initing worker and frontier threads
                InvokeThreads();

                // polling to the user requests
                while (needToRestart == false)
                {
                    Thread.Sleep(_refreshRate * 1000);
                    StatusDisplay.DisplayOnScreen(_feedBackQueue, _serversQueues);
                    if (_operationMode == operationMode_t.Auto)
                    {
                        List <TaskStatus> tasks =
                            StorageSystem.StorageSystem.getInstance().getWorkDetails(currentUser, QueryOption.ActiveTasks);

                        needToRestart = true;
                        foreach (TaskStatus task in tasks)
                        {
                            if (task.getTaskID() == currentTask)
                            {
                                task.setTaskElapsedTime(task.getTaskElapsedTime() + _refreshRate);
                                StorageSystem.StorageSystem.getInstance().changeWorkDetails(task);
                                needToRestart = false;
                                continue;
                            }
                        }
                    }
                }

                // Terminate all the threads
                TerminateThreads();
                needToRestart = false;
                RuntimeStatistics.resetStatistics();
            }

            //RankerTest test = new RankerTest();
            //test.Test2();
        }
コード例 #12
0
        /**
         * This method creates Categorizer Options and returns it.
         * The values of the variables of the new object are brought from the data base.
         * Note : In case the operation mode is manual the variables will be default ones,
         *        such is the case when the returns values from the data base are nulls.
         */
        private static CategorizerOptions getOptions(String optionsType)
        {
            CategorizerOptions options = new CategorizerOptions();

            if (WorkDetails.getOperationMode() == operationMode_t.Auto)
            {
                String alphaSearch = null, bettaSearch = null, gammaSearch = null, minSearch = null, penaltySearch = null;
                switch (optionsType)
                {
                case "anchor":
                    alphaSearch   = TaskProperty.ANC_ALPHA.ToString();
                    bettaSearch   = TaskProperty.ANC_BETA.ToString();
                    gammaSearch   = TaskProperty.ANC_GAMMA.ToString();
                    minSearch     = TaskProperty.ANC_MIN.ToString();
                    penaltySearch = TaskProperty.ANC_PENLTY.ToString();
                    break;

                case "Category":
                    alphaSearch   = TaskProperty.CAT_ALPHA.ToString();
                    bettaSearch   = TaskProperty.CAT_BETA.ToString();
                    gammaSearch   = TaskProperty.CAT_GAMMA.ToString();
                    minSearch     = TaskProperty.CAT_MIN.ToString();
                    penaltySearch = TaskProperty.CAT_PENLTY.ToString();
                    break;

                case "nearby":
                    alphaSearch   = TaskProperty.NER_ALPHA.ToString();
                    bettaSearch   = TaskProperty.NER_BETA.ToString();
                    gammaSearch   = TaskProperty.NER_GAMMA.ToString();
                    minSearch     = TaskProperty.NER_MIN.ToString();
                    penaltySearch = TaskProperty.NER_PENLTY.ToString();
                    break;

                default:
                    goto case "Category";
                }

                String alpha   = StorageSystem.StorageSystem.getInstance().getProperty(WorkDetails.getTaskId(), alphaSearch);
                String betta   = StorageSystem.StorageSystem.getInstance().getProperty(WorkDetails.getTaskId(), bettaSearch);
                String gamma   = StorageSystem.StorageSystem.getInstance().getProperty(WorkDetails.getTaskId(), gammaSearch);
                String min     = StorageSystem.StorageSystem.getInstance().getProperty(WorkDetails.getTaskId(), minSearch);
                String penalty = StorageSystem.StorageSystem.getInstance().getProperty(WorkDetails.getTaskId(), penaltySearch);

                if (isRealNum(alpha))
                {
                    options.ALPHA = Convert.ToDouble(alpha);
                }
                if (isRealNum(betta))
                {
                    options.BETA = Convert.ToDouble(betta);
                }
                if (isRealNum(gamma))
                {
                    options.GAMMA = Convert.ToDouble(gamma);
                }
                if (isRealNum(min))
                {
                    options.MIN_WORDS_LIMIT = Convert.ToDouble(min);
                }
                if (isRealNum(penalty))
                {
                    options.MIN_WORDS_PENLTY = Convert.ToDouble(penalty);
                }
            }

            return(options);
        }
コード例 #13
0
 /**
  * Sets the number of threads,if it is mode of operation is Auto
  */
 public static void SetNumberOfThreads()
 {
     if (_operationMode == operationMode_t.Auto)
     {
         String numberOfThreads = StorageSystem.StorageSystem.getInstance().getProperty(WorkDetails.getTaskId(), TaskProperty.THREADS.ToString());
         if ((numberOfThreads != null) && (numberOfThreads != ""))
         {
             if (Convert.ToInt16(numberOfThreads) > 0)
             {
                 SetFlag("numThreads", numberOfThreads);
             }
         }
     }
 }
コード例 #14
0
        public async Task <MainDetail> ExecuteLuisQuery(ILogger logger, ITurnContext turnContext, CancellationToken cancellationToken)
        {
            MainDetail detail = new MainDetail();

            try {
                LuisRecognizer luisRecognizer = new LuisRecognizer(luisApplication);
                recognizerResult = await luisRecognizer.RecognizeAsync(turnContext, cancellationToken);

                //높은 점수의 의도 저장
                var(intent, score) = recognizerResult.GetTopScoringIntent();
                //대화의도에 따른 엔티티 저장
                intent = "트랙정보카드";
                switch (intent)
                {
                case "버스":
                    BusDetails busDetails = new BusDetails();
                    busDetails.intent = intent;
                    busDetails        = getLuisEntites(busDetails);
                    detail            = busDetails;
                    break;

                case "미세먼지":
                    DustDetails dustDetails = new DustDetails();
                    dustDetails.intent = intent;
                    dustDetails        = getDustLuisEntites(dustDetails);
                    detail             = dustDetails;
                    break;

                case "장학제도":
                    detail.intent = intent;
                    break;

                case "전화번호":
                    PhoneDetails phoneDetails = new PhoneDetails();
                    phoneDetails.intent = intent;
                    phoneDetails        = getPhoneEntites(phoneDetails);
                    detail = phoneDetails;
                    break;

                case "교수님":
                    ProfessorsDetail pfDetail = new ProfessorsDetail();
                    pfDetail.intent = intent;
                    pfDetail        = getProfessorEntites(pfDetail);
                    detail          = pfDetail;
                    break;

                case "트랙정보":
                    TrackInfoDetails trackInfoDetails = new TrackInfoDetails();
                    trackInfoDetails.intent = intent;
                    detail = trackInfoDetails;
                    break;

                case "트랙정보카드":
                    TrackInfoCardDetail trackInfoCardDetail = new TrackInfoCardDetail();
                    trackInfoCardDetail.intent = intent;
                    detail = trackInfoCardDetail;
                    break;

                case "공지사항":
                    NoticeDetail noticeDetail = new NoticeDetail();
                    noticeDetail.intent = intent;
                    detail = noticeDetail;
                    break;

                case "맛집":
                    MatjeepchoochunDetail matjeepchoochunDetail = new MatjeepchoochunDetail();
                    matjeepchoochunDetail.intent = intent;
                    matjeepchoochunDetail        = getMatjeepchoochunEntites(matjeepchoochunDetail);
                    detail = matjeepchoochunDetail;
                    break;

                case "학식메뉴":
                    detail.intent = intent;
                    break;

                case "직업":
                    WorkDetails workDetails = new WorkDetails();
                    workDetails.intent = intent;
                    workDetails        = getWorkentites(workDetails);
                    detail             = workDetails;
                    break;
                }
            }
            catch (Exception e)
            {
                await turnContext.SendActivityAsync(MessageFactory.Text("예기치 못한 오류가 발생하였습니다. 다시 시도해주십시오\n" + e.Message), cancellationToken);
            }

            return(detail);
        }
コード例 #15
0
ファイル: Crawler.cs プロジェクト: dangtranduc/iwebcrawler
        /**
         * This method chooses the frontier as seen in the data base.
         */
        private static Frontier chooseFrontier()
        {
            String frontierType = StorageSystem.StorageSystem.getInstance().getProperty(WorkDetails.getTaskId(),
                                                                                        TaskProperty.FRONTIER.ToString());

            String BFS   = FrontierDesign.FIFO_BFS.ToString();
            String SSEv0 = FrontierDesign.RANK_SSEv0.ToString();

            if (frontierType == null)
            {
                return(new BFSFrontier(_feedBackQueue, _serversQueues));
            }

            if (frontierType.Trim().Equals(BFS))
            {
                return(new BFSFrontier(_feedBackQueue, _serversQueues));
            }
            else if (frontierType.Trim().Equals(SSEv0)) // TODO: rechange to RankFrontier
            {
                return(new RankFrointer(_feedBackQueue, _serversQueues));
            }
            else
            {
                return(new BFSFrontier(_feedBackQueue, _serversQueues));
            }
        }