// Use this for initialization void Start() { player = GameObject.Find("Player"); respawnPoint.x *= GameManager.tileWidth + GameManager.tileWidth / 2; respawnPoint.y *= -GameManager.tileHeight + GameManager.tileHeight / 2; currentWaypoint = respawnPoint; Spawn(); pathIndex = -1; path = null; state = STATE.PATH; pathState = PATH_STATE.NOT_FOLLOW; spotter = this.GetComponent <Spotter>(); spotter.inRange = spotRange; spotter.leashRange = outOfSpotRange; spotter.target = player; attack = this.GetComponent <SimpleAutoAttack>(); attack.cooldown = attackCoolDown; attack.range = attackRange; attack.speedMultiplier = attackSpeedMultiplier; attack.power = attackPower; attack.layerMask = 1 << player.layer; // these last two variables were added to make // the component slightly more modular attack.alwaysAttack = false; attack.nameOfTargets = new string[] { player.name }; astar = this.GetComponent <AStarPathing>(); astar.grid = GameManager.level; astar.validSqrCosts.Add(GameManager.ITEM, 1); astar.validSqrCosts.Add(GameManager.COIN, 1); astar.CalculatePathForWaypoints(waypoints); }
public override string Print(bool link = true, DwarfObject pov = null) { string eventString = GetYearTime(); eventString += Spotter?.ToLink(true, pov) ?? "An unknown creature"; if (SiteCiv != null) { eventString += " of "; eventString += SiteCiv.ToLink(true, pov); } eventString += " spotted the forces"; if (LeaverCiv != null) { eventString += " of "; eventString += LeaverCiv.ToLink(true, pov); } eventString += " slipping out"; if (Site != null) { eventString += " of "; eventString += Site.ToLink(true, pov); } eventString += PrintParentCollection(link, pov); eventString += "."; return(eventString); }
public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new Spotter { FirstName = model.FirstName, LastName = model.LastName, UserName = model.UserName, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); //var userId = Guid.Parse(User.Identity.GetUserId()); //var service = new SpotterService(userId); //service.CreateSpotter(FirstName, LastName); return(RedirectToAction("Index", "Home")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
public void setGameDefinition(GameDefinition gameDefinition) { spotter = null; mapped = false; if (gameDefinition == null) { Console.WriteLine("No game definition selected"); } else { Console.WriteLine("Using game definition " + gameDefinition.friendlyName); UserSettings.GetUserSettings().setProperty("last_game_definition", gameDefinition.gameEnum.ToString()); UserSettings.GetUserSettings().saveUserSettings(); CrewChief.gameDefinition = gameDefinition; //I think we shuld add it here if (gameDefinition.gameEnum == GameEnum.ASSETTO_32BIT || gameDefinition.gameEnum == GameEnum.ASSETTO_64BIT || gameDefinition.gameEnum == GameEnum.RF1 || gameDefinition.gameEnum == GameEnum.RF2_64BIT) { PluginInstaller pluginInstaller = new PluginInstaller(); pluginInstaller.InstallOrUpdatePlugins(gameDefinition); } } }
public bool CreateSpotter(SpotterCreate model) { var entity = new Spotter() { FirstName = model.FirstName, LastName = model.LastName }; using (var ctx = new ApplicationDbContext()) { ctx.Spotters.Add(entity); return(ctx.SaveChanges() == 1); } }
public override string Print(bool link = true, DwarfObject pov = null) { string eventString = GetYearTime(); eventString += Spotter.ToLink(true, pov); eventString += " of "; eventString += SiteCiv.ToLink(true, pov); eventString += " spotted the forces of "; eventString += LeaverCiv?.ToLink(true, pov) ?? "an unknown civilization"; eventString += " slipping out of "; eventString += Site?.ToLink(true, pov); eventString += PrintParentCollection(link, pov); eventString += "."; return(eventString); }
public void setGameDefinition(GameDefinition gameDefinition) { spotter = null; mapped = false; if (gameDefinition == null) { Console.WriteLine("No game definition selected"); } else { Console.WriteLine("Using game definition " + gameDefinition.friendlyName); UserSettings.GetUserSettings().setProperty("last_game_definition", gameDefinition.gameEnum.ToString()); UserSettings.GetUserSettings().saveUserSettings(); CrewChief.gameDefinition = gameDefinition; } }
public Pipeline Initializer() { spotter1 = new Spotter(Language.Any, 0, "Addresses of Atheist Organizations", "Country"); spotter2 = new Spotter(Language.Any, 0, "Resource Type", "Resources"); spotter1.Data.IgnoreCase = true; //In some cases, it might be better to set it to false, and only add upper/lower-case exceptions as required spotter2.Data.IgnoreCase = true; spotter1.AddEntry("USA"); spotter1.AddEntry("United Kingdom"); spotter1.AddEntry("Germany"); //entries can have more than one word, and will be automatically tokenized on whitespace spotter2.AddEntry("Books -- Fiction"); spotter2.AddEntry("Books -- Non-fiction"); spotter2.AddEntry("Net Resources"); var nlp = Pipeline.TokenizerFor(Language.English); nlp.Add(spotter1); //When adding a spotter model, the model propagates any exceptions on tokenization to the pipeline's tokenizer nlp.Add(spotter2); return(nlp); }
public SpottedLeavingSite(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "spotter_hfid": Spotter = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; case "leaver_civ_id": LeaverCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_civ_id": SiteCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; } } Spotter.AddEvent(this); LeaverCiv.AddEvent(this); SiteCiv.AddEvent(this); Site.AddEvent(this); }
private static void DemonstrateSpotter() { //Another way to perform entity recognition is to use a gazeteer-like model. For example, here is one for capturing a set of programing languages var spotter = new Spotter(Language.Any, 0, "programming", "ProgrammingLanguage"); spotter.Data.IgnoreCase = true; //In some cases, it might be better to set it to false, and only add upper/lower-case exceptions as required spotter.AddEntry("C#"); spotter.AddEntry("Python"); spotter.AddEntry("Python 3"); //entries can have more than one word, and will be automatically tokenized on whitespace spotter.AddEntry("C++"); spotter.AddEntry("Rust"); spotter.AddEntry("Java"); var nlp = Pipeline.TokenizerFor(Language.English); nlp.Add(spotter); //When adding a spotter model, the model propagates any exceptions on tokenization to the pipeline's tokenizer var docAboutProgramming = new Document(Data.SampleProgramming, Language.English); nlp.ProcessSingle(docAboutProgramming); PrintDocumentEntities(docAboutProgramming); }
public Boolean Run(String filenameToRun, int interval, Boolean dumpToFile) { loadDataFromFile = false; audioPlayer.mute = false; if (filenameToRun != null && System.Diagnostics.Debugger.IsAttached) { loadDataFromFile = true; spotterEnabled = false; if (interval > 0) { _timeInterval = TimeSpan.FromMilliseconds(interval); audioPlayer.mute = false; } else { _timeInterval = TimeSpan.Zero; audioPlayer.mute = true; } dumpToFile = false; } gameStateMapper = GameStateReaderFactory.getInstance().getGameStateMapper(gameDefinition); gameStateMapper.setSpeechRecogniser(speechRecogniser); gameDataReader = GameStateReaderFactory.getInstance().getGameStateReader(gameDefinition); gameDataReader.dumpToFile = System.Diagnostics.Debugger.IsAttached && dumpToFile; if (gameDefinition.spotterName != null) { spotter = (Spotter)Activator.CreateInstance(Type.GetType(gameDefinition.spotterName), audioPlayer, spotterEnabled); } else { Console.WriteLine("No spotter defined for game " + gameDefinition.friendlyName); spotter = null; } running = true; DateTime nextRunTime = DateTime.Now; if (!audioPlayer.initialised) { Console.WriteLine("Failed to initialise audio player"); return false; } audioPlayer.startMonitor(); Boolean attemptedToRunGame = false; int threadSleepTime = ((int)_timeInterval.Milliseconds / 10) + 1; Console.WriteLine("Polling for shared data every " + _timeInterval.Milliseconds + "ms, pausing " + threadSleepTime + "ms between invocations"); Boolean sessionFinished = false; while (running) { DateTime now = DateTime.Now; if (now > nextRunTime) { nextRunTime = DateTime.Now.Add(_timeInterval); if (!loadDataFromFile) { if (gameDefinition.processName == null || Utilities.IsGameRunning(gameDefinition.processName)) { if (!mapped) { mapped = gameDataReader.Initialise(); } } else if (UserSettings.GetUserSettings().getBoolean(gameDefinition.gameStartEnabledProperty) && !attemptedToRunGame) { Utilities.runGame(UserSettings.GetUserSettings().getString(gameDefinition.gameStartCommandProperty), UserSettings.GetUserSettings().getString(gameDefinition.gameStartCommandOptionsProperty)); attemptedToRunGame = true; } } if (loadDataFromFile || mapped) { stateCleared = false; Object rawGameData; if (loadDataFromFile) { rawGameData = gameDataReader.ReadGameDataFromFile(filenameToRun); if (rawGameData == null) { Console.WriteLine("Reached the end of the data file, sleeping to clear queued messages"); Thread.Sleep(5000); audioPlayer.purgeQueues(); running = false; continue; } } else { rawGameData = gameDataReader.ReadGameData(false); } gameStateMapper.versionCheck(rawGameData); GameStateData nextGameState = null; try { nextGameState = gameStateMapper.mapToGameStateData(rawGameData, currentGameState); } catch (Exception e) { Console.WriteLine("Error mapping game data: " + e.StackTrace); } if (nextGameState != null) { previousGameState = currentGameState; currentGameState = nextGameState; if (!sessionFinished && currentGameState.SessionData.SessionPhase == SessionPhase.Finished && previousGameState != null) { audioPlayer.purgeQueues(); if (displaySessionLapTimes) { Console.WriteLine("Session lap times:"); Console.WriteLine(String.Join(";", currentGameState.SessionData.formattedPlayerLapTimes)); } sessionEndMessages.trigger(previousGameState.SessionData.SessionRunningTime, previousGameState.SessionData.SessionType, currentGameState.SessionData.SessionPhase, previousGameState.SessionData.Position, previousGameState.SessionData.NumCarsAtStartOfSession, previousGameState.SessionData.CompletedLaps, previousGameState.SessionData.IsDisqualified); audioPlayer.closeChannel(); sessionFinished = true; audioPlayer.disablePearlsOfWisdom = false; if (loadDataFromFile) { Thread.Sleep(2000); } } float prevTime = previousGameState == null ? 0 : previousGameState.SessionData.SessionRunningTime; if (currentGameState.SessionData.IsNewSession) { audioPlayer.disablePearlsOfWisdom = false; displayNewSessionInfo(currentGameState); sessionFinished = false; if (!stateCleared) { Console.WriteLine("Clearing game state..."); audioPlayer.purgeQueues(); audioPlayer.closeChannel(); foreach (KeyValuePair<String, AbstractEvent> entry in eventsList) { entry.Value.clearState(); } faultingEvents.Clear(); faultingEventsCount.Clear(); stateCleared = true; } if (enableDriverNames) { List<String> rawDriverNames = currentGameState.getRawDriverNames(); if (currentGameState.SessionData.DriverRawName != null && currentGameState.SessionData.DriverRawName.Length > 0 && !rawDriverNames.Contains(currentGameState.SessionData.DriverRawName)) { rawDriverNames.Add(currentGameState.SessionData.DriverRawName); } if (rawDriverNames.Count > 0) { List<String> usableDriverNames = DriverNameHelper.getUsableDriverNames(rawDriverNames, audioPlayer.soundFilesPath); if (speechRecogniser != null && speechRecogniser.initialised) { speechRecogniser.addOpponentSpeechRecognition(usableDriverNames, enableDriverNames); } audioPlayer.cacheDriverNames(usableDriverNames); } } } else if (!sessionFinished && previousGameState != null && (currentGameState.SessionData.SessionRunningTime > previousGameState.SessionData.SessionRunningTime || (previousGameState != null && previousGameState.SessionData.SessionPhase != currentGameState.SessionData.SessionPhase))) { if (spotter != null) { spotter.unpause(); } if (currentGameState.SessionData.IsNewLap) { currentGameState.display(); } stateCleared = false; foreach (KeyValuePair<String, AbstractEvent> entry in eventsList) { if (entry.Value.isApplicableForCurrentSessionAndPhase(currentGameState.SessionData.SessionType, currentGameState.SessionData.SessionPhase)) { triggerEvent(entry.Key, entry.Value, previousGameState, currentGameState); } } if (spotter != null && spotterEnabled && !spotterIsRunning && !loadDataFromFile) { Console.WriteLine("********** starting spotter***********"); spotter.clearState(); startSpotterThread(); } else if (spotterIsRunning && !spotterEnabled) { runSpotterThread = false; } } else if (spotter != null) { spotter.pause(); } } } } else { Thread.Sleep(threadSleepTime); continue; } } foreach (KeyValuePair<String, AbstractEvent> entry in eventsList) { entry.Value.clearState(); } if (spotter != null) { spotter.clearState(); } stateCleared = true; currentGameState = null; previousGameState = null; sessionFinished = false; audioPlayer.stopMonitor(); audioPlayer.disablePearlsOfWisdom = false; if (gameDataReader != null && gameDataReader.dumpToFile) { gameDataReader.DumpRawGameData(); } gameDataReader.stop(); return true; }
public Boolean Run(String filenameToRun, int interval, Boolean dumpToFile) { loadDataFromFile = false; audioPlayer.mute = false; if (filenameToRun != null && System.Diagnostics.Debugger.IsAttached) { loadDataFromFile = true; spotterEnabled = false; if (interval > 0) { _timeInterval = TimeSpan.FromMilliseconds(interval); audioPlayer.mute = false; } else { _timeInterval = TimeSpan.Zero; audioPlayer.mute = true; } dumpToFile = false; } gameStateMapper = GameStateReaderFactory.getInstance().getGameStateMapper(gameDefinition); gameStateMapper.setSpeechRecogniser(speechRecogniser); gameDataReader = GameStateReaderFactory.getInstance().getGameStateReader(gameDefinition); gameDataReader.ResetGameDataFromFile(); gameDataReader.dumpToFile = System.Diagnostics.Debugger.IsAttached && dumpToFile; if (gameDefinition.spotterName != null) { spotter = (Spotter)Activator.CreateInstance(Type.GetType(gameDefinition.spotterName), audioPlayer, spotterEnabled); } else { Console.WriteLine("No spotter defined for game " + gameDefinition.friendlyName); spotter = null; } running = true; DateTime nextRunTime = DateTime.Now; if (!audioPlayer.initialised) { Console.WriteLine("Failed to initialise audio player"); return(false); } audioPlayer.startMonitor(); Boolean attemptedToRunGame = false; Console.WriteLine("Polling for shared data every " + _timeInterval.Milliseconds + "ms"); Boolean sessionFinished = false; while (running) { DateTime now = DateTime.Now; if (now > nextRunTime) { // ensure the updates don't get synchronised with the spotter / UDP receiver int updateTweak = random.Next(10) - 5; nextRunTime = DateTime.Now.Add(_timeInterval); nextRunTime.Add(TimeSpan.FromMilliseconds(updateTweak)); if (!loadDataFromFile) { if (gameDefinition.processName == null || Utilities.IsGameRunning(gameDefinition.processName)) { if (!mapped) { mapped = gameDataReader.Initialise(); } } else if (UserSettings.GetUserSettings().getBoolean(gameDefinition.gameStartEnabledProperty) && !attemptedToRunGame) { Utilities.runGame(UserSettings.GetUserSettings().getString(gameDefinition.gameStartCommandProperty), UserSettings.GetUserSettings().getString(gameDefinition.gameStartCommandOptionsProperty)); attemptedToRunGame = true; } } if (loadDataFromFile || mapped) { stateCleared = false; Object rawGameData; if (loadDataFromFile) { rawGameData = gameDataReader.ReadGameDataFromFile(filenameToRun); if (rawGameData == null) { Console.WriteLine("Reached the end of the data file, sleeping to clear queued messages"); Thread.Sleep(5000); audioPlayer.purgeQueues(); running = false; continue; } } else { rawGameData = gameDataReader.ReadGameData(false); } gameStateMapper.versionCheck(rawGameData); GameStateData nextGameState = null; try { nextGameState = gameStateMapper.mapToGameStateData(rawGameData, currentGameState); } catch (Exception e) { Console.WriteLine("Error mapping game data: " + e.StackTrace); } // if we're paused or viewing another car, the mapper will just return the previous game state so we don't lose all the // persistent state information. If this is the case, don't process any stuff if (nextGameState != null && nextGameState != currentGameState) { previousGameState = currentGameState; currentGameState = nextGameState; if (!sessionFinished && currentGameState.SessionData.SessionPhase == SessionPhase.Finished && previousGameState != null) { Console.WriteLine("Session finished"); audioPlayer.purgeQueues(); if (displaySessionLapTimes) { Console.WriteLine("Session lap times:"); Console.WriteLine(String.Join(";", currentGameState.SessionData.formattedPlayerLapTimes)); } sessionEndMessages.trigger(previousGameState.SessionData.SessionRunningTime, previousGameState.SessionData.SessionType, currentGameState.SessionData.SessionPhase, previousGameState.SessionData.SessionStartPosition, previousGameState.SessionData.Position, previousGameState.SessionData.NumCarsAtStartOfSession, previousGameState.SessionData.CompletedLaps, previousGameState.SessionData.IsDisqualified); sessionFinished = true; audioPlayer.disablePearlsOfWisdom = false; if (loadDataFromFile) { Thread.Sleep(2000); } } float prevTime = previousGameState == null ? 0 : previousGameState.SessionData.SessionRunningTime; if (currentGameState.SessionData.IsNewSession) { Console.WriteLine("New session"); audioPlayer.disablePearlsOfWisdom = false; displayNewSessionInfo(currentGameState); sessionFinished = false; if (!stateCleared) { Console.WriteLine("Clearing game state..."); audioPlayer.purgeQueues(); foreach (KeyValuePair <String, AbstractEvent> entry in eventsList) { entry.Value.clearState(); } faultingEvents.Clear(); faultingEventsCount.Clear(); stateCleared = true; } if (enableDriverNames) { List <String> rawDriverNames = currentGameState.getRawDriverNames(); if (currentGameState.SessionData.DriverRawName != null && currentGameState.SessionData.DriverRawName.Length > 0 && !rawDriverNames.Contains(currentGameState.SessionData.DriverRawName)) { rawDriverNames.Add(currentGameState.SessionData.DriverRawName); } if (rawDriverNames.Count > 0) { List <String> usableDriverNames = DriverNameHelper.getUsableDriverNames(rawDriverNames); if (speechRecogniser != null && speechRecogniser.initialised) { speechRecogniser.addOpponentSpeechRecognition(usableDriverNames, enableDriverNames); } } } } // TODO: for AC free practice sessions, the SessionRunningTime is set to 1 hour in the mapper and stays there so this block never triggers else if (!sessionFinished && previousGameState != null && (currentGameState.SessionData.SessionRunningTime > previousGameState.SessionData.SessionRunningTime || (previousGameState.SessionData.SessionPhase != currentGameState.SessionData.SessionPhase)) || ((gameDefinition.gameEnum == GameEnum.PCARS_32BIT || gameDefinition.gameEnum == GameEnum.PCARS_64BIT || gameDefinition.gameEnum == GameEnum.PCARS_NETWORK) && currentGameState.SessionData.SessionHasFixedTime && currentGameState.SessionData.SessionTotalRunTime == -1)) { if (spotter != null) { if (currentGameState.FlagData.isFullCourseYellow) { spotter.pause(); } else { spotter.unpause(); } } if (currentGameState.SessionData.IsNewLap) { currentGameState.display(); } stateCleared = false; foreach (KeyValuePair <String, AbstractEvent> entry in eventsList) { if (entry.Value.isApplicableForCurrentSessionAndPhase(currentGameState.SessionData.SessionType, currentGameState.SessionData.SessionPhase)) { triggerEvent(entry.Key, entry.Value, previousGameState, currentGameState); } } if (spotter != null && spotterEnabled && !spotterIsRunning && !loadDataFromFile) { Console.WriteLine("********** starting spotter***********"); spotter.clearState(); startSpotterThread(); } else if (spotterIsRunning && !spotterEnabled) { runSpotterThread = false; } } else if (spotter != null) { spotter.pause(); } } } } else { // ensure the updates don't get synchronised with the spotter / UDP receiver int threadSleepTime = 5 + random.Next(10); Thread.Sleep(threadSleepTime); continue; } } foreach (KeyValuePair <String, AbstractEvent> entry in eventsList) { entry.Value.clearState(); } if (spotter != null) { spotter.clearState(); } stateCleared = true; currentGameState = null; previousGameState = null; sessionFinished = false; Console.WriteLine("Stopping queue monitor"); audioPlayer.stopMonitor(); audioPlayer.disablePearlsOfWisdom = false; if (gameDataReader != null && gameDataReader.dumpToFile) { gameDataReader.DumpRawGameData(); } gameDataReader.stop(); return(true); }
private void Awake() { spotter = GameObject.Find("Spotter").GetComponentInChildren <Spotter>(); }
public static async Task Main(string[] args) { Console.OutputEncoding = Encoding.UTF8; ApplicationLogging.SetLoggerFactory(LoggerFactory.Create(lb => lb.AddConsole())); // Catalyst currently supports 3 different types of models for Named Entity Recognition (NER): // - Gazetteer-like(i.e. [Spotter](https://github.com/curiosity-ai/catalyst/blob/master/Catalyst/src/Models/EntityRecognition/Spotter.cs)) // - Regex-like(i.e. [PatternSpotter](https://github.com/curiosity-ai/catalyst/blob/master/Catalyst/src/Models/EntityRecognition/PatternSpotter.cs)) // - Perceptron (i.e. [AveragePerceptronEntityRecognizer](https://github.com/curiosity-ai/catalyst/blob/master/Catalyst/src/Models/EntityRecognition/AveragePerceptronEntityRecognizer.cs)) // For training an AveragePerceptronModel, check the source-code here: https://github.com/curiosity-ai/catalyst/blob/master/Catalyst.Training/src/TrainWikiNER.cs // This example uses the pre-trained WikiNER model, trained on the data provided by the paper "Learning multilingual named entity recognition from Wikipedia", Artificial Intelligence 194 (DOI: 10.1016/j.artint.2012.03.006) // The training data was sourced from the following repository: https://github.com/dice-group/FOX/tree/master/input/Wikiner //Configures the model storage to use the online repository backed by the local folder ./catalyst-models/ Storage.Current = new OnlineRepositoryStorage(new DiskStorage("catalyst-models")); //Create a new pipeline for the english language, and add the WikiNER model to it Console.WriteLine("Loading models... This might take a bit longer the first time you run this sample, as the models have to be downloaded from the online repository"); var nlp = await Pipeline.ForAsync(Language.English); nlp.Add(await AveragePerceptronEntityRecognizer.FromStoreAsync(language: Language.English, version: Version.Latest, tag: "WikiNER")); //Another available model for NER is the PatternSpotter, which is the conceptual equivalent of a RegEx on raw text, but operating on the tokenized form off the text. //Adds a custom pattern spotter for the pattern: single("is" / VERB) + multiple(NOUN/AUX/PROPN/AUX/DET/ADJ) var isApattern = new PatternSpotter(Language.English, 0, tag: "is-a-pattern", captureTag: "IsA"); isApattern.NewPattern("Is+Noun", mp => mp.Add(new PatternUnit(P.Single().WithToken("is").WithPOS(PartOfSpeech.VERB)), new PatternUnit(P.Multiple().WithPOS(PartOfSpeech.NOUN, PartOfSpeech.PROPN, PartOfSpeech.AUX, PartOfSpeech.DET, PartOfSpeech.ADJ)) )); nlp.Add(isApattern); //For processing a single document, you can call nlp.ProcessSingle var doc = new Document(Data.Sample_1, Language.English); nlp.ProcessSingle(doc); //For processing a multiple documents in parallel (i.e. multithreading), you can call nlp.Process on an IEnumerable<IDocument> enumerable var docs = nlp.Process(MultipleDocuments()); //This will print all recognized entities. You can also see how the WikiNER model makes a mistake on recognizing Amazon as a location on Data.Sample_1 PrintDocumentEntities(doc); foreach (var d in docs) { PrintDocumentEntities(d); } //For correcting Entity Recognition mistakes, you can use the Neuralyzer class. //This class uses the Pattern Matching entity recognition class to perform "forget-entity" and "add-entity" //passes on the document, after it has been processed by all other proceses in the NLP pipeline var neuralizer = new Neuralyzer(Language.English, 0, "WikiNER-sample-fixes"); //Teach the Neuralyzer class to forget the match for a single token "Amazon" with entity type "Location" neuralizer.TeachForgetPattern("Location", "Amazon", mp => mp.Add(new PatternUnit(P.Single().WithToken("Amazon").WithEntityType("Location")))); //Teach the Neuralyzer class to add the entity type Organization for a match for the single token "Amazon" neuralizer.TeachAddPattern("Organization", "Amazon", mp => mp.Add(new PatternUnit(P.Single().WithToken("Amazon")))); //Add the Neuralyzer to the pipeline nlp.UseNeuralyzer(neuralizer); //Now you can see that "Amazon" is correctly recognized as the entity type "Organization" var doc2 = new Document(Data.Sample_1, Language.English); nlp.ProcessSingle(doc2); PrintDocumentEntities(doc2); //Another way to perform entity recognition is to use a gazeteer-like model. For example, here is one for capturing a set of programing languages var spotter = new Spotter(Language.Any, 0, "programming", "ProgrammingLanguage"); spotter.Data.IgnoreCase = true; //In some cases, it might be better to set it to false, and only add upper/lower-case exceptions as required spotter.AddEntry("C#"); spotter.AddEntry("Python"); spotter.AddEntry("Python 3"); //entries can have more than one word, and will be automatically tokenized on whitespace spotter.AddEntry("C++"); spotter.AddEntry("Rust"); spotter.AddEntry("Java"); var nlp2 = Pipeline.TokenizerFor(Language.English); nlp2.Add(spotter); //When adding a spotter model, the model propagates any exceptions on tokenization to the pipeline's tokenizer var docAboutProgramming = new Document(Data.SampleProgramming, Language.English); nlp.ProcessSingle(docAboutProgramming); PrintDocumentEntities(docAboutProgramming); }