【问题标题】:Selenium Webdriver spell checkSelenium Webdriver 拼写检查
【发布时间】:2015-03-31 11:44:28
【问题描述】:

是否可以使用 selenium webdriver 对网页中显示的内容进行拼写检查。或者你能推荐任何相同的API。 问候, 埃利亚斯

【问题讨论】:

  • 请提供有关该方案的更多详细信息。

标签: java selenium-webdriver


【解决方案1】:

尝试使用 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() );

更新: 找到更多拼写检查器:

  1. JSpell - https://www.jspell.com/java-spell-checker.html
  2. JOrtho(免费)-http://jortho.sourceforge.net/
  3. 爵士(免费)-http://sourceforge.net/projects/jazzy/

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2011-02-11
  • 2010-12-01
  • 2011-01-05
  • 2011-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多