【问题标题】:Google Spellcheck谷歌拼写检查
【发布时间】:2013-09-20 01:46:59
【问题描述】:

我无法访问位于此地址的 Google 拼写检查服务:

https://www.google.com/tbproxy/spell

还有其他人有这个问题吗?当我尝试连接时,我不断收到“坏网关”。我很确定该服务已离线。

有什么消息吗?我知道 Google 云端硬盘在几周前出现了故障,出现了同样的错误消息。

【问题讨论】:

  • 我也无法访问。
  • 已停机超过 24 小时。

标签: spell-checking spelling


【解决方案1】:

您可以在下面的 Java 代码中试试这个。这不需要任何 API 密钥。但请注意,如果您经常运行它,它将停止工作,因为 google 会阻止 IP 地址进行未来的调用。您可以在小型数据集上使用它。不是理想的解决方案,但如果它是在一段时间内运行的某个批处理作业的一部分,那么您可能会接受这种方法。

public static String getSpellCheckedText(String Text) throws Exception {
    String google = "http://www.google.com/complete/search?output=toolbar&q=";
    String search = Text;
    String charset = "UTF-8";

    String spellCheckedText = Text;
    URL url = new URL(google + URLEncoder.encode(search, charset));
    Reader reader = new InputStreamReader(url.openStream(), charset);
    BufferedReader bufReader = new BufferedReader(reader);
    String line = bufReader.readLine();
    StringBuffer sBuffer = new StringBuffer();
    while (line != null) {
        sBuffer.append(line).append("\n");
        line = bufReader.readLine();
    }
    String content = sBuffer.toString();

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    InputSource is = new InputSource(new StringReader(content));
    Document document = builder.parse(is);
    NodeList nodeList = document.getElementsByTagName("suggestion");
    if (nodeList != null && nodeList.getLength() > 0) {
        org.w3c.dom.Node elm = nodeList.item(0);
        if (elm.getNodeType() == Node.ELEMENT_NODE) {
            Element suggestionElement = (Element)elm;
            String suggestedString = suggestionElement.getAttribute("data");
            if (suggestedString != null && suggestedString.trim().length() != 0) {
                spellCheckedText = suggestedString.trim();
                System.out.println(Text + " => "+ spellCheckedText);
            }
        }
    }
    return spellCheckedText;
}

【讨论】:

    【解决方案2】:

    我也遇到了这个问题。我收到了503 Server Error。问题肯定在谷歌的一端。 (注:我使用的是 Safari 6.0.3)

    具体...

    503. That's an error.  
    
    The service you requested is not available at this time.
    
    Service error -27. That’s all we know.
    

    Google 的服务似乎存在一些问题。希望他们尽快修复它!

    【讨论】:

      【解决方案3】:

      同上,这里。我真的依靠它来检查文本框中的拼写。它显示“无法连接到 Google 拼写服务器。请检查您的互联网连接并重试”

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-04-15
        • 2014-10-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-11-01
        • 1970-01-01
        • 2018-07-04
        相关资源
        最近更新 更多