简体   繁体   English

Selenium Webdriver拼写检查

[英]Selenium Webdriver spell check

Is there a possibility to spell check on content displayed in web page with selenium webdriver. 是否有可能使用selenium webdriver拼写检查网页中显示的内容。 or can you suggest any API for the same. 或者你能为它推荐任何API吗? Regards, Eliyas 此致,Eliyas

Try the Google API for spell checking. 尝试使用Google API进行拼写检查。 Solution is for java - https://code.google.com/p/google-api-spelling-java/ 解决方案适用于java - https://code.google.com/p/google-api-spelling-java/

(Below content is from the link) (以下内容来自链接)

Sample code: 示例代码:

SpellChecker checker = new SpellChecker();
SpellResponse spellResponse = checker.check( "helloo worlrd" );
for( SpellCorrection sc : spellResponse.getCorrections() )
System.out.println( sc.getValue() );

This will print all the corrections available for the text "helloo worlrd". 这将打印文本“helloo worlrd”的所有可用修正。

It is also possible to set more options to the request, 也可以为请求设置更多选项,

// 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() );

Update : Found some more spell checkers: 更新 :找到更多拼写检查器:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM