Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Arafat Tehsin arafattehsin

🎯
Focusing
View GitHub Profile
@arafattehsin
arafattehsin / Simulator.cs
Created Oct 31, 2022
This is a sample for the Simulator used for Azure Personalizer
View Simulator.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Simulator
{
public class Simulator
{
@arafattehsin
arafattehsin / UserSimulator.cs
Created Oct 27, 2022
This is a sample User Simulator class for Azure Personalizer
View UserSimulator.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Simulator
{
public class UserSimulator
{
@arafattehsin
arafattehsin / GetFlightDetails.cs
Created Feb 23, 2020
This is a sample Azure function without any real API implementation for Flight Tracker.
View GetFlightDetails.cs
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System.Net.Http;
@arafattehsin
arafattehsin / Immersive Reader (Cognitive Service) Controller
Created Dec 9, 2019
This is a sample Controller for obtaining a token for Immersive Reader Cognitive Service
View Immersive Reader (Cognitive Service) Controller
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using ImmersiveReaderDemo.Models;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
@arafattehsin
arafattehsin / VABot.cs
Created Oct 30, 2019
Excerpt from the main Bot class; for complete code, please refer to CognitiveRocket repo.
View VABot.cs
private async Task ProcessVABotAsync(ITurnContext<Microsoft.Bot.Schema.IMessageActivity> turnContext, CancellationToken cancellationToken)
{
var token = await _botServices.VABotService.GetTokenAsync();
using (var directLineClient = new DirectLineClient(token))
{
var conversation = await directLineClient.Conversations.StartConversationAsync();
var conversationtId = conversation.ConversationId;
var response = await directLineClient.Conversations.PostActivityAsync(conversationtId, new Microsoft.Bot.Connector.DirectLine.Activity()
@arafattehsin
arafattehsin / BotServices.cs
Created Oct 30, 2019
Class to read configuration and assigning them to the respective language models and knowledge sources such as LUIS, QnA and Virtual Agent
View BotServices.cs
public class BotServices : IBotServices
{
public BotServices(IConfiguration configuration)
{
// Read the setting for cognitive services (LUIS, QnA) from the appsettings.json
// If includeApiResults is set to true, the full response from the LUIS api (LuisResult)
// will be made available in the properties collection of the RecognizerResult
VABotDispatch = new LuisRecognizer(new LuisApplication(
configuration["LuisAppId"],
configuration["LuisAPIKey"],
@arafattehsin
arafattehsin / VABotService.cs
Created Oct 30, 2019
This is core class to connect Dynamics 365 Virtual Agent for Customer Service with Microsoft Bot Framework
View VABotService.cs
public class VABotService
{
private readonly HttpClient _httpClient;
public VABotService(VABotEndpoint endpoint, string botName)
{
Endpoint = endpoint;
BotName = botName;
ChannelData = new VABotChannelData(endpoint.BotId, endpoint.TenantId);
_httpClient = new HttpClient();
@arafattehsin
arafattehsin / data.csv
Created May 4, 2019
This data is used for the SentimentAnalyzer for .NET Standard apps
View data.csv
We can't make this file beautiful and searchable because it's too large.
Label,TweetId,Date,Query,User,Tweet
0,2252799415,Sat Jun 20 07:01:14 PDT 2009,NO_QUERY,uhohcaitie,Well that was a major let down was expecting somthing good
0,2252799527,Sat Jun 20 07:01:15 PDT 2009,NO_QUERY,SeaSunSky,i was fugly on thursday nite
0,2252799546,Sat Jun 20 07:01:15 PDT 2009,NO_QUERY,Baby_KeL_KeL,Girly Nite 2nite with face masks and takeaway. Last nite hanging wuth my sister
0,2252799810,Sat Jun 20 07:01:17 PDT 2009,NO_QUERY,nigelhoney,"@peterlyle oh plus two tripods and reflectors, a backpack plus small shoulder bag. Would take those primes and macros if I owned them "
0,2252800004,Sat Jun 20 07:01:18 PDT 2009,NO_QUERY,myschel,Are u sure its summer??? It feels like spring to me
0,2252802749,Sat Jun 20 07:01:37 PDT 2009,NO_QUERY,formaggio,No hummus tasting today I'm sure we'll see Samira again soon! Angus is still coming to taste out some of his wine at around 1pm.
0,2252802810,Sat Jun 20 07:01:37 PDT 2009,NO_QUERY,caitlin_bruce,@tommcfly naughty dougie!! i wanna get tickets to come see u