Does anyone know? I pass spell check "accelerants" which is a perfectly good word. I get back "accelerates"? When I open Google in a browser and type "accelerants" it does NOT suggest "accelerates"?
using System;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
namespace SpellCheck
{
class googel_SP
{
public string word;
public void run_G()
{
string retValue = string.Empty;
string Iword = "accelerants";
try
{
string uri = "https://www.google.com/tbproxy/spell?lang=en:";
using (WebClient webclient = new WebClient())
{
string postData = string.Format("<?xml version="1.0" encoding="utf-8" ?> "
+ "<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" "
+ "ignoreallcaps="1"><text>{0}</text></spellrequest>", Iword);
webclient.Headers.Add("Content-Type", "application/x-www-form- urlencoded");
byte[] bytes = Encoding.ASCII.GetBytes(postData);
byte[] response = webclient.UploadData(uri, "POST", bytes);
string data = Encoding.ASCII.GetString(response);
if (data != string.Empty)
{
retValue = Regex.Replace(data, @"<(.|
)*?>", string.Empty).Split('')[0];
Console.WriteLine(" word in -> " + word + " word out -> " + retValue);
}
}
}
catch (Exception exp)
{
}
//return retValue;
}
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…