Java English word correction check frame (word Checker)

Source: Internet
Author: User
Tags assert i18n speling

Tag: false Ofo does not check XML spell Boolean return nal

Word Checker

This item is used for word spell checking.

Project Introduction

Word checker is used for word spell checking.

Github Address

Feature Description Support i18n

Error prompt Support i18n

Support for English word correction
    • Can quickly determine if the current word is spelled incorrectly

    • Can return best match results

    • Can return a corrected match list, support specifying the size of the return list
New features that will be added later
    • English word support self-defined

    • The spelling of Chinese words is correct function add
Quick start of JDK version

JDK1.7 and later

Introductory example Maven Introduction

This project has been uploaded to the Maven repository and can be directly introduced

<dependency>     <groupId>com.github.houbb</groupId>     <artifactId>word-checker</artifactId>    <version>0.0.1</version></dependency>
Test case
    • Main.java
public static void main(String[] args) {    final String result = EnWordChecker.getInstance().correct("speling");    System.out.println(result);}

Result is

spelling
English spelling correction function introduction

Note

All methods are EnWordChecker under class.

function Method Parameters return value Notes
Determine if a word is spelled correctly Iscorrect (String) Words to be detected Boolean
Return the best corrective results Correct (String) Words to be detected String If you don't find a word that can be corrected, it returns itself
Determine if a word is spelled correctly Correctlist (String) Words to be detected List<string> Returns all matching corrections lists
Determine if a word is spelled correctly Correctlist (string, int limit) The word to be detected returns the size of the list Returns the corrected list of the specified size List size <= limit
Test examples

See also [] ()

/** * 是否拼写正确 */@Testpublic void isCorrectTest() {    final String hello = "hello";    final String speling = "speling";    Assert.assertTrue(EnWordChecker.getInstance().isCorrect(hello));    Assert.assertFalse(EnWordChecker.getInstance().isCorrect(speling));}
/*** 返回最佳匹配结果*/@Testpublic void correctTest() {    final String hello = "hello";    final String speling = "speling";    Assert.assertEquals("hello", EnWordChecker.getInstance().correct(hello));    Assert.assertEquals("spelling", EnWordChecker.getInstance().correct(speling));}
/** * 默认纠正匹配列表 * 1. 默认返回所有 */@Testpublic void correctListTest() {    final String word = "goo";    List<String> stringList = EnWordChecker.getInstance().correctList(word);    Assert.assertTrue(stringList.size() > 0);}
/** * 默认纠正匹配列表 * 1. 默认返回所有 */@Testpublic void correctListTest() {    final String word = "goo";    List<String> stringList = EnWordChecker.getInstance().correctList(word);    Assert.assertTrue(stringList.size() > 0);}
Technical Acknowledgement

The original English word data provided by Words.

Document reference

ENABLE word List

Spell-correct

Spellchecking

Java English word correction check frame (word Checker)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.