RxJS samples
How can we even proceed without seeing our spell checker in action on a web page? For this, we need an ASP.NET Web API that provides the suggestions. We will reuse our earlier NorvigSpellCheckerModel class as-is for this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using SpellChecker;
namespace MvcApplication1.Controllers
{
public class SearchContext
{
public string Lookup { get; set; }
public int Count { get; set; }
}
public class ValuesController : ApiController
{
ISpellCheckerModel _spellChecker =
NorvigSpellCheckerModel.Instance;
// GET api/values
public IEnumerable<string> Get([FromUri] SearchContext
context)
{
return _spellChecker.SpellCheck(context.Lookup,
context.Count);
}...