【发布时间】:2015-03-31 11:44:28
【问题描述】:
是否可以使用 selenium webdriver 对网页中显示的内容进行拼写检查。或者你能推荐任何相同的API。 问候, 埃利亚斯
【问题讨论】:
-
请提供有关该方案的更多详细信息。
是否可以使用 selenium webdriver 对网页中显示的内容进行拼写检查。或者你能推荐任何相同的API。 问候, 埃利亚斯
【问题讨论】:
尝试使用 Google API 进行拼写检查。解决方案适用于 java - https://code.google.com/p/google-api-spelling-java/
(以下内容来自链接)
示例代码:
SpellChecker checker = new SpellChecker();
SpellResponse spellResponse = checker.check( "helloo worlrd" );
for( SpellCorrection sc : spellResponse.getCorrections() )
System.out.println( sc.getValue() );
这将打印文本“helloo worlrd”的所有可用更正。
也可以为请求设置更多选项,
// Proxy settings
Configuration config = new Configuration();
config.setProxy( "my_proxy_host", 8080, "http" );
SpellChecker checker = new SpellChecker( config );
checker.setOverHttps( true ); // Use https (default true from v1.1)
checker.setLanguage( Language.ENGLISH ); // Use English (default)
SpellRequest request = new SpellRequest();
request.setText( "helloo helloo worlrd" );
request.setIgnoreDuplicates( true ); // Ignore duplicates
SpellResponse spellResponse = checker.check( request );
for( SpellCorrection sc : spellResponse.getCorrections() )
System.out.println( sc.getValue() );
更新: 找到更多拼写检查器:
【讨论】: