diff --git a/doc/function/check_spelling.txt b/doc/function/check_spelling.txt new file mode 100644 index 00000000..688ea76b --- /dev/null +++ b/doc/function/check_spelling.txt @@ -0,0 +1,36 @@ +Function: check_spelling + +--Usage-- +> check_spelling(some_tagged_string, language:language_code) + +Check the spelling of a piece of text, and mark errors with @@ tags. + +--Dictionaries-- +The language code must correspond to a dictionary in the @dictionaries@ data directory (usually @%MSE_DIR%\data\dictionaries@). +A dictionary consists of two files, @language.dic@ and @language.aff@. + +Magic Set Editor is compatible with Hunspell dictionaries, which are also used by Open Office and Firefox. +These dictionaries can be found on [[http://wiki.services.openoffice.org/wiki/Dictionaries|the Open Office website]]. + +--Parameters-- +! Parameter Type Description +| @input@ [[type:tagged string]] String to check. +| @language@ [[type:string]] Language code.
+ The language code consists of an [[http://en.wikipedia.org/wiki/ISO_639|ISO language code]] and an [[http://en.wikipedia.org/wiki/ISO_3166-1|ISO country code]] separated by an underscore. +| @extra_dictionary@ [[type:string]] (optional) + Name of an additional dictionary to use. This dictionary could be specific to the game file. + The name should be of the form @"my-game.mse-game/dictionary"@, + in which case MSE looks for the file @"my-game.mse-game/dictionary.en_US.dic"@ where @"en_US"@ is the language code. +| @extra_match@ [[type:function]] (optional) + Function that returns @true@ for additional words that are spelled correctly. + This can be used for codes like @"+1/+1"@ on magic cards. + +--Examples-- +> check_spelling("Can I have an appple?", language:"en_US") +> == "Can I have an appple?" + +In the second example any text matching the [[type:regex]] @"x[a-z]*"@, i.e. any word beginning with the letter x, is not considered an error: +> check_spelling("xyzzyx", language:"en_US") +> == "xyzzyx" +> check_spelling("xyzzyx", language:"en_US", extra_match: match@(match:"x[a-z]*")) +> == "xyzzyx" diff --git a/doc/function/index.txt b/doc/function/index.txt index d5a9a9ba..aa6460f5 100644 --- a/doc/function/index.txt +++ b/doc/function/index.txt @@ -23,8 +23,6 @@ These functions are built into the program, other [[type:function]]s can be defi | [[fun:reverse]] Reverse a string, @"aBc" -> "cBa"@. | [[fun:trim]] Remove leading and trailing whitespace from a string, @" abc " -> "abc"@. | [[fun:substring]] Extract a part of a string. -| [[fun:format]] Format a number as a string (printf). -| [[fun:curly_quotes]] Make quotes curly. | [[fun:replace]] Replace text matching a regular expression. | [[fun:filter_text]] Keep only the text matching a regular expression. | [[fun:break_text]] Break text into parts each matching a regular expression. @@ -33,6 +31,8 @@ These functions are built into the program, other [[type:function]]s can be defi | [[fun:contains]] Does a string contain another one? | [[fun:match]] Does a string match a regular expression? | [[fun:regex_escape]] Escape a string for use in a regular expression. +| [[fun:curly_quotes]] Make quotes curly. +| [[fun:check_spelling]] Check text for spelling errors. ! [[type:tagged_string|Tags]] <<< | [[fun:tag_contents]] Change the contents of a specific tag.