Dynamic web page creation skills PHP spelling check function library

Source: Internet
Author: User
Before applying this function, you need to go to http://metalab.unc.edu/kevina/aspellto retrieve the required spelling check Library aspelllibrary.

Before applying this function, you need to retrieve the desired spelling check function library aspell library from the http://metalab.unc.edu/kevina/aspell.

Aspell_new: loads a new dictionary.
Aspell_check: check a single word.
Aspell_check-raw: check for a single word and do not change or correct even if spelling is wrong.
Aspell_suggest: checks a single word and provides spelling suggestions.


Aspell_new
Load a new dictionary.
Syntax: int aspell_new (string master, string personal );
Return value: integer
Function type: Material Processing
Content clarifies that this function is loaded into a new dictionary and assigned with a new identity value (integer) for application in the program.
Application model $ aspell_link = aspell_new ('INC ');

Aspell_check
Check a single word.
Syntax: boolean aspell_check (int dictionary_link, string word );
Return value: Boolean
Function type: Material Processing
Content clarification this function checks the spelling of a single word. If the spelling is accurate, true is returned. if the spelling is inaccurate, false is returned.
Application model
$ Aspell_link = aspell_new ('English ');
If (aspell_check ($ aspell_link, 'testt ')){
Echo 'This is a valid spelling ';
} Else {
Echo 'Sorry, wrong spelling ';
}

Aspell_check-raw
Check a single word and do not change or correct it even if it is spelled incorrectly.
Syntax: boolean aspell_check_raw (int dictionary_link, string word );
Return value: Boolean
Function type: Material Processing
Content clarification
This function checks the spelling of a single word. If the spelling is accurate, true is returned. if the spelling is inaccurate, false is returned. This function does not change or correct the spelling of the app.

Application model
$ Aspell_link = aspell_new ('English ');
If (aspell_check_raw ($ aspell_link, 'testt ')){
Echo 'This is a valid spelling ';
} Else {
Echo 'Sorry, wrong spelling ';
}

Aspell_suggest
Check a single word and provide spelling suggestions.
Syntax: array aspell_suggest (int dictionary_link, string word );
Returned value: Array
Function type: Material Processing
Content clarification
This function checks the spelling of a single word. And give possible spelling and accurate suggestions to return results in array type.
Application model
$ Aspell_link = aspell_new ('English ');
If (! Aspell_check ($ aspell_link, 'testt ')){
$ Suggestions = aspell_suggest ($ aspell_link, 'testt ');
For ($ I = 0; $ I <count ($ suggestions); $ I ){
Echo 'possible spelling: '. $ suggestions [$ I].'
';
}
}
?>


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.