├── .editorconfig ├── .github ├── dependabot.yml └── workflows │ ├── codeql-analysis.yml │ └── gradle.yml ├── .gitignore ├── Input.java ├── LICENSE.md ├── README.md ├── SpellChecker ├── README.md ├── build.gradle └── src │ ├── main │ ├── dist │ │ ├── Jazzy.CONTRIBUTORS.txt │ │ ├── Jazzy.LICENSE.txt │ │ ├── Jazzy.README.txt │ │ └── english_dic │ │ │ ├── center.dic │ │ │ ├── centre.dic │ │ │ ├── color.dic │ │ │ ├── colour.dic │ │ │ ├── eng_com.dic │ │ │ ├── english.txt │ │ │ ├── ise.dic │ │ │ ├── ize.dic │ │ │ ├── labeled.dic │ │ │ ├── labelled.dic │ │ │ ├── programming.dic │ │ │ ├── yse.dic │ │ │ └── yze.dic │ ├── java │ │ └── org │ │ │ └── fife │ │ │ ├── com │ │ │ └── swabunga │ │ │ │ ├── spell │ │ │ │ ├── engine │ │ │ │ │ ├── Configuration.java │ │ │ │ │ ├── DoubleMeta.java │ │ │ │ │ ├── EditDistance.java │ │ │ │ │ ├── GenericTransformator.java │ │ │ │ │ ├── PropertyConfiguration.java │ │ │ │ │ ├── SpellDictionary.java │ │ │ │ │ ├── SpellDictionaryASpell.java │ │ │ │ │ ├── SpellDictionaryCachedDichoDisk.java │ │ │ │ │ ├── SpellDictionaryDichoDisk.java │ │ │ │ │ ├── SpellDictionaryDisk.java │ │ │ │ │ ├── SpellDictionaryHashMap.java │ │ │ │ │ ├── Transformator.java │ │ │ │ │ ├── Word.java │ │ │ │ │ └── package-info.java │ │ │ │ └── event │ │ │ │ │ ├── AbstractWordFinder.java │ │ │ │ │ ├── AbstractWordTokenizer.java │ │ │ │ │ ├── BasicSpellCheckEvent.java │ │ │ │ │ ├── DefaultWordFinder.java │ │ │ │ │ ├── DocumentWordTokenizer.java │ │ │ │ │ ├── SpellCheckEvent.java │ │ │ │ │ ├── SpellCheckListener.java │ │ │ │ │ ├── SpellChecker.java │ │ │ │ │ ├── StringWordTokenizer.java │ │ │ │ │ ├── Word.java │ │ │ │ │ ├── WordFinder.java │ │ │ │ │ ├── WordNotFoundException.java │ │ │ │ │ ├── WordTokenizer.java │ │ │ │ │ ├── XMLWordFinder.java │ │ │ │ │ └── package-info.java │ │ │ │ └── util │ │ │ │ ├── ListUtil.java │ │ │ │ └── package-info.java │ │ │ └── ui │ │ │ └── rsyntaxtextarea │ │ │ └── spell │ │ │ ├── DefaultSpellCheckableTokenIdentifier.java │ │ │ ├── SpellCheckableTokenIdentifier.java │ │ │ ├── SpellingErrorAction.java │ │ │ ├── SpellingErrorTooltipHtmlGenerator.java │ │ │ ├── SpellingParser.java │ │ │ ├── SpellingParserNotice.java │ │ │ ├── event │ │ │ ├── SpellingParserEvent.java │ │ │ ├── SpellingParserListener.java │ │ │ └── package-info.java │ │ │ └── package-info.java │ └── resources │ │ └── org │ │ └── fife │ │ ├── com │ │ └── swabunga │ │ │ └── spell │ │ │ └── engine │ │ │ └── configuration.properties │ │ └── ui │ │ └── rsyntaxtextarea │ │ └── spell │ │ ├── SpellingParser.properties │ │ ├── SpellingParser_ar.properties │ │ ├── SpellingParser_de.properties │ │ ├── SpellingParser_es.properties │ │ ├── SpellingParser_fr.properties │ │ ├── SpellingParser_hu.properties │ │ ├── SpellingParser_in.properties │ │ ├── SpellingParser_it.properties │ │ ├── SpellingParser_ja.properties │ │ ├── SpellingParser_ko.properties │ │ ├── SpellingParser_nl.properties │ │ ├── SpellingParser_pl.properties │ │ ├── SpellingParser_pt_BR.properties │ │ ├── SpellingParser_ru.properties │ │ ├── SpellingParser_tr.properties │ │ ├── SpellingParser_zh_CN.properties │ │ ├── SpellingParser_zh_TW.properties │ │ ├── add.png │ │ ├── cross.png │ │ ├── lightbulb.png │ │ └── spellcheck.png │ └── test │ └── java │ └── org │ └── fife │ ├── com │ └── swabunga │ │ ├── spell │ │ ├── engine │ │ │ ├── ConfigurationTest.java │ │ │ ├── DoubleMetaTest.java │ │ │ ├── EditDistanceTest.java │ │ │ ├── GenericTransformatorTest.java │ │ │ ├── PropertyConfigurationTest.java │ │ │ ├── SpellDictionaryCachedDichoDiskTest.java │ │ │ ├── SpellDictionaryDichoDiskTest.java │ │ │ ├── SpellDictionaryDiskTest.java │ │ │ ├── SpellDictionaryHashMapTest.java │ │ │ ├── WordTest.java │ │ │ └── package-info.java │ │ └── event │ │ │ ├── AbstractWordFinderTest.java │ │ │ ├── BasicSpellCheckEventTest.java │ │ │ ├── DefaultWordFinderTest.java │ │ │ ├── DocumentWordTokenizerTest.java │ │ │ ├── SpellCheckerTest.java │ │ │ ├── StringWordTokenizerTest.java │ │ │ ├── WordNotFoundExceptionTest.java │ │ │ ├── WordTest.java │ │ │ ├── XMLWordFinderTest.java │ │ │ └── package-info.java │ │ └── util │ │ ├── ListUtilTest.java │ │ └── package-info.java │ └── ui │ └── rsyntaxtextarea │ └── spell │ ├── DefaultSpellCheckableTokenIdentifierTest.java │ ├── SpellingErrorTooltipHtmlGeneratorTest.java │ ├── SpellingParserNoticeTest.java │ ├── SpellingParserTest.java │ ├── event │ ├── SpellingParserEventTest.java │ └── package-info.java │ └── package-info.java ├── SpellCheckerDemo ├── README.md ├── build.gradle └── src │ └── main │ └── java │ └── org │ └── fife │ └── ui │ └── rsyntaxtextarea │ └── spell │ └── demo │ ├── DemoRootPane.java │ ├── SpellingParserDemo.java │ └── package-info.java ├── build.gradle ├── config └── checkstyle │ ├── checkstyle.xml │ └── scSuppressions.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.editorconfig: -------------------------------------------------------------------------------- 1 | # This is purposely sparse since the original Jazzy source has a lot of inconsistencies. 2 | [*.java] 3 | trim_trailing_whitespace = true 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Set update schedule for GitHub Actions 2 | version: 2 3 | updates: 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | # Check for updates to GitHub Actions every week 8 | interval: "weekly" 9 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ master ] 20 | schedule: 21 | - cron: '28 6 * * 4' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | 28 | strategy: 29 | fail-fast: false 30 | matrix: 31 | language: [ 'java' ] 32 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 33 | # Learn more: 34 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 35 | 36 | steps: 37 | - name: Checkout repository 38 | uses: actions/checkout@v4 39 | 40 | - name: Set up JDK 17 41 | uses: actions/setup-java@v4 42 | with: 43 | java-version: '17' 44 | distribution: 'temurin' 45 | 46 | # Initializes the CodeQL tools for scanning. 47 | - name: Initialize CodeQL 48 | uses: github/codeql-action/init@v3 49 | with: 50 | languages: ${{ matrix.language }} 51 | # If you wish to specify custom queries, you can do so here or in a config file. 52 | # By default, queries listed here will override any specified in a config file. 53 | # Prefix the list here with "+" to use these queries and those in the config file. 54 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 55 | 56 | ## Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 57 | ## If this step fails, then you should remove it and run the build manually (see below) 58 | #- name: Autobuild 59 | # uses: github/codeql-action/autobuild@v2 60 | 61 | # ℹ️ Command-line programs to run using the OS shell. 62 | # 📚 https://git.io/JvXDl 63 | 64 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 65 | # and modify them (or add more) to build your code if your project 66 | # uses a compiled language 67 | 68 | # Note: Assumes we're running on Ubuntu 69 | # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md 70 | - name: Build with Gradle 71 | run: xvfb-run ./gradlew build jacocoTestReport -xsign -xpublish --warning-mode all 72 | 73 | - name: Perform CodeQL Analysis 74 | uses: github/codeql-action/analyze@v3 75 | -------------------------------------------------------------------------------- /.github/workflows/gradle.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Gradle 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle 3 | 4 | name: Gradle Build 5 | 6 | on: 7 | push: 8 | branches: [ master ] 9 | pull_request: 10 | branches: [ master ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | strategy: 18 | matrix: 19 | java: [ '17', '21', '23' ] 20 | 21 | steps: 22 | - uses: actions/checkout@v4 23 | 24 | - name: Verify gradle wrapper 25 | uses: gradle/actions/wrapper-validation@v4 26 | if: matrix.java == '17' 27 | 28 | - name: Set up JDK ${{ matrix.java }} 29 | uses: actions/setup-java@v4 30 | with: 31 | java-version: ${{ matrix.java }} 32 | distribution: 'temurin' 33 | 34 | - name: Grant execute permission for gradlew 35 | run: chmod +x gradlew 36 | 37 | # Note: Assumes we're running on Ubuntu 38 | # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md 39 | - name: Build with Gradle 40 | run: xvfb-run ./gradlew build jacocoTestReport -xsign -xpublish --warning-mode all 41 | 42 | - name: Submit coverage data to codecov 43 | uses: codecov/codecov-action@v5 44 | if: matrix.java == '17' 45 | with: 46 | token: ${{ secrets.CODECOV_TOKEN }} 47 | disable_search: true 48 | files: ./SpellChecker/build/reports/jacoco/test/jacocoTestReport.xml 49 | name: codecov 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | english_dic.zip* 2 | rsta_spellchecker_*.zip 3 | .gradle 4 | build 5 | out/ 6 | -------------------------------------------------------------------------------- /Input.java: -------------------------------------------------------------------------------- 1 | package demo.spellchecker.pkg; 2 | 3 | /** 4 | * Tihs is a test class with severall mispelled words. The sppell checker 5 | * will only check for misspelled words in comments. 6 | * 7 | * @author Your Name 8 | * @version 1.0 9 | */ 10 | public class Input { 11 | 12 | /** 13 | * Teh value taht this class keeps track of. 14 | */ 15 | private String value; 16 | 17 | 18 | /** 19 | * This si the constructor. 20 | */ 21 | public Input() { 22 | } 23 | 24 | 25 | /** 26 | * Get the valu. 27 | * 28 | * @return The value. 29 | * @see #setValue(String) 30 | */ 31 | public String getValue() { 32 | return value; 33 | } 34 | 35 | 36 | /** 37 | * Sets the value. 38 | * 39 | * @param value The vlaue. 40 | * @see #getValue() 41 | */ 42 | public void setValue(String value) { 43 | this.value = value; 44 | } 45 | 46 | 47 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SpellChecker 2 | ![Build](https://github.com/bobbylight/SpellChecker/actions/workflows/gradle.yml/badge.svg) 3 | ![CodeQL](https://github.com/bobbylight/SpellChecker/actions/workflows/codeql-analysis.yml/badge.svg) 4 | ![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.fifesoft/spellchecker/badge.svg) 5 | [![codecov](https://codecov.io/gh/bobbylight/SpellChecker/branch/master/graph/badge.svg?token=Hktq3vfINy)](https://codecov.io/gh/bobbylight/SpellChecker) 6 | 7 | SpellChecker is a spell check add-on for `RSyntaxTextArea`. For programming languages, it spell-checks text in 8 | comments, and when editing plain text files, the entire file is spell-checked. Spelling errors are squiggle-underlined 9 | in the color of your choosing, and hovering the mouse over a misspelled word displays a tool tip with suggested fixes 10 | (if any). You can configure the library to also use a "user dictionary" file, allowing the user to add extra words to 11 | the spell check white list. 12 | 13 | This add-on is based on [Jazzy](http://jazzy.sourceforge.net), a Java spell checker. Indeed, 99% of the code is just 14 | Jazzy, with changes made for performance, bug fixes, and Java 8 syntax. 15 | 16 | This library is built with Java 17, but runs on Java 8 and later. 17 | 18 | ## Getting a dictionary file 19 | While the `SpellingParser` class can take any implementation of the `SpellDictionary` interface, 20 | typically English users will use one of the `SpellingParser.createEnglishSpellingParser()` 21 | overloads. These overloads take a zip file containing `.dic` files for either American or British 22 | English. Such a zip file is generated by this library when running `./gradlew clean build` - 23 | `src/main/dist/english_dic.zip`. This file is not source controlled, but the `.dic` files that 24 | make up its contents are, so we can easily track added words over time. 25 | 26 | ## Usage 27 | As mentioned above, building this project builds an `english_dic.zip` file that can be used 28 | for both American and British English spellchecking. Using this zip file, the easiest 29 | method to add spell checking to RSTA is as follows: 30 | 31 | ```java 32 | import org.fife.ui.rsyntaxtextarea.spell.*; 33 | // ... 34 | File zip = new File("location/of/generated/english_dic.zip"); 35 | boolean usEnglish = true; // "false" will use British English 36 | SpellingParser parser = SpellingParser.createEnglishSpellingParser(zip, usEnglish); 37 | textArea.addParser(parser); 38 | ``` 39 | 40 | See the `SpellCheckerDemo` submodule for a working example. 41 | 42 | Just like Jazzy itself, this add-on is licensed under the LGPL; see the included 43 | [LICENSE.md](https://github.com/bobbylight/SpellChecker/blob/master/LICENSE.md) file. 44 | 45 | ## Sister Projects 46 | 47 | * [RSyntaxTextArea](https://github.com/bobbylight/RSyntaxTextArea) provides syntax highlighting, code folding, and many other features out-of-the-box. 48 | * [AutoComplete](https://github.com/bobbylight/AutoComplete) - Adds code completion to RSyntaxTextArea (or any other JTextComponent). 49 | * [RSTALanguageSupport](https://github.com/bobbylight/RSTALanguageSupport) - Code completion for RSTA for the following languages: Java, JavaScript, HTML, PHP, JSP, Perl, C, Unix Shell. Built on both RSTA and AutoComplete. 50 | * [RSTAUI](https://github.com/bobbylight/RSTAUI) - Common dialogs needed by text editing applications: Find, Replace, Go to Line, File Properties. 51 | 52 | -------------------------------------------------------------------------------- /SpellChecker/README.md: -------------------------------------------------------------------------------- 1 | # SpellChecker 2 | This is the source code for the library. 3 | -------------------------------------------------------------------------------- /SpellChecker/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java-library' 3 | } 4 | 5 | ['base', 'jacoco', 'maven-publish', 'signing'].each { apply plugin: it } 6 | 7 | base { 8 | archivesName = 'spellchecker' 9 | } 10 | 11 | dependencies { 12 | api 'com.fifesoft:rsyntaxtextarea:3.5.4' 13 | testImplementation platform('org.junit:junit-bom:5.12.0') 14 | testImplementation 'org.junit.jupiter:junit-jupiter' 15 | testRuntimeOnly 'org.junit.platform:junit-platform-launcher' 16 | testImplementation 'org.mockito:mockito-core:5.15.2' 17 | } 18 | 19 | ext.isReleaseVersion = !project.version.endsWith('SNAPSHOT') 20 | 21 | jacocoTestReport { 22 | reports { 23 | xml.required = true // codecov depends on xml format report 24 | html.required = true 25 | } 26 | } 27 | 28 | java { 29 | withSourcesJar() 30 | withJavadocJar() 31 | } 32 | jar { 33 | manifest { 34 | attributes('Class-Path': 'rsyntaxtextarea.jar', 35 | 'Specification-Title': 'SpellChecker', 36 | 'Specification-Version': version, 37 | 'Implementation-Title': 'org.fife.ui', 38 | 'Implementation-Version': version) 39 | 40 | } 41 | } 42 | 43 | task createDictionaryZip(type: Zip) { 44 | archiveFileName = 'english_dic.zip' 45 | destinationDirectory = file('src/main/dist') 46 | from 'src/main/dist/english_dic' 47 | } 48 | build.dependsOn createDictionaryZip 49 | 50 | repositories { 51 | mavenCentral() 52 | } 53 | publishing { 54 | repositories { 55 | maven { 56 | def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' 57 | def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' 58 | url = isReleaseVersion ? releasesRepoUrl : snapshotsRepoUrl 59 | credentials { // Credentials usually kept in user's .gradle/gradle.properties 60 | // We must defensively check for these properties so Travis CI build works 61 | username = project.hasProperty('ossrhToken') ? ossrhToken : 'unknown' 62 | password = project.hasProperty('ossrhTokenPassword') ? ossrhTokenPassword : 'unknown' 63 | } 64 | } 65 | } 66 | publications { 67 | maven(MavenPublication) { 68 | 69 | groupId = 'com.fifesoft' 70 | artifactId = 'spellchecker' 71 | version = version 72 | 73 | from components.java 74 | 75 | pom { 76 | 77 | name = 'SpellChecker' 78 | description = 'A simple spell checker add-on for RSyntaxTextArea. It will spell-check comments in source code, or the entire file if you are editing plain text. Spelling errors are squiggle-underlined with the color of your choice, and tooltips are available offering any spelling suggestions.' 79 | url = 'https://github.com/bobbylight/SpellChecker' 80 | inceptionYear = '2003' 81 | packaging = 'jar' 82 | licenses { 83 | license { 84 | name = 'Modified BSD License' 85 | url = 'http://fifesoft.com/rsyntaxtextarea/RSyntaxTextArea.License.txt' 86 | } 87 | } 88 | developers { 89 | developer { 90 | name = 'Robert Futrell' 91 | } 92 | } 93 | scm { 94 | url = 'https://github.com/bobbylight/SpellChecker' 95 | connection = 'scm:git:git://github.com/bobbylight/SpellChecker' 96 | developerConnection = 'scm:git:git@github.com:bobbylight/SpellChecker' 97 | if (!project.version.endsWith('-SNAPSHOT')) { 98 | tag = project.version 99 | } 100 | } 101 | } 102 | } 103 | } 104 | } 105 | 106 | signing { 107 | // Don't require signing for e.g. ./gradlew install 108 | required = { gradle.taskGraph.hasTask('publish') && isReleaseVersion } 109 | sign publishing.publications.maven 110 | } 111 | tasks.withType(Sign) { 112 | onlyIf { isReleaseVersion } 113 | } 114 | -------------------------------------------------------------------------------- /SpellChecker/src/main/dist/Jazzy.CONTRIBUTORS.txt: -------------------------------------------------------------------------------- 1 | Jazzy Spell Checker could not have been possible without the involvment of the 2 | following people. 3 | 4 | Thanks! 5 | 6 | Author (Initial contributor) 7 | 8 | Mindaugas Idzelis (min123 AT gmail DOT com) 9 | 10 | Other contributors 11 | 12 | Ben Galbraith (ben AT galbraiths DOT org) 13 | Damien Guillaume 14 | Robert Gustavsson (robert AT lindesign DOT se) 15 | Jason Height (jheight AT chariot DOT net DOT au) 16 | Anthony Roy (ajr AT antroy DOT co DOT uk) 17 | Stig Tanggaard 18 | Don Vail 19 | Matthew Demerath (mdemerat AT umich DOT edu | Matthew AT Demerath DOT com) 20 | Tony Chan (htchan AT umich DOT edu) 21 | -------------------------------------------------------------------------------- /SpellChecker/src/main/dist/Jazzy.README.txt: -------------------------------------------------------------------------------- 1 | 2 | J A Z Z Y : Java Spell Checker 3 | 4 | 5 | What is it? 6 | ----------- 7 | 8 | Jazzy is a 100% pure Java library implementing a spell checking algorithm 9 | similar to aspell. It may be used to spell check a variety of sources. 10 | 11 | The Latest Version 12 | ------------------ 13 | 14 | The latest version is available from the Jazzy project web site 15 | ( http://sourceforge.net/projects/jazzy ). 16 | 17 | Requirements 18 | ------------ 19 | 20 | The following requirements exist for installing Jazzy: 21 | 22 | o Java Interpreter: 23 | 24 | A fully compliant Java 1.1 Runtime environment is needed for the core engine of Jazzy 25 | to operate. (For example: for use in a servlet) 26 | 27 | A fully compliant Java 1.3 Runtime environment is needed for the swing components of 28 | Jazzy to operate. 29 | 30 | o Java JFC (Swing components): 31 | 32 | These GUI extentions are required for proper GUI functionality. However, core 33 | spell check functionality can work without Swing Components. 34 | 35 | Installation Instructions and Documentation 36 | ------------------------------------------- 37 | 38 | There are two ways to install Jazzy. One from a pre packaged version and the other is to 39 | compile the sources from CVS. 40 | 41 | If you have downloaded the source code from CVS, please cd to the jazzy directory and run ant. 42 | 43 | 44 | Building Jazzy From the Source 45 | ------------------------------ 46 | 1) In order to build the jedit plugin, you will need to have the jedit.jar in your classpath, 47 | otherwise you will get a lot of compile errors. All of the build errors relate to the files 48 | under 49 | src/com/swabunga/spell/jedit/* 50 | The easiest way to get jedit.jar onto your machine is to install jedit. You can find it at 51 | http://sourceforge.net/projects/jedit 52 | 53 | 2) In order to build the sample applet spell checker, you will need to sign the jar with "jazzykey". 54 | In order to sign the jar, you will need a key called "jazzykey". 55 | On some systems, you should be able to run the following command to get the key built: 56 | keytool -genkey -alias jazzyKey 57 | when prompted for the password, use the same one that's in build.xml (search for "sign") 58 | For more information on creating keys, see: 59 | http://java.sun.com/docs/books/tutorial/security1.2/toolsign/step3.html 60 | 61 | 62 | 3) The ant target that builds most things is "binary-release", but you may want to build a smaller 63 | target. 64 | The current default target is "library-all", which may be sufficient if you just want the jar. 65 | 66 | 4) In order to see the applet demo, you will have to have a web server running. Point it to the 67 | www directory to see the index.html page and the applet demo.html page 68 | 69 | Licensing and legal issues 70 | -------------------------- 71 | 72 | Jazzy is licensed under the LGPL. See LICENSE.txt for license restrictions. 73 | 74 | -------------------------------------------------------------------------------- /SpellChecker/src/main/dist/english_dic/center.dic: -------------------------------------------------------------------------------- 1 | liter 2 | meter 3 | center 4 | goiter 5 | liters 6 | luster 7 | meters 8 | centers 9 | diopter 10 | goiters 11 | philter 12 | scepter 13 | specter 14 | theater 15 | accouter 16 | cadaster 17 | centered 18 | diopters 19 | encaster 20 | goitered 21 | philters 22 | scepters 23 | specters 24 | theaters 25 | accouters 26 | cadasters 27 | centering 28 | concenter 29 | daycenter 30 | decaliter 31 | decameter 32 | deciliter 33 | decimeter 34 | dekaliter 35 | dekameter 36 | encasters 37 | epicenter 38 | jobcenter 39 | kiloliter 40 | kilometer 41 | nanometer 42 | saltpeter 43 | barycenter 44 | centiliter 45 | centimeter 46 | concenters 47 | daycenters 48 | decaliters 49 | decameters 50 | deciliters 51 | decimeters 52 | dekaliters 53 | dekameters 54 | epicenters 55 | hectoliter 56 | hectometer 57 | hypocenter 58 | jobcenters 59 | kiloliters 60 | kilometers 61 | lackluster 62 | mesocenter 63 | microliter 64 | micrometer 65 | milliliter 66 | millimeter 67 | nanometers 68 | saltpeters 69 | barycenters 70 | centiliters 71 | centimeters 72 | hectoliters 73 | hectometers 74 | hypocenters 75 | lacklusters 76 | mesocenters 77 | micrometers 78 | milliliters 79 | millimeters 80 | orthocenter 81 | reconnoiter 82 | amphitheater 83 | orthocenters 84 | reconnoiters 85 | amphitheaters 86 | -------------------------------------------------------------------------------- /SpellChecker/src/main/dist/english_dic/centre.dic: -------------------------------------------------------------------------------- 1 | litre 2 | metre 3 | centre 4 | goitre 5 | litres 6 | lustre 7 | metres 8 | centred 9 | centres 10 | dioptre 11 | goitred 12 | goitres 13 | philtre 14 | sceptre 15 | spectre 16 | theatre 17 | accoutre 18 | cadastre 19 | centring 20 | dioptres 21 | encastre 22 | philtres 23 | sceptres 24 | spectres 25 | theatres 26 | accoutres 27 | cadastres 28 | concentre 29 | daycentre 30 | decalitre 31 | decametre 32 | decilitre 33 | decimetre 34 | dekalitre 35 | dekametre 36 | encastres 37 | epicentre 38 | jobcentre 39 | kilolitre 40 | kilometre 41 | nanometre 42 | saltpetre 43 | barycentre 44 | centilitre 45 | centimetre 46 | concentres 47 | daycentres 48 | decalitres 49 | decametres 50 | decilitres 51 | decimetres 52 | dekalitres 53 | dekametres 54 | epicentres 55 | hectolitre 56 | hectometre 57 | hypocentre 58 | jobcentres 59 | kilolitres 60 | kilometres 61 | lacklustre 62 | mesocentre 63 | microlitre 64 | micrometre 65 | millilitre 66 | millimetre 67 | nanometres 68 | saltpetres 69 | barycentres 70 | centilitres 71 | centimetres 72 | hectolitres 73 | hectometres 74 | hypocentres 75 | lacklustres 76 | mesocentres 77 | micrometres 78 | millilitres 79 | millimetres 80 | orthocentre 81 | reconnoitre 82 | amphitheatre 83 | orthocentres 84 | reconnoitres 85 | amphitheatres 86 | -------------------------------------------------------------------------------- /SpellChecker/src/main/dist/english_dic/color.dic: -------------------------------------------------------------------------------- 1 | amor 2 | odor 3 | amors 4 | arbor 5 | ardor 6 | armor 7 | calor 8 | color 9 | detor 10 | devor 11 | dolor 12 | favor 13 | honor 14 | humor 15 | labor 16 | odors 17 | rigor 18 | rumor 19 | savor 20 | tumor 21 | valor 22 | vapor 23 | vigor 24 | arbors 25 | ardors 26 | armors 27 | armory 28 | candor 29 | clamor 30 | colors 31 | colory 32 | detors 33 | devors 34 | dolors 35 | enamor 36 | favors 37 | fervor 38 | flavor 39 | glamor 40 | harbor 41 | honors 42 | humors 43 | labors 44 | odored 45 | pavior 46 | rancor 47 | rigors 48 | rumors 49 | savior 50 | savors 51 | savory 52 | stupor 53 | succor 54 | tambor 55 | tumors 56 | vapors 57 | vapory 58 | armored 59 | armorer 60 | belabor 61 | clamors 62 | clangor 63 | colored 64 | colorer 65 | decolor 66 | detored 67 | devored 68 | devorer 69 | enamors 70 | encolor 71 | favored 72 | favorer 73 | fervors 74 | flamory 75 | flavors 76 | glamors 77 | harbors 78 | honored 79 | honoree 80 | honorer 81 | humored 82 | humorer 83 | labored 84 | laborer 85 | odorant 86 | odorful 87 | paramor 88 | paviors 89 | recolor 90 | rumored 91 | rumorer 92 | saviors 93 | savored 94 | savorer 95 | stupors 96 | succors 97 | tumoral 98 | unarmor 99 | uncolor 100 | unfavor 101 | unhonor 102 | unlabor 103 | vaporer 104 | armorers 105 | armories 106 | armoring 107 | behavior 108 | belabors 109 | clamored 110 | clamorer 111 | clangors 112 | colorant 113 | coloreds 114 | colorers 115 | colorful 116 | coloring 117 | colorist 118 | colorman 119 | colormen 120 | colorway 121 | decolors 122 | demeanor 123 | detoring 124 | devorers 125 | devoring 126 | discolor 127 | disfavor 128 | dishonor 129 | dishumor 130 | dolorous 131 | enamored 132 | encolors 133 | endeavor 134 | favorers 135 | favoring 136 | favorite 137 | flavored 138 | flavorer 139 | glamored 140 | harbored 141 | harborer 142 | honorees 143 | honorers 144 | honoring 145 | humorers 146 | humorful 147 | humoring 148 | laborers 149 | laboring 150 | laborism 151 | laborist 152 | laborite 153 | neighbor 154 | odorless 155 | paramors 156 | pompador 157 | prolabor 158 | rancored 159 | recolors 160 | rigorous 161 | rumorers 162 | rumoring 163 | savorers 164 | savorier 165 | savories 166 | savorily 167 | savoring 168 | splendor 169 | succored 170 | succorer 171 | tricolor 172 | tumorous 173 | unflavor 174 | unharbor 175 | unicolor 176 | unsavory 177 | vaporing 178 | vaporish 179 | vigorish 180 | amorously 181 | antilabor 182 | antitumor 183 | armorless 184 | behaviors 185 | belabored 186 | clamorers 187 | clamoring 188 | clangored 189 | colorable 190 | colorably 191 | colorants 192 | colorcast 193 | colorfast 194 | colorings 195 | colorists 196 | colorless 197 | colorwash 198 | colorways 199 | decolored 200 | demeanors 201 | discolors 202 | disfavors 203 | dishonors 204 | dishumors 205 | enamoring 206 | encolored 207 | endeavors 208 | favorable 209 | favorably 210 | favorites 211 | favorless 212 | flavorers 213 | flavorful 214 | flavoring 215 | glamoring 216 | harborage 217 | harborers 218 | harboring 219 | honorable 220 | honorably 221 | honorless 222 | humorists 223 | humorless 224 | humorsome 225 | laboredly 226 | laborings 227 | laborists 228 | laborites 229 | neighbors 230 | pompadors 231 | rancorous 232 | recolored 233 | savoriest 234 | savorless 235 | splendors 236 | stuporous 237 | succorant 238 | succorers 239 | succoring 240 | tamborine 241 | tricolors 242 | unarmored 243 | uncolored 244 | unfavored 245 | unharbors 246 | unhonored 247 | unlabored 248 | vaporable 249 | vaporless 250 | varicolor 251 | vigorless 252 | antitumors 253 | behavioral 254 | belaboring 255 | clangoring 256 | colorblind 257 | colorcasts 258 | colorfully 259 | coloristic 260 | colorpoint 261 | decoloring 262 | devoringly 263 | discolored 264 | disfavored 265 | disfavorer 266 | dishonored 267 | dishonorer 268 | dishumored 269 | encoloring 270 | endeavored 271 | endeavorer 272 | favoringly 273 | favoritism 274 | flavorings 275 | flavorless 276 | flavorsome 277 | harborages 278 | harborless 279 | honorables 280 | laboringly 281 | laborsaver 282 | neighbored 283 | neighborly 284 | neurohumor 285 | odorimetry 286 | odoriphore 287 | recoloring 288 | savoriness 289 | succorable 290 | succorance 291 | succorless 292 | tamborines 293 | tricolored 294 | unflavored 295 | unharbored 296 | unsavorily 297 | versicolor 298 | watercolor 299 | antitumoral 300 | behaviorial 301 | behaviorism 302 | behaviorist 303 | behaviorsim 304 | colorlessly 305 | colorpoints 306 | colorwashed 307 | colorwashes 308 | detornement 309 | discoloring 310 | disfavoring 311 | dishonorers 312 | dishonoring 313 | endeavorers 314 | endeavoring 315 | favoritisms 316 | flavorfully 317 | humorlessly 318 | laboredness 319 | laboriously 320 | laborsavers 321 | laborsaving 322 | malbehavior 323 | misbehavior 324 | misdemeanor 325 | neighboring 326 | odoriferous 327 | rumormonger 328 | technicolor 329 | unfavorable 330 | unfavorably 331 | varicolored 332 | watercolors 333 | behaviorally 334 | behaviorists 335 | colorability 336 | colorcasting 337 | colorfulness 338 | colorwashing 339 | dishonorable 340 | dishonorably 341 | humorousness 342 | misdemeanors 343 | multicolored 344 | neighborhood 345 | neighborless 346 | neurohumoral 347 | odorimetries 348 | particolored 349 | unneighborly 350 | unsavoriness 351 | vaporability 352 | versicolored 353 | behavioristic 354 | colorableness 355 | colorfastness 356 | colorlessness 357 | favorableness 358 | honorableness 359 | humorlessness 360 | neighborhoods 361 | odoriferously 362 | technicolored 363 | neighborliness 364 | odoriferousness 365 | unfavorableness 366 | dishonorableness 367 | -------------------------------------------------------------------------------- /SpellChecker/src/main/dist/english_dic/colour.dic: -------------------------------------------------------------------------------- 1 | amour 2 | odour 3 | amours 4 | arbour 5 | ardour 6 | armour 7 | calour 8 | colour 9 | detour 10 | devour 11 | dolour 12 | favour 13 | honour 14 | humour 15 | labour 16 | odours 17 | rigour 18 | rumour 19 | savour 20 | tumour 21 | valour 22 | vapour 23 | vigour 24 | arbours 25 | ardours 26 | armours 27 | armoury 28 | candour 29 | clamour 30 | colours 31 | coloury 32 | detours 33 | devours 34 | dolours 35 | enamour 36 | favours 37 | fervour 38 | flavour 39 | glamour 40 | harbour 41 | honours 42 | humours 43 | labours 44 | odoured 45 | paviour 46 | rancour 47 | rigours 48 | rumours 49 | saviour 50 | savours 51 | savoury 52 | stupour 53 | succour 54 | tambour 55 | tumours 56 | vapours 57 | vapoury 58 | armoured 59 | armourer 60 | belabour 61 | clamours 62 | clangour 63 | coloured 64 | colourer 65 | decolour 66 | detoured 67 | devoured 68 | devourer 69 | enamours 70 | encolour 71 | favoured 72 | favourer 73 | fervours 74 | flamoury 75 | flavours 76 | glamours 77 | harbours 78 | honoured 79 | honouree 80 | honourer 81 | humoured 82 | humourer 83 | laboured 84 | labourer 85 | odourant 86 | odourful 87 | paramour 88 | paviours 89 | recolour 90 | rumoured 91 | rumourer 92 | saviours 93 | savoured 94 | savourer 95 | stupours 96 | succours 97 | tumoural 98 | unarmour 99 | uncolour 100 | unfavour 101 | unhonour 102 | unlabour 103 | vapourer 104 | armourers 105 | armouries 106 | armouring 107 | behaviour 108 | belabours 109 | clamoured 110 | clamourer 111 | clangours 112 | colourant 113 | coloureds 114 | colourers 115 | colourful 116 | colouring 117 | colourist 118 | colourman 119 | colourmen 120 | colourway 121 | decolours 122 | demeanour 123 | detouring 124 | devourers 125 | devouring 126 | discolour 127 | disfavour 128 | dishonour 129 | dishumour 130 | dolourous 131 | enamoured 132 | encolours 133 | endeavour 134 | favourers 135 | favouring 136 | favourite 137 | flavoured 138 | flavourer 139 | glamoured 140 | harboured 141 | harbourer 142 | honourees 143 | honourers 144 | honouring 145 | humourers 146 | humourful 147 | humouring 148 | labourers 149 | labouring 150 | labourism 151 | labourist 152 | labourite 153 | neighbour 154 | odourless 155 | paramours 156 | pompadour 157 | prolabour 158 | rancoured 159 | recolours 160 | rigourous 161 | rumourers 162 | rumouring 163 | savourers 164 | savourier 165 | savouries 166 | savourily 167 | savouring 168 | splendour 169 | succoured 170 | succourer 171 | tricolour 172 | tumourous 173 | unflavour 174 | unharbour 175 | unicolour 176 | unsavoury 177 | vapouring 178 | vapourish 179 | vigourish 180 | amourously 181 | antilabour 182 | antitumour 183 | armourless 184 | behaviours 185 | belaboured 186 | clamourers 187 | clamouring 188 | clangoured 189 | colourable 190 | colourably 191 | colourants 192 | colourcast 193 | colourfast 194 | colourings 195 | colourists 196 | colourless 197 | colourwash 198 | colourways 199 | decoloured 200 | demeanours 201 | discolours 202 | disfavours 203 | dishonours 204 | dishumours 205 | enamouring 206 | encoloured 207 | endeavours 208 | favourable 209 | favourably 210 | favourites 211 | favourless 212 | flavourers 213 | flavourful 214 | flavouring 215 | glamouring 216 | harbourage 217 | harbourers 218 | harbouring 219 | honourable 220 | honourably 221 | honourless 222 | humourists 223 | humourless 224 | humoursome 225 | labouredly 226 | labourings 227 | labourists 228 | labourites 229 | neighbours 230 | pompadours 231 | rancourous 232 | recoloured 233 | savouriest 234 | savourless 235 | splendours 236 | stupourous 237 | succourant 238 | succourers 239 | succouring 240 | tambourine 241 | tricolours 242 | unarmoured 243 | uncoloured 244 | unfavoured 245 | unharbours 246 | unhonoured 247 | unlaboured 248 | vapourable 249 | vapourless 250 | varicolour 251 | vigourless 252 | antitumours 253 | behavioural 254 | belabouring 255 | clangouring 256 | colourblind 257 | colourcasts 258 | colourfully 259 | colouristic 260 | colourpoint 261 | decolouring 262 | devouringly 263 | discoloured 264 | disfavoured 265 | disfavourer 266 | dishonoured 267 | dishonourer 268 | dishumoured 269 | encolouring 270 | endeavoured 271 | endeavourer 272 | favouringly 273 | favouritism 274 | flavourings 275 | flavourless 276 | flavoursome 277 | harbourages 278 | harbourless 279 | honourables 280 | labouringly 281 | laboursaver 282 | neighboured 283 | neighbourly 284 | neurohumour 285 | odourimetry 286 | odouriphore 287 | recolouring 288 | savouriness 289 | succourable 290 | succourance 291 | succourless 292 | tambourines 293 | tricoloured 294 | unflavoured 295 | unharboured 296 | unsavourily 297 | versicolour 298 | watercolour 299 | antitumoural 300 | behaviourial 301 | behaviourism 302 | behaviourist 303 | behavioursim 304 | colourlessly 305 | colourpoints 306 | colourwashed 307 | colourwashes 308 | detournement 309 | discolouring 310 | disfavouring 311 | dishonourers 312 | dishonouring 313 | endeavourers 314 | endeavouring 315 | favouritisms 316 | flavourfully 317 | humourlessly 318 | labouredness 319 | labouriously 320 | laboursavers 321 | laboursaving 322 | malbehaviour 323 | misbehaviour 324 | misdemeanour 325 | neighbouring 326 | odouriferous 327 | rumourmonger 328 | technicolour 329 | unfavourable 330 | unfavourably 331 | varicoloured 332 | watercolours 333 | behaviourally 334 | behaviourists 335 | colourability 336 | colourcasting 337 | colourfulness 338 | colourwashing 339 | dishonourable 340 | dishonourably 341 | humourousness 342 | misdemeanours 343 | multicoloured 344 | neighbourhood 345 | neighbourless 346 | neurohumoural 347 | odourimetries 348 | particoloured 349 | unneighbourly 350 | unsavouriness 351 | vapourability 352 | versicoloured 353 | behaviouristic 354 | colourableness 355 | colourfastness 356 | colourlessness 357 | favourableness 358 | honourableness 359 | humourlessness 360 | neighbourhoods 361 | odouriferously 362 | technicoloured 363 | neighbourliness 364 | odouriferousness 365 | unfavourableness 366 | dishonourableness 367 | -------------------------------------------------------------------------------- /SpellChecker/src/main/dist/english_dic/english.txt: -------------------------------------------------------------------------------- 1 | A SET OF DICTIONARIES FOR AMERICAN AND BRITISH ENGLISH 2 | 3 | The dictionary files that accompany this file were adapted from the WinEdt 4 | English_US and English_UK dictionaries by Patrick Daly. The original two dictionaries 5 | were compiled by Aleksander Simonic (author of WinEdt) from public domain dictionaries 6 | packaged with the amSpell spellchecker (by Erik Frambach. e-mail: e.h.m.frambach@eco.rug.nl). 7 | 8 | The dictionaries are included with Jazzy with permission from Patrick and Aleksander. 9 | 10 | The following is the instructions and motivation for using the dictionaries as enclosed with 11 | the dictionaries by Patrick Daly. 12 | 13 | -- 14 | Anthony Roy (email: home@antroy.co.uk) 15 | 16 | 17 | 18 | What is American and what is British spelling anyway? 19 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 20 | 21 | There are five categories of words in English with spelling variants; the 22 | differences are often referred to as US or UK, but as the table below 23 | illustrates, this is not so clear cut. 24 | 25 | I designate the five categories with a representative word from each: 26 | color/colour 27 | labeled/labelled 28 | center/centre 29 | maximize/maximise 30 | analyze/analyse 31 | In each case, I give what is normally considered American first, then 32 | the form normally considered British. However, checking with the 33 | Webster's and Oxford dictionaries, one finds that the following are 34 | permitted (the preferred form is given first): 35 | 36 | Webster (US) Oxford (UK) 37 | color colour 38 | labeled/labelled labelled 39 | center centre/center 40 | maximize maximize/maximise 41 | analyze analyse 42 | 43 | This shows that we could agree on labelled, center, maximize, and only 44 | need to quarrel about color/colour and analyze/analyse. (This is my own personal style, 45 | where I settle for "colour" and "analyse".) 46 | 47 | (Consider the origin of this word. The Latin is "color, coloris", so that 48 | "color" is indeed the true original word. The English "colour" comes from the 49 | French "couleur". The same applies to "honour/honor". More interesting is 50 | "neighbour/neighbor" which is not a Latin root at all, but a Germanic one. It 51 | is related to the German "Nachbar" (literally "the one beside" but which 52 | translates exactly as "neighbour". So why is the "u" there at all? English is 53 | weird!) 54 | 55 | More flexibility is needed in the spell checker than that provided by 56 | only two dictionary files. 57 | 58 | My solution: 11 files 59 | ~~~~~~~~~~~~~~~~~~~~ 60 | 61 | I have taken UK.dic and US.dic, merged them, extracted the words in the 62 | four categories, placing them 8 additional dictionary files. 63 | eng_com.dic (150843 words with no alternative spellings) 64 | colour.dic and color.dic (366 words with -our/-or variant) 65 | labelled.dic and labeled.dic (326 words with -ell-/-el- variant) 66 | centre.dic and center.dic (85 words with -re/-er variant) 67 | ize.dic and ise.dic (3387 words with -ize/-ise variant) 68 | yze.dic and yse.dic (87 words with -yze/-yse variant) 69 | 70 | Six of these files must be loaded each time: eng_com.dic and one of 71 | each pair. One uses the WinEdt dictionary manager to activate as one 72 | pleases. Alternatively, one could use them to make up one big 73 | dictionary of the combination that one desires. I do provide ready-to-run 74 | installations, see below. 75 | 76 | There are 32 possible combinations, but I only see 4 realistic ones: 77 | strict American: color, labeled, center, ize, yze 78 | liberal American: color, labelled, center, ize, yze 79 | liberal British: colour, labelled, center, ize, yse 80 | strict British: colour, labelled, centre, ise, yse 81 | 82 | 83 | Patrick W Daly 84 | Max-Planck Institut fuer Aeronomie 85 | 37191 Katlenburg-Lindau 86 | Germany 87 | daly@linmpi.mpg.de 88 | 89 | 2000 March 3 90 | -------------------------------------------------------------------------------- /SpellChecker/src/main/dist/english_dic/labeled.dic: -------------------------------------------------------------------------------- 1 | dueled 2 | dueler 3 | fueled 4 | fueler 5 | beveled 6 | beveler 7 | cupeled 8 | cupeler 9 | develed 10 | doweled 11 | duelers 12 | dueling 13 | duelist 14 | fuelers 15 | fueling 16 | gaveled 17 | gaveler 18 | grueled 19 | grueler 20 | hoveled 21 | hoveler 22 | jeweled 23 | jeweler 24 | labeled 25 | labeler 26 | lapeled 27 | leveled 28 | leveler 29 | libeled 30 | libelee 31 | libeler 32 | modeled 33 | paneled 34 | raveled 35 | raveler 36 | rebeled 37 | reveled 38 | reveler 39 | roweled 40 | toweled 41 | voweled 42 | yodeled 43 | yodeler 44 | barreled 45 | bevelers 46 | beveling 47 | boweling 48 | busheled 49 | busheler 50 | cageling 51 | canceled 52 | canceler 53 | chiseled 54 | chiseler 55 | corbeled 56 | creneled 57 | cudgeled 58 | cudgeler 59 | cupelers 60 | cupeling 61 | develing 62 | doweling 63 | driveled 64 | driveler 65 | duelings 66 | duelists 67 | enameled 68 | enameler 69 | ferreled 70 | funneled 71 | gaveling 72 | graveled 73 | groveled 74 | groveler 75 | gruelers 76 | grueling 77 | hanseled 78 | houseled 79 | hovelers 80 | hoveling 81 | jewelers 82 | jewelery 83 | jeweling 84 | kenneled 85 | kerneled 86 | labelers 87 | labeling 88 | labeloid 89 | laureled 90 | levelers 91 | levelest 92 | leveling 93 | libelant 94 | libelees 95 | libelers 96 | libeling 97 | libelous 98 | marceled 99 | marceler 100 | marveled 101 | medeling 102 | modeling 103 | nickeled 104 | paneling 105 | panelist 106 | parceled 107 | pommeled 108 | pummeled 109 | rappeled 110 | ravelers 111 | raveling 112 | rebeling 113 | rebelion 114 | refueled 115 | refueler 116 | revelent 117 | revelers 118 | reveling 119 | roweling 120 | shoveled 121 | shoveler 122 | sideling 123 | sniveled 124 | sniveler 125 | swiveled 126 | tasseled 127 | teaseled 128 | teaseler 129 | teazeled 130 | tinseled 131 | toweling 132 | traveled 133 | traveler 134 | troweled 135 | troweler 136 | tunneled 137 | tunneler 138 | weaseled 139 | yodelers 140 | yodeling 141 | appareled 142 | barreling 143 | bejeweled 144 | belibeled 145 | bevelings 146 | bushelers 147 | busheling 148 | cancelers 149 | canceling 150 | cancelous 151 | chandeled 152 | channeled 153 | channeler 154 | chiselers 155 | chiseling 156 | corbeling 157 | counseled 158 | counselor 159 | crenelate 160 | creneling 161 | cudgelers 162 | cudgeling 163 | drivelers 164 | driveling 165 | emboweled 166 | empaneled 167 | enamelers 168 | enameling 169 | enamelist 170 | ferreling 171 | flanneled 172 | funneling 173 | graveling 174 | grovelers 175 | groveling 176 | gruelings 177 | handseled 178 | hanseling 179 | hatcheled 180 | hatcheler 181 | hosteling 182 | houseling 183 | impaneled 184 | kenneling 185 | kerneling 186 | laureling 187 | libelants 188 | marceling 189 | marveling 190 | marvelous 191 | nickeling 192 | panelings 193 | panelists 194 | parceling 195 | pommeling 196 | pummeling 197 | quarreled 198 | quarreler 199 | rappeling 200 | ravelings 201 | refuelers 202 | refueling 203 | relabeled 204 | remodeled 205 | remodeler 206 | revelings 207 | satcheled 208 | shovelers 209 | shoveling 210 | shriveled 211 | snivelers 212 | sniveling 213 | snorkeled 214 | spanceled 215 | swiveling 216 | tasseling 217 | teaselers 218 | teaseling 219 | teazeling 220 | tinselier 221 | tinseling 222 | towelings 223 | trammeled 224 | trammeler 225 | travelers 226 | traveling 227 | trowelers 228 | troweling 229 | tunnelers 230 | tunneling 231 | unlabeled 232 | unleveled 233 | unraveled 234 | unraveler 235 | weaseling 236 | appareling 237 | becudgeled 238 | bejeweling 239 | belibeling 240 | bushelings 241 | cancelable 242 | chandeling 243 | channelers 244 | channeling 245 | chiselings 246 | corbelings 247 | counseling 248 | counselors 249 | crenelated 250 | crenelates 251 | cudgelings 252 | cupelation 253 | disboweled 254 | disheveled 255 | emboweling 256 | empaneling 257 | enamelings 258 | enamelists 259 | ensorceled 260 | flanneling 261 | gruelingly 262 | handseling 263 | hatchelers 264 | hatcheling 265 | houselings 266 | impaneling 267 | jeweleries 268 | libelously 269 | mislabeled 270 | quarrelers 271 | quarreling 272 | relabeling 273 | remodelers 274 | remodeling 275 | sentineled 276 | shriveling 277 | snorkeling 278 | spanceling 279 | squirreled 280 | tinseliest 281 | trammelers 282 | trammeling 283 | travelable 284 | travelings 285 | tunnelings 286 | uncanceled 287 | unkenneled 288 | unleveling 289 | unravelers 290 | unraveling 291 | untraveled 292 | becudgeling 293 | cancelation 294 | counselable 295 | counselings 296 | crenelating 297 | crenelation 298 | disboweling 299 | disheveling 300 | entrameling 301 | entrammeled 302 | grovelingly 303 | marvelously 304 | mislabeling 305 | nonlibelous 306 | precanceled 307 | rebeliously 308 | remodelings 309 | sentineling 310 | squirreling 311 | unkenneling 312 | untrammeled 313 | cancelations 314 | crenelations 315 | disemboweled 316 | entrammeling 317 | precanceling 318 | counselorship 319 | disemboweling 320 | marvelousness 321 | noncancelable 322 | rebeliousness 323 | semirebelious 324 | counselorships 325 | noncancelation 326 | precancelation 327 | -------------------------------------------------------------------------------- /SpellChecker/src/main/dist/english_dic/labelled.dic: -------------------------------------------------------------------------------- 1 | duelled 2 | dueller 3 | fuelled 4 | fueller 5 | bevelled 6 | beveller 7 | cupelled 8 | cupeller 9 | develled 10 | dowelled 11 | duellers 12 | duelling 13 | duellist 14 | fuellers 15 | fuelling 16 | gavelled 17 | gaveller 18 | gruelled 19 | grueller 20 | hovelled 21 | hoveller 22 | jewelled 23 | jeweller 24 | labelled 25 | labeller 26 | lapelled 27 | levelled 28 | leveller 29 | libelled 30 | libellee 31 | libeller 32 | modelled 33 | panelled 34 | ravelled 35 | raveller 36 | rebelled 37 | revelled 38 | reveller 39 | rowelled 40 | towelled 41 | vowelled 42 | yodelled 43 | yodeller 44 | barrelled 45 | bevellers 46 | bevelling 47 | bowelling 48 | bushelled 49 | busheller 50 | cagelling 51 | cancelled 52 | canceller 53 | chiselled 54 | chiseller 55 | corbelled 56 | crenelled 57 | cudgelled 58 | cudgeller 59 | cupellers 60 | cupelling 61 | develling 62 | dowelling 63 | drivelled 64 | driveller 65 | duellings 66 | duellists 67 | enamelled 68 | enameller 69 | ferrelled 70 | funnelled 71 | gavelling 72 | gravelled 73 | grovelled 74 | groveller 75 | gruellers 76 | gruelling 77 | hanselled 78 | houselled 79 | hovellers 80 | hovelling 81 | jewellers 82 | jewellery 83 | jewelling 84 | kennelled 85 | kernelled 86 | labellers 87 | labelling 88 | labelloid 89 | laurelled 90 | levellers 91 | levellest 92 | levelling 93 | libellant 94 | libellees 95 | libellers 96 | libelling 97 | libellous 98 | marcelled 99 | marceller 100 | marvelled 101 | medelling 102 | modelling 103 | nickelled 104 | panelling 105 | panellist 106 | parcelled 107 | pommelled 108 | pummelled 109 | rappelled 110 | ravellers 111 | ravelling 112 | rebelling 113 | rebellion 114 | refuelled 115 | refueller 116 | revellent 117 | revellers 118 | revelling 119 | rowelling 120 | shovelled 121 | shoveller 122 | sidelling 123 | snivelled 124 | sniveller 125 | swivelled 126 | tasselled 127 | teaselled 128 | teaseller 129 | teazelled 130 | tinselled 131 | towelling 132 | travelled 133 | traveller 134 | trowelled 135 | troweller 136 | tunnelled 137 | tunneller 138 | weaselled 139 | yodellers 140 | yodelling 141 | apparelled 142 | barrelling 143 | bejewelled 144 | belibelled 145 | bevellings 146 | bushellers 147 | bushelling 148 | cancellers 149 | cancelling 150 | cancellous 151 | chandelled 152 | channelled 153 | channeller 154 | chisellers 155 | chiselling 156 | corbelling 157 | counselled 158 | counsellor 159 | crenellate 160 | crenelling 161 | cudgellers 162 | cudgelling 163 | drivellers 164 | drivelling 165 | embowelled 166 | empanelled 167 | enamellers 168 | enamelling 169 | enamellist 170 | ferrelling 171 | flannelled 172 | funnelling 173 | gravelling 174 | grovellers 175 | grovelling 176 | gruellings 177 | handselled 178 | hanselling 179 | hatchelled 180 | hatcheller 181 | hostelling 182 | houselling 183 | impanelled 184 | kennelling 185 | kernelling 186 | laurelling 187 | libellants 188 | marcelling 189 | marvelling 190 | marvellous 191 | nickelling 192 | panellings 193 | panellists 194 | parcelling 195 | pommelling 196 | pummelling 197 | quarrelled 198 | quarreller 199 | rappelling 200 | ravellings 201 | refuellers 202 | refuelling 203 | relabelled 204 | remodelled 205 | remodeller 206 | revellings 207 | satchelled 208 | shovellers 209 | shovelling 210 | shrivelled 211 | snivellers 212 | snivelling 213 | snorkelled 214 | spancelled 215 | swivelling 216 | tasselling 217 | teasellers 218 | teaselling 219 | teazelling 220 | tinsellier 221 | tinselling 222 | towellings 223 | trammelled 224 | trammeller 225 | travellers 226 | travelling 227 | trowellers 228 | trowelling 229 | tunnellers 230 | tunnelling 231 | unlabelled 232 | unlevelled 233 | unravelled 234 | unraveller 235 | weaselling 236 | apparelling 237 | becudgelled 238 | bejewelling 239 | belibelling 240 | bushellings 241 | cancellable 242 | chandelling 243 | channellers 244 | channelling 245 | chisellings 246 | corbellings 247 | counselling 248 | counsellors 249 | crenellated 250 | crenellates 251 | cudgellings 252 | cupellation 253 | disbowelled 254 | dishevelled 255 | embowelling 256 | empanelling 257 | enamellings 258 | enamellists 259 | ensorcelled 260 | flannelling 261 | gruellingly 262 | handselling 263 | hatchellers 264 | hatchelling 265 | housellings 266 | impanelling 267 | jewelleries 268 | libellously 269 | mislabelled 270 | quarrellers 271 | quarrelling 272 | relabelling 273 | remodellers 274 | remodelling 275 | sentinelled 276 | shrivelling 277 | snorkelling 278 | spancelling 279 | squirrelled 280 | tinselliest 281 | trammellers 282 | trammelling 283 | travellable 284 | travellings 285 | tunnellings 286 | uncancelled 287 | unkennelled 288 | unlevelling 289 | unravellers 290 | unravelling 291 | untravelled 292 | becudgelling 293 | cancellation 294 | counsellable 295 | counsellings 296 | crenellating 297 | crenellation 298 | disbowelling 299 | dishevelling 300 | entramelling 301 | entrammelled 302 | grovellingly 303 | marvellously 304 | mislabelling 305 | nonlibellous 306 | precancelled 307 | rebelliously 308 | remodellings 309 | sentinelling 310 | squirrelling 311 | unkennelling 312 | untrammelled 313 | cancellations 314 | crenellations 315 | disembowelled 316 | entrammelling 317 | precancelling 318 | counsellorship 319 | disembowelling 320 | marvellousness 321 | noncancellable 322 | rebelliousness 323 | semirebellious 324 | counsellorships 325 | noncancellation 326 | precancellation 327 | -------------------------------------------------------------------------------- /SpellChecker/src/main/dist/english_dic/programming.dic: -------------------------------------------------------------------------------- 1 | ANSI 2 | API 3 | API's 4 | applet 5 | applet's 6 | applets 7 | arg 8 | args 9 | backend 10 | com 11 | config 12 | configs 13 | css 14 | csv 15 | ctrl 16 | def 17 | dir 18 | doc 19 | endpoint 20 | endpoints 21 | foo 22 | frontend 23 | git 24 | github 25 | gradle 26 | guid 27 | hotfix 28 | hotfixes 29 | href 30 | html 31 | int 32 | javadoc 33 | li 34 | localhost 35 | microservice 36 | microservices 37 | min 38 | ol 39 | plugin 40 | plugins 41 | printf 42 | println 43 | refactor 44 | refactored 45 | refactoring 46 | refactors 47 | regex 48 | regexes 49 | sonatype 50 | td 51 | todo 52 | toolbar 53 | tr 54 | txt 55 | ul 56 | upsert 57 | upserts 58 | uuid 59 | xml 60 | -------------------------------------------------------------------------------- /SpellChecker/src/main/dist/english_dic/yse.dic: -------------------------------------------------------------------------------- 1 | analyse 2 | dialyse 3 | analysed 4 | analyser 5 | analyses 6 | autolyse 7 | catalyse 8 | dialysed 9 | dialyser 10 | dialyses 11 | hemolyse 12 | paralyse 13 | analysers 14 | analysing 15 | autolysed 16 | autolyses 17 | catalysed 18 | catalyser 19 | catalyses 20 | dialysate 21 | dialysers 22 | dialysing 23 | hemolysed 24 | hemolyses 25 | hydrolyse 26 | paralysed 27 | paralyser 28 | paralyses 29 | photolyse 30 | pyrolysed 31 | pyrolyser 32 | pyrolyses 33 | reanalyse 34 | analysable 35 | autolysing 36 | catalysers 37 | catalysing 38 | dialysable 39 | hemolysing 40 | hydrolysed 41 | hydrolyser 42 | hydrolyses 43 | paralysant 44 | paralysers 45 | paralysing 46 | photolysed 47 | photolyses 48 | plasmolyse 49 | pyrolysing 50 | reanalysed 51 | reanalyses 52 | breathalyse 53 | electrolyse 54 | hydrolysate 55 | hydrolysing 56 | overanalyse 57 | photolysing 58 | plasmolysed 59 | plasmolyses 60 | reanalysing 61 | breathalysed 62 | breathalyser 63 | breathalyses 64 | electrolysed 65 | electrolyser 66 | electrolyses 67 | hydrolysable 68 | overanalysed 69 | overanalyses 70 | paralysation 71 | paralysingly 72 | plasmolysing 73 | unanalysable 74 | breathalysers 75 | breathalysing 76 | electrolysers 77 | electrolysing 78 | overanalysing 79 | plasmolysable 80 | psychoanalyse 81 | psychoanalysed 82 | psychoanalyser 83 | psychoanalyses 84 | electrolysation 85 | psychoanalysing 86 | plasmolysability 87 | plasmolysabilities 88 | -------------------------------------------------------------------------------- /SpellChecker/src/main/dist/english_dic/yze.dic: -------------------------------------------------------------------------------- 1 | analyze 2 | dialyze 3 | analyzed 4 | analyzer 5 | analyzes 6 | autolyze 7 | catalyze 8 | dialyzed 9 | dialyzer 10 | dialyzes 11 | hemolyze 12 | paralyze 13 | analyzers 14 | analyzing 15 | autolyzed 16 | autolyzes 17 | catalyzed 18 | catalyzer 19 | catalyzes 20 | dialyzate 21 | dialyzers 22 | dialyzing 23 | hemolyzed 24 | hemolyzes 25 | hydrolyze 26 | paralyzed 27 | paralyzer 28 | paralyzes 29 | photolyze 30 | pyrolyzed 31 | pyrolyzer 32 | pyrolyzes 33 | reanalyze 34 | analyzable 35 | autolyzing 36 | catalyzers 37 | catalyzing 38 | dialyzable 39 | hemolyzing 40 | hydrolyzed 41 | hydrolyzer 42 | hydrolyzes 43 | paralyzant 44 | paralyzers 45 | paralyzing 46 | photolyzed 47 | photolyzes 48 | plasmolyze 49 | pyrolyzing 50 | reanalyzed 51 | reanalyzes 52 | breathalyze 53 | electrolyze 54 | hydrolyzate 55 | hydrolyzing 56 | overanalyze 57 | photolyzing 58 | plasmolyzed 59 | plasmolyzes 60 | reanalyzing 61 | breathalyzed 62 | breathalyzer 63 | breathalyzes 64 | electrolyzed 65 | electrolyzer 66 | electrolyzes 67 | hydrolyzable 68 | overanalyzed 69 | overanalyzes 70 | paralyzation 71 | paralyzingly 72 | plasmolyzing 73 | unanalyzable 74 | breathalyzers 75 | breathalyzing 76 | electrolyzers 77 | electrolyzing 78 | overanalyzing 79 | plasmolyzable 80 | psychoanalyze 81 | psychoanalyzed 82 | psychoanalyzer 83 | psychoanalyzes 84 | electrolyzation 85 | psychoanalyzing 86 | plasmolyzability 87 | plasmolyzabilities 88 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/engine/Configuration.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.engine; 21 | 22 | import java.lang.reflect.InvocationTargetException; 23 | 24 | /** 25 | * The various settings used to control how a spell checker works are read from here. 26 | * Includes the COST_* constants that decide how to figure the cost of converting one word to 27 | * another in the EditDistance class. 28 | *

29 | * Also includes SPELL_* constants that control how misspellings are detected, for example, how to handle 30 | * mixed-case words, etc. 31 | * 32 | * @author aim4min 33 | * @see EditDistance 34 | */ 35 | public abstract class Configuration { 36 | 37 | /** 38 | * System property that, if defined, should be a fully qualified class name of a configuration. 39 | */ 40 | public static final String PROPERTY_CONFIG_OVERRIDE = "jazzy.config"; 41 | 42 | /** used by EditDistance: the cost of having to remove a character
(integer greater than 0). */ 43 | public static final String COST_REMOVE_CHAR = "EDIT_DEL1"; 44 | 45 | /** used by EditDistance: the cost of having to insert a character
(integer greater than 0).*/ 46 | public static final String COST_INSERT_CHAR = "EDIT_DEL2"; 47 | 48 | /** 49 | * used by EditDistance: the cost of having to swap two adjoining characters 50 | * for the swap value to ever be used, it should be smaller than the COST_REMOVE_CHAR or COST_INSERT_CHAR values. 51 | *
(integer greater than 0) 52 | */ 53 | public static final String COST_SWAP_CHARS = "EDIT_SWAP"; 54 | 55 | /** 56 | * used by EditDistance: the cost of having to change case, for example, from i to I. 57 | *
(integer greater than 0) 58 | */ 59 | public static final String COST_CHANGE_CASE = "EDIT_CASE"; 60 | 61 | /** 62 | * Used by EditDistance: the cost of having to substitute one character for another 63 | * for the sub value to ever be used, it should be smaller than the COST_REMOVE_CHAR or COST_INSERT_CHAR values. 64 | * (integer greater than 0) 65 | */ 66 | public static final String COST_SUBST_CHARS = "EDIT_SUB"; 67 | 68 | /** 69 | * The maximum cost of suggested spelling. Any suggestions that cost more are thrown away 70 | * integer greater than 1). 71 | */ 72 | public static final String SPELL_THRESHOLD = "SPELL_THRESHOLD"; 73 | 74 | /** words that are all upper case are not spell checked, example: "CIA".
(boolean) */ 75 | public static final String SPELL_IGNOREUPPERCASE = "SPELL_IGNOREUPPERCASE"; 76 | /** words that have mixed case are not spell checked, example: "SpellChecker".
(boolean) */ 77 | public static final String SPELL_IGNOREMIXEDCASE = "SPELL_IGNOREMIXEDCASE"; 78 | /** words that look like an Internet address are not spell checked, example: "http://www.google.com".
(boolean)*/ 79 | public static final String SPELL_IGNOREINTERNETADDRESSES = "SPELL_IGNOREINTERNETADDRESS"; 80 | /** words that have digits in them are not spell checked, example: "mach5".
(boolean) */ 81 | public static final String SPELL_IGNOREDIGITWORDS = "SPELL_IGNOREDIGITWORDS"; 82 | /** I don't know what this does. It doesn't seem to be used.
(boolean) */ 83 | public static final String SPELL_IGNOREMULTIPLEWORDS = "SPELL_IGNOREMULTIPLEWORDS"; 84 | /** the first word of a sentence is expected to start with an upper case letter
(boolean). */ 85 | public static final String SPELL_IGNORESENTENCECAPITALIZATION = "SPELL_IGNORESENTENCECAPTILIZATION"; 86 | 87 | /** Whether to ignore words that are a single letter (common in programming). */ 88 | public static final String SPELL_IGNORESINGLELETTERS = "SPELL_IGNORESINGLELETTERS"; 89 | 90 | /** Whether to inspect {@code camelCase} words (common in programming). */ 91 | public static final String SPELL_ANALYZECAMELCASEWORDS = "SPELL_ANALYZECAMELCASEWORDS"; 92 | 93 | /** 94 | * Gets one of the integer constants. 95 | * 96 | * @param key one of the integer constants defined in this class 97 | * @return int value of the setting 98 | */ 99 | public abstract int getInteger(String key); 100 | 101 | /** 102 | * Gets one of the boolean constants. 103 | * 104 | * @param key one of the boolean constants defined in this class 105 | * @return boolean value of the setting 106 | */ 107 | public abstract boolean getBoolean(String key); 108 | 109 | /** 110 | * Sets one of the integer constants. Does not persist the change. 111 | * 112 | * @param key one of the integer constants defined in this class 113 | * @param value new integer value of the constant. 114 | */ 115 | public abstract void setInteger(String key, int value); 116 | 117 | /** 118 | * Sets one of the boolean constants. Does not persist the change. 119 | * 120 | * @param key one of the boolean constants defined in this class 121 | * @param value new boolean value of this setting. 122 | */ 123 | public abstract void setBoolean(String key, boolean value); 124 | 125 | /** 126 | * Gets a new default Configuration. 127 | * 128 | * @return Configuration 129 | */ 130 | public static Configuration getConfiguration() { 131 | String config = System.getProperty(PROPERTY_CONFIG_OVERRIDE); // added by bd 132 | if (config != null && !config.isEmpty()) 133 | return getConfiguration(config); 134 | return getConfiguration(null); 135 | } 136 | 137 | /** 138 | * Returns a new instance of a Configuration class. 139 | * 140 | * @param className - the class to return, must be based on Configuration 141 | * @return The configuration. 142 | */ 143 | public static Configuration getConfiguration(String className) { 144 | 145 | Configuration result; 146 | 147 | if (className != null && !className.isEmpty()) { 148 | try { 149 | result = (Configuration) Class.forName(className).getDeclaredConstructor().newInstance(); 150 | } catch (InstantiationException | InvocationTargetException | IllegalAccessException | 151 | ClassNotFoundException | NoSuchMethodException e) { 152 | result = new PropertyConfiguration(); 153 | } 154 | } else { 155 | result = new PropertyConfiguration(); 156 | } 157 | return result; 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/engine/PropertyConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.engine; 21 | 22 | import java.io.*; 23 | import java.nio.charset.Charset; 24 | import java.nio.charset.StandardCharsets; 25 | import java.util.Properties; 26 | 27 | 28 | /** 29 | * Implementation class to read the properties controlling the spell engine. 30 | * The properties are read form the configuration.properties file. 31 | * 32 | * @author aim4min 33 | */ 34 | public class PropertyConfiguration extends Configuration { 35 | 36 | /** 37 | * The persistent set of properties supported by the spell engine. 38 | */ 39 | private Properties prop; 40 | 41 | private static final String DEFAULT_PROPERTIES = "org/fife/com/swabunga/spell/engine/configuration.properties"; 42 | 43 | private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; 44 | 45 | /** 46 | * Constructs and loads spell engine properties configuration. 47 | */ 48 | public PropertyConfiguration() { 49 | this(DEFAULT_PROPERTIES); 50 | } 51 | 52 | public PropertyConfiguration(String resource) { 53 | prop = new Properties(); 54 | InputStream in = getClass().getClassLoader().getResourceAsStream(resource); 55 | if (in != null) { 56 | try (BufferedReader r = new BufferedReader(new InputStreamReader(in, DEFAULT_CHARSET))) { 57 | prop.load(r); 58 | } catch (IOException e) { 59 | e.printStackTrace(); 60 | } 61 | } 62 | } 63 | 64 | @Override 65 | public boolean getBoolean(String key) { 66 | return Boolean.parseBoolean(prop.getProperty(key)); 67 | } 68 | 69 | @Override 70 | public int getInteger(String key) { 71 | return Integer.parseInt(prop.getProperty(key), 10); 72 | } 73 | 74 | @Override 75 | public void setBoolean(String key, boolean value) { 76 | prop.setProperty(key, String.valueOf(value)); 77 | } 78 | 79 | @Override 80 | public void setInteger(String key, int value) { 81 | prop.setProperty(key, Integer.toString(value)); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/engine/SpellDictionary.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.engine; 21 | 22 | import java.util.List; 23 | 24 | /** 25 | * An interface for all dictionary implementations. It defines the most basic 26 | * operations on a dictionary: adding words, checking if a word is correct, and getting a list 27 | * of suggestions for misspelled words. 28 | */ 29 | public interface SpellDictionary { 30 | 31 | /** 32 | * Add a word permanently to the dictionary. 33 | * 34 | * @param word The word to add to the dictionary 35 | * @return Whether the word was successfully added. 36 | */ 37 | boolean addWord(String word); 38 | 39 | /** 40 | * Evaluates if the word is correctly spelled against the dictionary. 41 | * 42 | * @param word The word to verify if it's spelling is OK. 43 | * @return Indicates if the word is present in the dictionary. 44 | */ 45 | boolean isCorrect(String word); 46 | 47 | /** 48 | * Returns a list of Word objects that are the suggestions to any word. 49 | * If the word is correctly spelled, then this method 50 | * could return just that one word, or it could still return a list 51 | * of words with similar spellings. 52 | *
53 | * Each suggested word has a score, which is an integer 54 | * that represents how different the suggested word is from the sourceWord. 55 | * If the words are exactly the same, then the score is 0. 56 | * You can get the dictionary to only return the most similar words by setting 57 | * an appropriately low threshold value. 58 | * If you set the threshold value too low, you may get no suggestions for a given word. 59 | *

60 | * This method is only needed to provide backward compatibility. 61 | * 62 | * @param sourceWord the string that we want to get a list of spelling suggestions for 63 | * @param scoreThreshold Any words that have score less than this number are returned. 64 | * @return List a List of suggested words 65 | * @see org.fife.com.swabunga.spell.engine.Word 66 | * @see #getSuggestions(String, int, int[][]) 67 | */ 68 | List getSuggestions(String sourceWord, int scoreThreshold); 69 | 70 | /** 71 | * Returns a list of Word objects that are the suggestions to any word. 72 | * If the word is correctly spelled, then this method 73 | * could return just that one word, or it could still return a list 74 | * of words with similar spellings. 75 | *
76 | * Each suggested word has a score, which is an integer 77 | * that represents how different the suggested word is from the sourceWord. 78 | * If the words are exactly the same, then the score is 0. 79 | * You can get the dictionary to only return the most similar words by setting 80 | * an appropriately low threshold value. 81 | * If you set the threshold value too low, you may get no suggestions for a given word. 82 | *

83 | * 84 | * @param sourceWord the string that we want to get a list of spelling suggestions for 85 | * @param scoreThreshold Any words that have score less than this number are returned. 86 | * @param matrix Two dimensional int array used to calculate edit distance. Allocating 87 | * this memory outside the function will greatly improve efficiency. 88 | * @return List a List of suggested words 89 | * @see org.fife.com.swabunga.spell.engine.Word 90 | */ 91 | List getSuggestions(String sourceWord, int scoreThreshold , int[][] matrix); 92 | 93 | } 94 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/engine/SpellDictionaryDichoDisk.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.engine; 21 | 22 | import java.io.EOFException; 23 | import java.io.File; 24 | import java.io.IOException; 25 | import java.io.RandomAccessFile; 26 | import java.util.LinkedList; 27 | import java.util.List; 28 | 29 | /** 30 | * Another implementation of SpellDictionary that doesn't cache any words in memory. Avoids the huge 31 | * footprint of SpellDictionaryHashMap at the cost of relatively minor latency. A future version 32 | * of this class that implements some caching strategies might be a good idea in the future, if there's any 33 | * demand for it. 34 | *

35 | * This implementation requires a special dictionary file, with "code*word" lines sorted by code. 36 | * It's using a dichotomy algorithm to search for words in the dictionary 37 | * 38 | * @author Damien Guillaume 39 | * @version 0.1 40 | */ 41 | public class SpellDictionaryDichoDisk extends SpellDictionaryASpell { 42 | 43 | /** Holds the dictionary file for reading. */ 44 | private RandomAccessFile dictFile; 45 | 46 | /** dictionary and phonetic file encoding. */ 47 | private String encoding; 48 | 49 | /** 50 | * Dictionary convenience Constructor. 51 | * 52 | * @param wordList The file containing the words list for the dictionary 53 | * @throws IOException indicates problems reading the words list file. 54 | */ 55 | public SpellDictionaryDichoDisk(File wordList) throws IOException { 56 | super((File) null); 57 | dictFile = new RandomAccessFile(wordList, "r"); 58 | } 59 | 60 | /** 61 | * Dictionary convenience Constructor. 62 | * 63 | * @param wordList The file containing the words list for the dictionary 64 | * @param encoding Uses the character set encoding specified 65 | * @throws IOException indicates problems reading the words list file. 66 | */ 67 | public SpellDictionaryDichoDisk(File wordList, String encoding) throws IOException { 68 | super((File) null); 69 | this.encoding = encoding; 70 | dictFile = new RandomAccessFile(wordList, "r"); 71 | } 72 | 73 | /** 74 | * Dictionary constructor that uses an aspell phonetic file to 75 | * build the transformation table. 76 | * 77 | * @param wordList The file containing the words list for the dictionary 78 | * @param phonetic The file to use for phonetic transformation of the 79 | * wordlist. 80 | * @throws IOException indicates problems reading the words list file. 81 | */ 82 | public SpellDictionaryDichoDisk(File wordList, File phonetic) throws IOException { 83 | super(phonetic); 84 | dictFile = new RandomAccessFile(wordList, "r"); 85 | } 86 | 87 | /** 88 | * Dictionary constructor that uses an aspell phonetic file to 89 | * build the transformation table. 90 | * 91 | * @param wordList The file containing the words list for the dictionary 92 | * @param phonetic The file to use for phonetic transformation of the 93 | * wordlist. 94 | * @param encoding Uses the character set encoding specified 95 | * @throws IOException indicates problems reading the words list file. 96 | */ 97 | public SpellDictionaryDichoDisk(File wordList, File phonetic, String encoding) 98 | throws IOException { 99 | super(phonetic, encoding); 100 | this.encoding = encoding; 101 | dictFile = new RandomAccessFile(wordList, "r"); 102 | } 103 | 104 | /** 105 | * Add a word permanently to the dictionary (and the dictionary file).

106 | * This method is not implemented ! 107 | * 108 | * @param word The word to add. 109 | * @return Whether the word was added (always {@code false}). 110 | */ 111 | @Override 112 | public boolean addWord(String word) { 113 | return false; 114 | } 115 | 116 | /** 117 | * Search the dictionary file for the words corresponding to the code 118 | * within positions p1 - p2. 119 | */ 120 | private LinkedList dichoFind(String code, long p1, long p2) throws IOException { 121 | //System.out.println("dichoFind("+code+","+p1+","+p2+")"); 122 | long pm = (p1 + p2) / 2; 123 | dictFile.seek(pm); 124 | String l; 125 | if (encoding == null) 126 | l = dictFile.readLine(); 127 | else 128 | l = dictReadLine(); 129 | pm = dictFile.getFilePointer(); 130 | if (encoding == null) 131 | l = dictFile.readLine(); 132 | else 133 | l = dictReadLine(); 134 | long pm2 = dictFile.getFilePointer(); 135 | if (pm2 >= p2) 136 | return(seqFind(code, p1, p2)); 137 | int istar = l.indexOf('*'); 138 | if (istar == -1) 139 | throw new IOException("bad format: no * !"); 140 | String testcode = l.substring(0, istar); 141 | int comp = code.compareTo(testcode); 142 | if (comp < 0) 143 | return(dichoFind(code, p1, pm-1)); 144 | else if (comp > 0) 145 | return(dichoFind(code, pm2, p2)); 146 | else { 147 | LinkedList l1 = dichoFind(code, p1, pm-1); 148 | LinkedList l2 = dichoFind(code, pm2, p2); 149 | String word = l.substring(istar+1); 150 | l1.add(word); 151 | l1.addAll(l2); 152 | return(l1); 153 | } 154 | } 155 | 156 | private LinkedList seqFind(String code, long p1, long p2) throws IOException { 157 | //System.out.println("seqFind("+code+","+p1+","+p2+")"); 158 | LinkedList list = new LinkedList<>(); 159 | dictFile.seek(p1); 160 | while (dictFile.getFilePointer() < p2) { 161 | String l; 162 | if (encoding == null) 163 | l = dictFile.readLine(); 164 | else 165 | l = dictReadLine(); 166 | int istar = l.indexOf('*'); 167 | if (istar == -1) 168 | throw new IOException("bad format: no * !"); 169 | String testcode = l.substring(0, istar); 170 | if (testcode.equals(code)) { 171 | String word = l.substring(istar+1); 172 | list.add(word); 173 | } 174 | } 175 | return(list); 176 | } 177 | 178 | /** 179 | * Read a line of dictFile with a specific encoding. 180 | */ 181 | private String dictReadLine() throws IOException { 182 | int max = 255; 183 | byte b=0; 184 | byte[] buf = new byte[max]; 185 | int i=0; 186 | try { 187 | for (; b != '\n' && b != '\r' && i getWords(String code) { 206 | //System.out.println("getWords("+code+")"); 207 | LinkedList list; 208 | try { 209 | list = dichoFind(code, 0, dictFile.length()-1); 210 | //System.out.println(list); 211 | } catch (IOException ex) { 212 | ex.printStackTrace(); 213 | list = new LinkedList<>(); 214 | } 215 | return list; 216 | } 217 | 218 | } 219 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/engine/Transformator.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.engine; 21 | 22 | /** 23 | * An interface for all Transformators - which take a dictionary word and converts into its 24 | * phonetic hash. These phonetic hashes are useful for determining what other words are 25 | * similar to it, and then list those words as suggestions. 26 | * 27 | * @author Robert Gustavsson (robert@lindesign.se) 28 | */ 29 | public interface Transformator { 30 | 31 | /** 32 | * Take the given word, and return the best phonetic hash for it. 33 | * 34 | * @param word the word to transform 35 | * @return the phonetic transformation of the word 36 | */ 37 | String transform(String word); 38 | 39 | /** 40 | * gets the list of characters that should be swapped in to the misspelled word 41 | * in order to try to find more suggestions. 42 | * In general, this list represents all the unique phonetic characters 43 | * for this Transformator. 44 | *

45 | * The replace list is used in the getSuggestions method. 46 | * All the letters in the misspelled word are replaced with the characters from 47 | * this list to try and generate more suggestions, which implies l*n tries, 48 | * if l is the size of the string, and n is the size of this list. 49 | *

50 | * In addition to that, each of these letters is added to the misspelled word. 51 | * 52 | * @return char[] misspelled words should try replacing with these characters to get more suggestions 53 | */ 54 | char[] getReplaceList(); 55 | } 56 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/engine/Word.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.engine; 21 | 22 | import java.util.Comparator; 23 | 24 | /** 25 | * The Word object holds information for one suggested spelling. 26 | * It contains both the suggested word string and the distance cost, which represents how different the suggested 27 | * word is from the misspelling. 28 | *

This class is now immutable. 29 | *

30 | */ 31 | public class Word implements Comparator { 32 | private String word; 33 | private int score; 34 | 35 | /** 36 | * Constructs a new Word. 37 | * 38 | * @param word The text of a word. 39 | * @param score The word's distance cost 40 | */ 41 | public Word(String word, int score) { 42 | this.word = word; 43 | this.score = score; 44 | } 45 | 46 | /** 47 | * Constructs a new Word. 48 | */ 49 | public Word() { 50 | this.word = ""; 51 | this.score = 0; 52 | } 53 | 54 | /** 55 | * Compares two words, mostly for the purpose of sorting words. 56 | * 57 | * @param o1 the first word 58 | * @param o2 the second word 59 | * @return -1 if the first word is more similar to the misspelled word 60 | *
1 if the second word is more similar to the misspelled word 61 | *
0 if both words are equally similar 62 | */ 63 | @Override 64 | public int compare(Word o1, Word o2) { 65 | return Integer.compare(o1.getCost(), o2.getCost()); 66 | } 67 | 68 | /** 69 | * Indicates if this word is equal to another one. 70 | * 71 | * @param o The other word to compare 72 | * @return The indication of equality 73 | */ 74 | @Override 75 | public boolean equals(Object o) { 76 | if (o instanceof Word) // added by bd 77 | return(((Word)o).getWord().equals(getWord())); 78 | return false; 79 | } 80 | 81 | /** 82 | * Gets suggested spelling. 83 | * 84 | * @return the actual text of the suggest spelling. 85 | */ 86 | public String getWord() { 87 | return word; 88 | } 89 | 90 | /** 91 | * Overridden since {@link #equals(Object)} is overridden. 92 | * 93 | * @return The hash code for this word. 94 | */ 95 | @Override 96 | public int hashCode() { 97 | return word.hashCode(); 98 | } 99 | 100 | 101 | /** 102 | * Sets suggested spelling. 103 | * 104 | * @param word The text to set for suggested spelling 105 | */ 106 | public void setWord(String word) { 107 | this.word = word; 108 | } 109 | 110 | /** 111 | * A cost measures how close a match this word was to the original word. 112 | * 113 | * @return 0 if an exact match. Higher numbers are worse matches. 114 | * @see EditDistance 115 | */ 116 | public int getCost() { 117 | return score; 118 | } 119 | 120 | /** 121 | * Returns the suggested spelling. 122 | * 123 | * @return The word's text 124 | */ 125 | @Override 126 | public String toString() { 127 | return word; 128 | } 129 | } 130 | 131 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/engine/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is distributed under a modified BSD license. See the included 3 | * LICENSE.md file for details. 4 | */ 5 | /** 6 | * The actual spelling engine. 7 | */ 8 | package org.fife.com.swabunga.spell.engine; 9 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/event/AbstractWordTokenizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.event; 21 | 22 | import java.text.BreakIterator; 23 | 24 | 25 | /** 26 | * This class tokenizes an input string. 27 | * 28 | *

29 | * It also allows for the string to be mutated. The result after the spell 30 | * checking is completed is available to the call to getFinalText. 31 | *

32 | * 33 | * @author Jason Height(jheight@chariot.net.au) 34 | * @author Anthony Roy (ajr@antroy.co.uk) 35 | */ 36 | public abstract class AbstractWordTokenizer implements WordTokenizer { 37 | 38 | /** 39 | * The word being analyzed. 40 | */ 41 | private Word currentWord; 42 | /** 43 | * The word finder used to filter out words which are non pertinent to spell checking. 44 | */ 45 | protected WordFinder finder; 46 | /** 47 | * An iterator to work through the sentence. 48 | */ 49 | protected BreakIterator sentenceIterator; 50 | 51 | /** 52 | * The cumulative word count that have been processed. 53 | */ 54 | private int wordCount; 55 | 56 | /** 57 | * Creates a new AbstractWordTokenizer object. 58 | * 59 | * @param text the text to process. 60 | */ 61 | public AbstractWordTokenizer(String text) { 62 | this(new DefaultWordFinder(text)); 63 | } 64 | 65 | /** 66 | * Creates a new AbstractWordTokenizer object. 67 | * 68 | * @param wf the custom WordFinder to use in searching for words. 69 | */ 70 | public AbstractWordTokenizer(WordFinder wf) { 71 | this.finder = wf; 72 | } 73 | 74 | /** 75 | * Returns the current number of words that have been processed. 76 | * 77 | * @return number of words so far iterated. 78 | */ 79 | @Override 80 | public int getCurrentWordCount() { 81 | return wordCount; 82 | } 83 | 84 | /** 85 | * Returns the end of the current word in the text. 86 | * 87 | * @return index in string of the end of the current word. 88 | * @throws WordNotFoundException current word has not yet been set. 89 | */ 90 | @Override 91 | public int getCurrentWordEnd() { 92 | if (currentWord == null) { 93 | throw new WordNotFoundException("No Words in current String"); 94 | } 95 | return currentWord.getEnd(); 96 | } 97 | 98 | /** 99 | * Returns the index of the start of the current word in the text. 100 | * 101 | * @return index in string of the start of the current word. 102 | * @throws WordNotFoundException current word has not yet been set. 103 | */ 104 | @Override 105 | public int getCurrentWordPosition() { 106 | if (currentWord == null) { 107 | throw new WordNotFoundException("No Words in current String"); 108 | } 109 | return currentWord.getStart(); 110 | } 111 | 112 | /** 113 | * Returns whether there are more words that can be processed in the string. 114 | * 115 | * @return Whether there are further words in the text. 116 | */ 117 | @Override 118 | public boolean hasMoreWords() { 119 | return finder.hasNext(); 120 | } 121 | 122 | /** 123 | * Returns searches for the next word in the text, and returns that word. 124 | * 125 | * @return the string representing the current word. 126 | * @throws WordNotFoundException search string contains no more words. 127 | */ 128 | @Override 129 | public String nextWord() { 130 | currentWord = finder.next(); 131 | wordCount++; 132 | return currentWord.getText(); 133 | } 134 | 135 | /** 136 | * Replaces the current word token. 137 | * 138 | * @param newWord replacement word. 139 | * @throws WordNotFoundException current word has not yet been set. 140 | */ 141 | @Override 142 | public abstract void replaceWord(String newWord); 143 | 144 | /** 145 | * Returns the current text that is being tokenized (includes any changes 146 | * that have been made). 147 | * 148 | * @return the text being tokenized. 149 | */ 150 | @Override 151 | public String getContext() { 152 | return finder.toString(); 153 | } 154 | 155 | /** 156 | * Returns whether the current word is at the start of a sentence. 157 | * 158 | * @return Whether the current word starts a sentence. 159 | * @throws WordNotFoundException current word has not yet been set. 160 | */ 161 | @Override 162 | public boolean isNewSentence() { 163 | return finder.startsSentence(); 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/event/BasicSpellCheckEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.event; 21 | 22 | /** 23 | * This event is fired off by the SpellChecker and is passed to the 24 | * registered SpellCheckListeners. Modified to only be incorrect words 25 | * and their locations for RSTA's usage patterns. 26 | * 27 | * @author Jason Height (jheight@chariot.net.au) 28 | */ 29 | class BasicSpellCheckEvent implements SpellCheckEvent { 30 | 31 | /** 32 | * The misspelled word. 33 | */ 34 | private String invalidWord; 35 | 36 | private int startPosition; 37 | 38 | 39 | /** 40 | * Constructs the SpellCheckEvent. 41 | * 42 | * @param invalidWord The word that is misspelled 43 | * @param tokenizer The reference to the tokenizer that caused this event to fire. 44 | */ 45 | BasicSpellCheckEvent(String invalidWord, WordTokenizer tokenizer) { 46 | this(invalidWord, tokenizer.getCurrentWordPosition()); 47 | } 48 | 49 | /** 50 | * Constructs the SpellCheckEvent. 51 | * 52 | * @param invalidWord The word that is misspelled 53 | * @param startPosition The position of the misspelled word. 54 | */ 55 | BasicSpellCheckEvent(String invalidWord, int startPosition) { 56 | this.invalidWord = invalidWord; 57 | this.startPosition = startPosition; 58 | } 59 | 60 | /** 61 | * Returns the currently misspelled word. 62 | * 63 | * @return The text misspelled 64 | */ 65 | @Override 66 | public String getInvalidWord() { 67 | return invalidWord; 68 | } 69 | 70 | /** 71 | * Returns the context in which the misspelled word is used. 72 | * 73 | * @return The text containing the context 74 | */ 75 | @Override 76 | public String getWordContext() { 77 | //JMH TBD 78 | return null; 79 | } 80 | 81 | /** 82 | * Returns the start position of the misspelled word in the context. 83 | * 84 | * @return The position of the word. 85 | */ 86 | @Override 87 | public int getWordContextPosition() { 88 | return startPosition; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/event/DefaultWordFinder.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.event; 21 | 22 | /** 23 | * A basic word finder, which searches text for sequences of letters. 24 | * 25 | * @author Anthony Roy (ajr@antroy.co.uk) 26 | */ 27 | public class DefaultWordFinder extends AbstractWordFinder { 28 | 29 | /** 30 | * Creates a new DefaultWordFinder object. 31 | * 32 | * @param inText the String to search 33 | */ 34 | public DefaultWordFinder(String inText) { 35 | super(inText); 36 | } 37 | 38 | /** 39 | * Creates a new DefaultWordFinder object. 40 | */ 41 | public DefaultWordFinder() { 42 | super(); 43 | } 44 | 45 | /** 46 | * This method scans the text from the end of the last word, and returns a 47 | * new Word object corresponding to the next word. 48 | * 49 | * @return the next word. 50 | * @throws WordNotFoundException search string contains no more words. 51 | */ 52 | @Override 53 | public Word next() { 54 | if (nextWord == null) { 55 | throw new WordNotFoundException("No more words found."); 56 | } 57 | currentWord.copy(nextWord); 58 | setSentenceIterator(currentWord); 59 | 60 | int i = currentWord.getEnd(); 61 | boolean finished = false; 62 | 63 | while (i < text.length() && !finished) { 64 | if (isWordChar(i)) { 65 | nextWord.setStart(i); 66 | int end = getNextWordEnd(text, i); 67 | nextWord.setText(text.substring(i, end)); 68 | finished = true; 69 | } 70 | i++; 71 | } 72 | if (!finished) 73 | nextWord = null; 74 | 75 | return currentWord; 76 | } 77 | 78 | /** 79 | * Returns the position in the string after the end of the next word. 80 | * Note that this return value should not be used as an index into the string 81 | * without checking first that it is in range, since it is possible for the 82 | * value text.length() to be returned by this method. 83 | */ 84 | private int getNextWordEnd(String text, int startPos) { 85 | // If we're dealing with a possible 'internet word' we need to provide 86 | // some special handling 87 | //if (SpellChecker.isINETWord(text.substring(startPos))) { 88 | // robert: trying to be smarter avoiding email addresses (see SpellChecker changes) 89 | if (SpellChecker.beginsAsINETWord(text.substring(startPos))) { 90 | for (int i = startPos; i < text.length(); i++) { 91 | char ch = text.charAt(i); 92 | if (Character.isLetterOrDigit(ch)) 93 | continue; 94 | 95 | if (ch == '\r' || ch == '\n') 96 | return i; 97 | // Chop off any characters that might be enclosing the 'internet word'. eg ',",),] 98 | if (Character.isSpaceChar(ch)) 99 | if (i > 0 && Character.isLetterOrDigit(text.charAt(i - 1))) 100 | return i; 101 | else 102 | return i - 1; 103 | } 104 | return text.length(); 105 | } 106 | 107 | for (int i = startPos; i < text.length(); i++) { 108 | if (!isWordChar(i)) 109 | return i; 110 | } 111 | return text.length(); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/event/SpellCheckEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.event; 21 | 22 | /** 23 | * This event is fired off by the SpellChecker and is passed to the 24 | * registered SpellCheckListeners 25 | *

26 | * As far as I know, we will only require one implementation of the SpellCheckEvent 27 | * (BasicSpellCheckEvent) but I have defined this interface just in case. The 28 | * BasicSpellCheckEvent implementation is currently package private. 29 | * 30 | * @author Jason Height (jheight@chariot.net.au) 31 | */ 32 | public interface SpellCheckEvent { 33 | 34 | /** 35 | * Returns the currently misspelled word. 36 | * 37 | * @return The text misspelled 38 | */ 39 | String getInvalidWord(); 40 | 41 | /** 42 | * Returns the context in which the misspelled word is used. 43 | * 44 | * @return The text containing the context 45 | */ 46 | String getWordContext(); 47 | 48 | /** 49 | * Returns the start position of the misspelled word in the context. 50 | * 51 | * @return The position of the word 52 | */ 53 | int getWordContextPosition(); 54 | } 55 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/event/SpellCheckListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.event; 21 | 22 | import java.util.EventListener; 23 | 24 | /** 25 | * This is the event based listener interface. 26 | * 27 | * @author Jason Height (jheight@chariot.net.au) 28 | */ 29 | public interface SpellCheckListener extends EventListener { 30 | 31 | /** 32 | * Propagates the spelling errors to listeners. 33 | * 34 | * @param event The event to handle. 35 | * @return Whether to cancel the rest of the spell check. 36 | */ 37 | boolean spellingError(SpellCheckEvent event); 38 | } 39 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/event/StringWordTokenizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.event; 21 | 22 | 23 | /** 24 | * This class tokenizes a input string. 25 | * 26 | *

27 | * It also allows for the string to be altered by calls to replaceWord(). The result after the spell 28 | * checking is completed is available to the call to getContext. 29 | *

30 | * 31 | * @author Jason Height (jheight@chariot.net.au) 32 | * @author Anthony Roy (ajr@antroy.co.uk) 33 | */ 34 | public class StringWordTokenizer extends AbstractWordTokenizer { 35 | 36 | /** 37 | * Creates a new StringWordTokenizer object. 38 | * 39 | * @param s the string to tokenize. 40 | */ 41 | public StringWordTokenizer(String s) { 42 | super(s); 43 | } 44 | 45 | /** 46 | * Creates a new StringWordTokenizer object. 47 | * 48 | * @param wf the custom WordFinder to use in tokenizing. Note 49 | * that the string to tokenize will be encapsulated within the WordFinder. 50 | */ 51 | public StringWordTokenizer(WordFinder wf) { 52 | super(wf); 53 | } 54 | 55 | /** 56 | * Creates a new StringWordTokenizer object. 57 | * 58 | * @param s the string to work on 59 | * @param finder the custom WordFinder to use in tokenizing. Note 60 | * that the string to tokenize will be encapsulated within the WordFinder. 61 | */ 62 | public StringWordTokenizer(String s, WordFinder finder) { 63 | super(finder); 64 | finder.setText(s); 65 | } 66 | 67 | 68 | /** 69 | * Returns the final text. 70 | * 71 | * @return the final text. 72 | * @deprecated use getContext() instead as per the WordTokenizer 73 | * interface specification. 74 | */ 75 | @Deprecated 76 | public String getFinalText() { 77 | return getContext(); 78 | } 79 | 80 | /** 81 | * Replace the current word in the iteration with the String s. 82 | * 83 | * @param s the String to replace the current word. 84 | * @throws WordNotFoundException current word not yet set. 85 | */ 86 | @Override 87 | public void replaceWord(String s) { 88 | finder.replace(s); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/event/Word.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.event; 21 | 22 | /** 23 | * Offers basic methods to manipulate a text string representing a word. 24 | */ 25 | public class Word { 26 | 27 | private int end; 28 | private int start; 29 | private String text; 30 | 31 | /** 32 | * Creates a new Word object. 33 | * 34 | * @param text the String representing the word. 35 | * @param start the start index of the word. 36 | */ 37 | public Word(String text, int start) { 38 | this.text = text; 39 | this.start = start; 40 | setEnd(); 41 | } 42 | 43 | /** 44 | * Creates a new Word object by cloning an existing Word object. 45 | * 46 | * @param w the word object to clone. 47 | */ 48 | public Word(Word w) { 49 | this.copy(w); 50 | } 51 | 52 | /** 53 | * Evaluate the end of word position. 54 | * 55 | * @return the end index of the word. 56 | */ 57 | public int getEnd() { 58 | return end; 59 | } 60 | 61 | /** 62 | * Set the start index of the word. 63 | * 64 | * @param s the start index. 65 | */ 66 | public void setStart(int s) { 67 | start = s; 68 | setEnd(); 69 | } 70 | 71 | /** 72 | * Evaluate the start of word position. 73 | * 74 | * @return the start index. 75 | */ 76 | public int getStart() { 77 | 78 | return start; 79 | } 80 | 81 | /** 82 | * Set the text to a new string value. 83 | * 84 | * @param s the new text 85 | */ 86 | public void setText(String s) { 87 | text = s; 88 | setEnd(); 89 | } 90 | 91 | /** 92 | * Supply the text string representing the word. 93 | * 94 | * @return the String representing the word. 95 | */ 96 | public String getText() { 97 | return text; 98 | } 99 | 100 | /** 101 | * Sets the value of this Word to be a copy of another. 102 | * 103 | * @param w the Word to copy. 104 | */ 105 | public void copy(Word w) { 106 | text = w.toString(); 107 | start = w.getStart(); 108 | setEnd(); 109 | } 110 | 111 | /** 112 | * Evaluate the length of the word. 113 | * 114 | * @return the length of the word. 115 | */ 116 | public int length() { 117 | return text.length(); 118 | } 119 | 120 | /** 121 | * Supply the text representing the word. 122 | * 123 | * @return the text representing the word. 124 | */ 125 | @Override 126 | public String toString() { 127 | return text; 128 | } 129 | 130 | /** 131 | * Set the end index of the word. 132 | */ 133 | private void setEnd() { 134 | end = start + text.length(); 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/event/WordFinder.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.event; 21 | 22 | /** 23 | *

An interface for objects which take a String as input, and iterates through 24 | * the words in the string. 25 | *

26 | * 27 | *

28 | * When the object is instantiated, and before the first call to next() is made, 29 | * the following methods should throw a WordNotFoundException:
30 | * current(), 31 | * startsSentence() and replace(). 32 | *

33 | * 34 | *

A call to next() when hasMoreWords() returns false 35 | * should throw a WordNotFoundException.

36 | * 37 | * @author Jason Height (jheight@chariot.net.au) 38 | */ 39 | 40 | public interface WordFinder { 41 | 42 | /** 43 | * This method returns the text through which the WordFinder is iterating. 44 | * The text may have been modified through calls to replace(). 45 | * 46 | * @return the (possibly modified) text being searched. 47 | */ 48 | String getText(); 49 | 50 | /** 51 | * This method resets the text through which the WordFinder iterates. 52 | * It must also re-initialize the WordFinder. 53 | * 54 | * @param newText the new text to search. 55 | */ 56 | void setText(String newText); 57 | 58 | /** 59 | * This method should return the Word object representing the current word 60 | * in the iteration. 61 | * This method should not affect the state of the WordFinder object. 62 | * 63 | * @return the current Word object. 64 | * @throws WordNotFoundException current word has not yet been set. 65 | */ 66 | Word current(); 67 | 68 | /** 69 | * Tests the finder to see if any more words are available. 70 | * 71 | * @return true if more words are available. 72 | */ 73 | boolean hasNext(); 74 | 75 | /** 76 | * This method should return the Word object representing the next word 77 | * in the iteration (the first word if next() has not yet been called). 78 | * 79 | * @return the next Word in the iteration. 80 | * @throws WordNotFoundException search string contains no more words. 81 | */ 82 | Word next(); 83 | 84 | /** 85 | * This method should replace the current Word object with a Word object 86 | * representing the String newWord. 87 | * 88 | * @param newWord the word to replace the current word with. 89 | * @throws WordNotFoundException current word has not yet been set. 90 | */ 91 | void replace(String newWord); 92 | 93 | /** 94 | * Indicates if the current word starts a new sentence. 95 | * 96 | * @return true if the current word starts a new sentence. 97 | * @throws WordNotFoundException current word has not yet been set. 98 | */ 99 | boolean startsSentence(); 100 | 101 | // void setText(); 102 | } 103 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/event/WordNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.event; 21 | 22 | /** 23 | * An exception to indicate that there not enough words as expected. 24 | */ 25 | public class WordNotFoundException extends RuntimeException { 26 | 27 | /** 28 | * Creates a new WordNotFoundException object. 29 | */ 30 | public WordNotFoundException() { 31 | super(); 32 | } 33 | 34 | /** 35 | * Creates a new WordNotFoundException object. 36 | * 37 | * @param s a message. 38 | */ 39 | public WordNotFoundException(String s) { 40 | super(s); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/event/WordTokenizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.spell.event; 21 | 22 | /** 23 | *

An interface for objects which take a text-based media as input, and iterate through 24 | * the words in the text stored in that media. Examples of such media could be Strings, 25 | * Documents, Files, TextComponents etc. 26 | *

27 | * 28 | *

29 | * When the object is instantiated, and before the first call to next() is made, 30 | * the following methods should throw a WordNotFoundException:
31 | * getCurrentWordEnd(), getCurrentWordPosition(), 32 | * isNewSentence() and replaceWord(). 33 | *

34 | * 35 | *

A call to next() when hasMoreWords() returns false 36 | * should throw a WordNotFoundException.

37 | * 38 | * @author Jason Height (jheight@chariot.net.au) 39 | */ 40 | public interface WordTokenizer { 41 | 42 | /** 43 | * Returns the context text that is being tokenized (should include any changes that have been made). 44 | * 45 | * @return the text being searched. 46 | */ 47 | String getContext(); 48 | 49 | /** 50 | * Returns the number of word tokens that have been processed thus far. 51 | * 52 | * @return the number of words found so far. 53 | */ 54 | int getCurrentWordCount(); 55 | 56 | /** 57 | * Returns an index representing the end location of the current word in the text. 58 | * 59 | * @return index of the end of the current word in the text. 60 | * @throws WordNotFoundException current word has not yet been set. 61 | */ 62 | int getCurrentWordEnd(); 63 | 64 | /** 65 | * Returns an index representing the start location of the current word in the text. 66 | * 67 | * @return index of the start of the current word in the text. 68 | * @throws WordNotFoundException current word has not yet been set. 69 | */ 70 | int getCurrentWordPosition(); 71 | 72 | /** 73 | * Returns true if the current word is at the start of a sentence. 74 | * 75 | * @return true if the current word starts a sentence. 76 | * @throws WordNotFoundException current word has not yet been set. 77 | */ 78 | boolean isNewSentence(); 79 | 80 | /** 81 | * Indicates if there are more words left. 82 | * 83 | * @return true if more words can be found in the text. 84 | */ 85 | boolean hasMoreWords(); 86 | 87 | /** 88 | * This returns the next word in the iteration. Note that any implementation should return 89 | * the current word, and then replace the current word with the next word found in the 90 | * input text (if one exists). 91 | * 92 | * @return the next word in the iteration. 93 | * @throws WordNotFoundException search string contains no more words. 94 | */ 95 | String nextWord(); 96 | 97 | /** 98 | * Replaces the current word token 99 | *

100 | * When a word is replaced care should be taken that the WordTokenizer 101 | * repositions itself such that the words that were added aren't rechecked. 102 | * Of course this is not mandatory, maybe there is a case when an 103 | * application doesn't need to do this. 104 | * 105 | * @param newWord the string which should replace the current word. 106 | * @throws WordNotFoundException current word has not yet been set. 107 | */ 108 | void replaceWord(String newWord); 109 | } 110 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/event/XMLWordFinder.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | //:folding=indent: 21 | package org.fife.com.swabunga.spell.event; 22 | 23 | 24 | /** 25 | * A word finder for XML or HTML documents, which searches text for sequences 26 | * of letters, but ignores the text inside any tags. 27 | * 28 | * @author Anthony Roy (ajr@antroy.co.uk) 29 | */ 30 | public class XMLWordFinder extends AbstractWordFinder { 31 | 32 | /** 33 | * Creates a new DefaultWordFinder object. 34 | * 35 | * @param inText the text to search. 36 | */ 37 | public XMLWordFinder(String inText) { 38 | super(inText); 39 | } 40 | 41 | /** 42 | * This method scans the text from the end of the last word, and returns a 43 | * new Word object corresponding to the next word. 44 | * 45 | * @return the next word. 46 | * @throws WordNotFoundException search string contains no more words. 47 | */ 48 | @Override 49 | public Word next() { 50 | 51 | if (currentWord == null || nextWord == null) { 52 | throw new WordNotFoundException("No more words found."); 53 | } 54 | 55 | currentWord.copy(nextWord); 56 | 57 | setSentenceIterator(currentWord); 58 | 59 | int i = currentWord.getEnd(); 60 | boolean finished = false; 61 | boolean started = false; 62 | 63 | while (i < text.length()) { 64 | if (!started && isWordChar(i)) { 65 | nextWord.setStart(i++); 66 | started = true; 67 | continue; 68 | } else if (started) { 69 | if (isWordChar(i)) { 70 | i++; 71 | continue; 72 | } else { 73 | nextWord.setText(text.substring(nextWord.getStart(), i)); 74 | finished = true; 75 | break; 76 | } 77 | } 78 | 79 | //Ignore things inside tags. 80 | int i2 = ignore(i, '<', '>'); 81 | i = (i2 == i ? i + 1 : i2); 82 | } 83 | 84 | if (!started) { 85 | nextWord = null; 86 | } else if (!finished) { 87 | nextWord.setText(text.substring(nextWord.getStart(), i)); 88 | } 89 | 90 | return currentWord; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/spell/event/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is distributed under a modified BSD license. See the included 3 | * LICENSE.md file for details. 4 | */ 5 | /** 6 | * Events related to this package. 7 | */ 8 | package org.fife.com.swabunga.spell.event; 9 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/util/ListUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | Jazzy - a Java library for Spell Checking 3 | Copyright (C) 2001 Mindaugas Idzelis 4 | Full text of license can be found in LICENSE.txt 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package org.fife.com.swabunga.util; 21 | 22 | import java.util.List; 23 | 24 | 25 | /** 26 | * Utility methods for lists. 27 | */ 28 | public final class ListUtil { 29 | 30 | /** 31 | * Private constructor to prevent instantiation. 32 | */ 33 | private ListUtil() { 34 | // Do nothing 35 | } 36 | 37 | /** 38 | * Adds all entries from one list to another, disallowing duplicates. 39 | * 40 | * @param The type of data in the lists. 41 | * @param dest The destination list. 42 | * @param src The source list. 43 | * @return The destination list. 44 | */ 45 | public static List addAllNoDuplicates(List dest, List src) { 46 | for (T value : src) { 47 | if (!dest.contains(value)) 48 | dest.add(value); 49 | } 50 | return dest; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/com/swabunga/util/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is distributed under a modified BSD license. See the included 3 | * LICENSE.md file for details. 4 | */ 5 | /** 6 | * Utility methods. 7 | */ 8 | package org.fife.com.swabunga.util; 9 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/ui/rsyntaxtextarea/spell/DefaultSpellCheckableTokenIdentifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 03/19/2014 3 | * 4 | * DefaultSpellCheckableTokenIdentifier.java - Identifies comment tokens to 5 | * be spell checked. 6 | * 7 | * This library is distributed under the LGPL. See the included 8 | * LICENSE.md file for details. 9 | */ 10 | package org.fife.ui.rsyntaxtextarea.spell; 11 | 12 | import org.fife.ui.rsyntaxtextarea.Token; 13 | import org.fife.ui.rsyntaxtextarea.TokenTypes; 14 | 15 | 16 | /** 17 | * The spell-checkable token identifier used by {@link SpellingParser} if 18 | * none is explicitly identified. It causes all comment tokens to be 19 | * spell checked. 20 | * 21 | * @author Robert Futrell 22 | * @version 1.0 23 | */ 24 | public class DefaultSpellCheckableTokenIdentifier 25 | implements SpellCheckableTokenIdentifier { 26 | 27 | 28 | /** 29 | * The default implementation of this method does nothing; this token 30 | * identifier does not have state. 31 | */ 32 | @Override 33 | public void begin() { 34 | } 35 | 36 | 37 | /** 38 | * The default implementation of this method does nothing; this token 39 | * identifier does not have state. 40 | */ 41 | @Override 42 | public void end() { 43 | } 44 | 45 | 46 | /** 47 | * Returns true if the token is a comment. 48 | * 49 | * @return true only if the token is a comment. 50 | */ 51 | @Override 52 | public boolean isSpellCheckable(Token t) { 53 | // COMMENT_MARKUP represents e.g. Javadoc markup like 54 | // "

method()
", thus shouldn't be spellchecked. 55 | // MARKUP_COMMENT, however represents comments in markup 56 | // languages, and so should be spellchecked. 57 | return t.isComment() && TokenTypes.COMMENT_MARKUP != t.getType(); 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/ui/rsyntaxtextarea/spell/SpellCheckableTokenIdentifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 03/19/2014 3 | * 4 | * SpellCheckableTokenIdentifier.java - Identifies tokens to spell check. 5 | * 6 | * This library is distributed under the LGPL. See the included 7 | * LICENSE.md file for details. 8 | */ 9 | package org.fife.ui.rsyntaxtextarea.spell; 10 | 11 | import org.fife.ui.rsyntaxtextarea.Token; 12 | 13 | 14 | /** 15 | * Identifies tokens that contain spell-checkable text. 16 | * 17 | * @author Robert Futrell 18 | * @version 1.0 19 | */ 20 | public interface SpellCheckableTokenIdentifier { 21 | 22 | 23 | /** 24 | * Called before each parsing of the document for tokens to spell check. 25 | * 26 | * @see #end() 27 | */ 28 | void begin(); 29 | 30 | 31 | /** 32 | * Called when each parsing of the document completes. 33 | * 34 | * @see #begin() 35 | */ 36 | void end(); 37 | 38 | 39 | /** 40 | * Returns whether a particular token should be spell-checked. 41 | * 42 | * @param t The token. 43 | * @return Whether that token should be spell checked. 44 | */ 45 | boolean isSpellCheckable(Token t); 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/ui/rsyntaxtextarea/spell/SpellingErrorAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is distributed under the LGPL. See the included 3 | * LICENSE.md file for details. 4 | */ 5 | package org.fife.ui.rsyntaxtextarea.spell; 6 | 7 | /** 8 | * The actions someone can take with a misspelled word. 9 | */ 10 | public enum SpellingErrorAction { 11 | 12 | /** 13 | * Add the word to the user's dictionary. 14 | */ 15 | ADD, 16 | 17 | /** 18 | * Replace the misspelled word with a suggested word. 19 | */ 20 | REPLACE, 21 | 22 | /** 23 | * Ignore the misspelled word. 24 | */ 25 | IGNORE 26 | } 27 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/ui/rsyntaxtextarea/spell/SpellingErrorTooltipHtmlGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is distributed under the LGPL. See the included 3 | * LICENSE.md file for details. 4 | */ 5 | package org.fife.ui.rsyntaxtextarea.spell; 6 | 7 | import org.fife.com.swabunga.spell.engine.Configuration; 8 | import org.fife.com.swabunga.spell.engine.Word; 9 | import org.fife.com.swabunga.spell.event.SpellChecker; 10 | 11 | import java.awt.*; 12 | import java.text.MessageFormat; 13 | import java.util.List; 14 | import java.util.Locale; 15 | import java.util.ResourceBundle; 16 | 17 | /** 18 | * Generates the HTML for a tooltip that displays a spelling error and its possible corrections. 19 | */ 20 | class SpellingErrorTooltipHtmlGenerator { 21 | 22 | private static final String TOOLTIP_TEXT_FORMAT = 23 | "" + 24 | "{1}
" + 25 | "{2}
{3}
 "; 26 | 27 | private static final ResourceBundle MSG = ResourceBundle.getBundle( 28 | "org.fife.ui.rsyntaxtextarea.spell.SpellingParser"); 29 | 30 | public String get(SpellChecker sc, SpellingParserNotice notice) { 31 | StringBuilder sb = new StringBuilder(); 32 | String spacing = "        "; 33 | int threshold = sc.getConfiguration().getInteger(Configuration.SPELL_THRESHOLD); 34 | String word = notice.getWord(); 35 | 36 | List suggestions = sc.getSuggestions(word, threshold); 37 | if (suggestions.isEmpty()) { 38 | sb.append(spacing).append("• "); 39 | sb.append(MSG.getString("None")); 40 | sb.append("

"); 41 | } 42 | else { 43 | 44 | // If the bad word started with an upper-case letter, make sure all our suggestions do. 45 | if (Character.isUpperCase(word.charAt(0))) { 46 | for (Word suggestion : suggestions) { 47 | String oldSug = suggestion.getWord(); 48 | suggestion.setWord(Character.toUpperCase(oldSug.charAt(0)) + oldSug.substring(1)); 49 | } 50 | } 51 | 52 | sb.append("
"); 53 | sb.append(""); 54 | for (int i = 0; i < suggestions.size(); i++) { 55 | if ((i % 2) == 0) { 56 | sb.append(""); 57 | } 58 | sb.append(""); 70 | if ((i & 1) == 1) { 71 | sb.append(""); 72 | } 73 | } 74 | if ((suggestions.size() % 2) == 0) { 75 | sb.append(""); 76 | } 77 | sb.append("
• "); 59 | Word suggestion = suggestions.get(i); 60 | // Surround with double quotes, not single, since 61 | // replacement words can have single quotes in them. 62 | sb.append(""). 67 | append(suggestion.getWord()). 68 | append(""). 69 | append("
"); 78 | sb.append("
"); 79 | } 80 | 81 | SpellingParser sp = (SpellingParser)notice.getParser(); 82 | if (sp.getAllowAdd()) { 83 | sb.append(" "). 84 | append(""). 86 | append(MSG.getString("ErrorToolTip.AddToDictionary")). 87 | append("
"); 88 | } 89 | 90 | if (sp.getAllowIgnore()) { 91 | String text = MSG.getString("ErrorToolTip.IgnoreWord"); 92 | text = MessageFormat.format(text, word); 93 | sb.append(" "). 94 | append(""). 96 | append(text).append(""); 97 | } 98 | 99 | String firstLine = MessageFormat.format( 100 | MSG.getString("ErrorToolTip.DescHtml"), 101 | word); 102 | ComponentOrientation o = ComponentOrientation.getOrientation( 103 | Locale.getDefault()); 104 | String dirAttr = o.isLeftToRight() ? "ltr" : "rtl"; 105 | 106 | return MessageFormat.format(TOOLTIP_TEXT_FORMAT, 107 | dirAttr, 108 | firstLine, 109 | MSG.getString("ErrorToolTip.SuggestionsHtml"), 110 | sb.toString()); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/ui/rsyntaxtextarea/spell/SpellingParserNotice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is distributed under the LGPL. See the included 3 | * LICENSE.md file for details. 4 | */ 5 | package org.fife.ui.rsyntaxtextarea.spell; 6 | 7 | import org.fife.com.swabunga.spell.event.SpellChecker; 8 | import org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice; 9 | 10 | import java.awt.*; 11 | 12 | /** 13 | * A parser notice for spelling errors. 14 | */ 15 | class SpellingParserNotice extends DefaultParserNotice { 16 | 17 | private String word; 18 | private SpellChecker sc; 19 | 20 | SpellingParserNotice(SpellingParser parser, String msg, 21 | int line, int offs, String word, 22 | SpellChecker sc) { 23 | super(parser, msg, line, offs, word.length()); 24 | setLevel(Level.INFO); 25 | this.word = word; 26 | this.sc = sc; 27 | } 28 | 29 | @Override 30 | public Color getColor() { 31 | return ((SpellingParser)getParser()).getSquiggleUnderlineColor(); 32 | } 33 | 34 | @Override 35 | public String getToolTipText() { 36 | return new SpellingErrorTooltipHtmlGenerator().get(sc, this); 37 | } 38 | 39 | /** 40 | * Returns the incorrectly spelled word. 41 | * 42 | * @return The word. 43 | */ 44 | public String getWord() { 45 | return word; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return "[SpellingParserNotice: " + word + "]"; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/ui/rsyntaxtextarea/spell/event/SpellingParserEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 08/29/2009 3 | * 4 | * SpellingParserEvent.java - An event fired by the spelling parser. 5 | * 6 | * This library is distributed under the LGPL. See the included 7 | * LICENSE.md file for details. 8 | */ 9 | package org.fife.ui.rsyntaxtextarea.spell.event; 10 | 11 | import java.util.EventObject; 12 | 13 | import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; 14 | import org.fife.ui.rsyntaxtextarea.spell.SpellingParser; 15 | 16 | 17 | /** 18 | * An event fired by the spelling parser. 19 | * 20 | * @author Robert Futrell 21 | * @version 1.0 22 | */ 23 | public class SpellingParserEvent extends EventObject { 24 | 25 | /** 26 | * Event type specifying that a word was added to the user's dictionary. 27 | */ 28 | public static final int WORD_ADDED = 0; 29 | 30 | /** 31 | * Event type specifying that a word will be ignored for the rest of 32 | * this JVM session. 33 | */ 34 | public static final int WORD_IGNORED = 1; 35 | 36 | private RSyntaxTextArea textArea; 37 | private int type; 38 | private String word; 39 | 40 | 41 | /** 42 | * Constructor. 43 | * 44 | * @param source The source parser. 45 | * @param textArea The text area that was parsed. 46 | * @param type The type of event. 47 | * @param word The word being added or ignored. 48 | * @throws IllegalArgumentException If type is invalid. 49 | */ 50 | public SpellingParserEvent(SpellingParser source, RSyntaxTextArea textArea, 51 | int type, String word) { 52 | super(source); 53 | this.textArea = textArea; 54 | setType(type); 55 | this.word = word; 56 | } 57 | 58 | 59 | /** 60 | * Returns the parser that fired this event. This is a wrapper for 61 | * (SpellingParser)getSource(). 62 | * 63 | * @return The parser. 64 | */ 65 | public SpellingParser getParser() { 66 | return (SpellingParser)getSource(); 67 | } 68 | 69 | 70 | /** 71 | * Returns the text area that was parsed. 72 | * 73 | * @return The text area. 74 | */ 75 | public RSyntaxTextArea getTextArea() { 76 | return textArea; 77 | } 78 | 79 | 80 | /** 81 | * Returns the type of this event. 82 | * 83 | * @return Either {@link #WORD_ADDED} or {@link #WORD_IGNORED}. 84 | */ 85 | public int getType() { 86 | return type; 87 | } 88 | 89 | 90 | /** 91 | * Returns the word being added or ignored. 92 | * 93 | * @return The word. 94 | */ 95 | public String getWord() { 96 | return word; 97 | } 98 | 99 | 100 | /** 101 | * Sets the type of event being fired. 102 | * 103 | * @param type The type of event being fired. 104 | */ 105 | private void setType(int type) { 106 | if (type!=WORD_ADDED && type!=WORD_IGNORED) { 107 | throw new IllegalArgumentException("Invalid type: " + type); 108 | } 109 | this.type = type; 110 | } 111 | 112 | 113 | } 114 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/ui/rsyntaxtextarea/spell/event/SpellingParserListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 08/29/2009 3 | * 4 | * SpellingParserListener.java - Listens for events from a spelling parser. 5 | * 6 | * This library is distributed under the LGPL. See the included 7 | * LICENSE.md file for details. 8 | */ 9 | package org.fife.ui.rsyntaxtextarea.spell.event; 10 | 11 | import java.util.EventListener; 12 | 13 | import org.fife.ui.rsyntaxtextarea.spell.SpellingParser; 14 | 15 | 16 | /** 17 | * Listens for events from a {@link SpellingParser}. A listener of this type 18 | * will receive notification when: 19 | * 20 | * 24 | * 25 | * @author Robert Futrell 26 | * @version 1.0 27 | */ 28 | public interface SpellingParserListener extends EventListener { 29 | 30 | 31 | /** 32 | * Called when an event occurs in the spelling parser. 33 | * 34 | * @param e The event. 35 | */ 36 | void spellingParserEvent(SpellingParserEvent e); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/ui/rsyntaxtextarea/spell/event/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is distributed under a modified BSD license. See the included 3 | * LICENSE.md file for details. 4 | */ 5 | /** 6 | * Events used by this package. 7 | */ 8 | package org.fife.ui.rsyntaxtextarea.spell.event; 9 | -------------------------------------------------------------------------------- /SpellChecker/src/main/java/org/fife/ui/rsyntaxtextarea/spell/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is distributed under a modified BSD license. See the included 3 | * LICENSE.md file for details. 4 | */ 5 | /** 6 | * The main package. 7 | */ 8 | package org.fife.ui.rsyntaxtextarea.spell; 9 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/com/swabunga/spell/engine/configuration.properties: -------------------------------------------------------------------------------- 1 | EDIT_DEL1=95 2 | EDIT_DEL2=95 3 | EDIT_SWAP=90 4 | EDIT_SUB=100 5 | EDIT_CASE=10 6 | 7 | SPELL_THRESHOLD=140 8 | SPELL_IGNOREUPPERCASE=true 9 | SPELL_IGNOREMIXEDCASE=false 10 | SPELL_IGNOREINTERNETADDRESS=true 11 | SPELL_IGNOREDIGITWORDS=true 12 | SPELL_IGNOREMULTIPLEWORDS=false 13 | SPELL_IGNORESENTENCECAPTILIZATION=true 14 | SPELL_IGNORESINGLELETTERS=true 15 | SPELL_ANALYZECAMELCASEWORDS=true 16 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=Incorrectly spelled word: {0} 2 | None=None 3 | ErrorToolTip.DescHtml= Incorrectly spelled word: {0} 4 | ErrorToolTip.SuggestionsHtml= Suggestions: 5 | ErrorToolTip.AddToDictionary=Add to dictionary 6 | ErrorToolTip.IgnoreWord=Ignore ''{0}'' for this session 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_ar.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=\u062a\u0647\u062c\u0626\u0629 \u0627\u0644\u0643\u0644\u0645\u0629 \u063a\u064a\u0631 \u0635\u062d\u064a\u062d\u0629: {0} 2 | None=None 3 | ErrorToolTip.DescHtml= \u062a\u0647\u062c\u0626\u0629 \u0627\u0644\u0643\u0644\u0645\u0629 \u063a\u064a\u0631 \u0635\u062d\u064a\u062d\u0629: {0} 4 | ErrorToolTip.SuggestionsHtml= \u0627\u0644\u0625\u0642\u062a\u0631\u0627\u062d\u0627\u062a: 5 | ErrorToolTip.AddToDictionary=\u0623\u0636\u0641 \u0625\u0644\u0649 \u0627\u0644\u0642\u0627\u0645\u0648\u0633 6 | ErrorToolTip.IgnoreWord=\u062a\u062c\u0627\u0647\u0644 ''{0}'' \u0645\u0646 \u0623\u062c\u0644 \u062c\u0644\u0633\u0629 \u0627\u0644\u0639\u0645\u0644 \u0627\u0644\u062d\u0627\u0644\u064a\u0629 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_de.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=Falsch geschriebenes Wort: {0} 2 | None=Keine 3 | ErrorToolTip.DescHtml= Falsch geschriebenes Wort: {0} 4 | ErrorToolTip.SuggestionsHtml= Vorschl\u00e4ge: 5 | ErrorToolTip.AddToDictionary=Zum W\u00f6rterbuch hinzuf\u00fcgen 6 | ErrorToolTip.IgnoreWord=Ignoriere ''{0}'' f\u00fcr diese Sitzung 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_es.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=Palabra incorrectamente escrita: {0} 2 | None=Nada 3 | ErrorToolTip.DescHtml= Palabra incorrectamente escrita: {0} 4 | ErrorToolTip.SuggestionsHtml= Sugerencias: 5 | ErrorToolTip.AddToDictionary=Agregar al diccionario 6 | ErrorToolTip.IgnoreWord=Ignorar ''{0}'' para esta sesi\u00f3n 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_fr.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=Mot mal orthographi\u00e9: {0} 2 | None=Aucun 3 | ErrorToolTip.DescHtml= Mot mal orthographi\u00e9: {0} 4 | ErrorToolTip.SuggestionsHtml= Suggestions: 5 | ErrorToolTip.AddToDictionary=Ajouter au dictionnaire 6 | ErrorToolTip.IgnoreWord=Ignorer ''{0}'' pour cette session 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_hu.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=Helytelen\u00fcl \u00edrt sz\u00f3: {0} 2 | None=Nincs 3 | ErrorToolTip.DescHtml= Helytelen\u00fcl \u00edrt sz\u00f3: {0} 4 | ErrorToolTip.SuggestionsHtml= Javaslatok: 5 | ErrorToolTip.AddToDictionary=Hozz\u00e1ad\u00e1s a sz\u00f3t\u00e1rhoz 6 | ErrorToolTip.IgnoreWord=A(z) ''{0}'' figyelmen k\u00edv\u00fcl hagy\u00e1sa enn\u00e9l a munkamenetn\u00e9l 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_in.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=Incorrectly spelled word: {0} 2 | None=None 3 | ErrorToolTip.DescHtml= Incorrectly spelled word: {0} 4 | ErrorToolTip.SuggestionsHtml= Suggestions: 5 | ErrorToolTip.AddToDictionary=Add to dictionary 6 | ErrorToolTip.IgnoreWord=Ignore ''{0}'' for this session 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_it.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=Parola incorretta: {0} 2 | None=Nessuno 3 | ErrorToolTip.DescHtml= Parola incorretta: {0} 4 | ErrorToolTip.SuggestionsHtml= Suggerimenti: 5 | ErrorToolTip.AddToDictionary=Aggiungi al dizionario 6 | ErrorToolTip.IgnoreWord=Ignora ''{0}'' per questa sessione 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_ja.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=\u5165\u529b\u30a8\u30e9\u30fc: {0} 2 | None=\u7121\u3057 3 | ErrorToolTip.DescHtml= \u5165\u529b\u30a8\u30e9\u30fc: {0} 4 | ErrorToolTip.SuggestionsHtml= \u304a\u52e7\u3081: 5 | ErrorToolTip.AddToDictionary=\u8f9e\u66f8\u306b\u8ffd\u52a0 6 | ErrorToolTip.IgnoreWord=\u3053\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u3067''{0}''\u3092\u7121\u8996\u3057\u307e\u3059\u3002 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_ko.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=\ucca0\uc790 \ud2c0\ub9b0 \ub2e8\uc5b4: {0} 2 | None=\uc5c6\uc74c 3 | ErrorToolTip.DescHtml= \ucca0\uc790 \ud2c0\ub9b0 \ub2e8\uc5b4: {0} 4 | ErrorToolTip.SuggestionsHtml= \ucd94\ucc9c: 5 | ErrorToolTip.AddToDictionary=\ub514\ub809\ud1a0\ub9ac\uc5d0 \ucd94\uac00 6 | ErrorToolTip.IgnoreWord=\uc774 \uc138\uc158\uc5d0\uc11c ''{0}'' \ubb34\uc2dc 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_nl.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=Incorrectly spelled word: {0} 2 | None=None 3 | ErrorToolTip.DescHtml= Incorrectly spelled word: {0} 4 | ErrorToolTip.SuggestionsHtml= Suggestions: 5 | ErrorToolTip.AddToDictionary=Add to dictionary 6 | ErrorToolTip.IgnoreWord=Ignore ''{0}'' for this session 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_pl.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=\u0179le zapisane s\u0142owo: {0} 2 | None=\u017baden 3 | ErrorToolTip.DescHtml= \u0179le zapisane s\u0142owo: {0} 4 | ErrorToolTip.SuggestionsHtml= Sugestie: 5 | ErrorToolTip.AddToDictionary=Dodaj do s\u0142ownika 6 | ErrorToolTip.IgnoreWord=Ignoruj ''{0}'' podczas tej sesji 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_pt_BR.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=Palavra digitada incorretament: {0} 2 | None=Nenhum 3 | ErrorToolTip.DescHtml= Palavra digitada incorretamente: {0} 4 | ErrorToolTip.SuggestionsHtml= Sugest\u00f5es: 5 | ErrorToolTip.AddToDictionary=Adicionar ao dicion\u00e1rio 6 | ErrorToolTip.IgnoreWord=Ignore ''{0}'' para esta sess\u00e3o 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_ru.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e: {0} 2 | None=\u041d\u0438 \u043e\u0434\u0438\u043d 3 | ErrorToolTip.DescHtml= \u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e: {0} 4 | ErrorToolTip.SuggestionsHtml= \u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f: 5 | ErrorToolTip.AddToDictionary=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c 6 | ErrorToolTip.IgnoreWord=\u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c ''{0}'' \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_tr.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=Yanl\u0131\u015f yaz\u0131lan kelime: {0} 2 | None=Hi\u00e7 3 | ErrorToolTip.DescHtml= Yanl\u0131\u015f yaz\u0131lan kelime: {0} 4 | ErrorToolTip.SuggestionsHtml= Tavsiyeler: 5 | ErrorToolTip.AddToDictionary=S\u00f6zl\u00fc\u011fe ekle 6 | ErrorToolTip.IgnoreWord=Bu oturum i\u00e7in ''{0}'' yoksay 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_zh_CN.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=\u4e0d\u6b63\u786e\u7684\u5355\u8bcd\u62fc\u5199: {0} 2 | None=\u65e0 3 | ErrorToolTip.DescHtml= \u4e0d\u6b63\u786e\u7684\u5355\u8bcd\u62fc\u5199: {0} 4 | ErrorToolTip.SuggestionsHtml= \u5efa\u8bae: 5 | ErrorToolTip.AddToDictionary=\u52a0\u5165\u5b57\u5178 6 | ErrorToolTip.IgnoreWord=\u5ffd\u7565''{0}'' \u4e8e\u6b64\u6b21\u6062\u590d\u4e2d 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/SpellingParser_zh_TW.properties: -------------------------------------------------------------------------------- 1 | IncorrectSpelling=Incorrectly spelled word: {0} 2 | None=None 3 | ErrorToolTip.DescHtml= Incorrectly spelled word: {0} 4 | ErrorToolTip.SuggestionsHtml= Suggestions: 5 | ErrorToolTip.AddToDictionary=Add to dictionary 6 | ErrorToolTip.IgnoreWord=Ignore ''{0}'' for this session 7 | -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobbylight/SpellChecker/b4a1b3238725d50ebfb39279e6860b1643163a48/SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/add.png -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobbylight/SpellChecker/b4a1b3238725d50ebfb39279e6860b1643163a48/SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/cross.png -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/lightbulb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobbylight/SpellChecker/b4a1b3238725d50ebfb39279e6860b1643163a48/SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/lightbulb.png -------------------------------------------------------------------------------- /SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/spellcheck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobbylight/SpellChecker/b4a1b3238725d50ebfb39279e6860b1643163a48/SpellChecker/src/main/resources/org/fife/ui/rsyntaxtextarea/spell/spellcheck.png -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/engine/ConfigurationTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.spell.engine; 2 | 3 | import org.junit.jupiter.api.AfterEach; 4 | import org.junit.jupiter.api.Assertions; 5 | import org.junit.jupiter.api.BeforeEach; 6 | import org.junit.jupiter.api.Test; 7 | 8 | /** 9 | * Unit tests for {@link Configuration}. 10 | */ 11 | class ConfigurationTest { 12 | 13 | private String origJazzyConfig; 14 | 15 | @BeforeEach 16 | void setUp() { 17 | origJazzyConfig = System.getProperty(Configuration.PROPERTY_CONFIG_OVERRIDE); 18 | } 19 | 20 | @AfterEach 21 | void tearDown() { 22 | if (origJazzyConfig != null) { 23 | System.setProperty(Configuration.PROPERTY_CONFIG_OVERRIDE, origJazzyConfig); 24 | } else { 25 | System.clearProperty(Configuration.PROPERTY_CONFIG_OVERRIDE); 26 | } 27 | } 28 | 29 | @Test 30 | void testGetConfiguration_zeroArg_null_defaultValue() { 31 | Configuration config = Configuration.getConfiguration(); 32 | Assertions.assertNotNull(config); 33 | } 34 | 35 | @Test 36 | void testGetConfiguration_zeroArg_fromSystemProperty_defined() { 37 | System.setProperty(Configuration.PROPERTY_CONFIG_OVERRIDE, 38 | "org.fife.com.swabunga.spell.engine.PropertyConfiguration"); 39 | Configuration config = Configuration.getConfiguration(); 40 | Assertions.assertNotNull(config); 41 | } 42 | 43 | @Test 44 | void testGetConfiguration_zeroArg_fromSystemProperty_emptyString_triggersDefaults() { 45 | System.setProperty(Configuration.PROPERTY_CONFIG_OVERRIDE, "no.such.ClassConfiguration"); 46 | Configuration config = Configuration.getConfiguration(); 47 | Assertions.assertNotNull(config); 48 | } 49 | 50 | @Test 51 | void testGetConfiguration_zeroArg_fromSystemProperty_notDefined_triggersDefaults() { 52 | System.setProperty(Configuration.PROPERTY_CONFIG_OVERRIDE, ""); 53 | Configuration config = Configuration.getConfiguration(); 54 | Assertions.assertNotNull(config); 55 | } 56 | 57 | @Test 58 | void testGetConfiguration_oneArg_emptyString_defaultValue() { 59 | Configuration config = Configuration.getConfiguration(""); 60 | Assertions.assertNotNull(config); 61 | } 62 | 63 | @Test 64 | void testGetConfiguration_oneArg_errorTriggersDefaults() { 65 | Configuration config = Configuration.getConfiguration("not/there"); 66 | Assertions.assertNotNull(config); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/engine/EditDistanceTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.spell.engine; 2 | 3 | import org.junit.jupiter.api.Assertions; 4 | import org.junit.jupiter.api.Test; 5 | 6 | /** 7 | * Unit tests for {@link EditDistance}. 8 | */ 9 | class EditDistanceTest { 10 | 11 | @Test 12 | void testGetDistance_identicalWords() { 13 | Assertions.assertEquals(0, EditDistance.getDistance("test", "test")); 14 | } 15 | 16 | @Test 17 | void testGetDistance_caseInsensitive_firstChar() { 18 | Assertions.assertEquals(EditDistance.CONFIG.getInteger(Configuration.COST_CHANGE_CASE), 19 | EditDistance.getDistance("test", "Test")); 20 | } 21 | 22 | @Test 23 | void testGetDistance_caseInsensitive_nonFirstChar() { 24 | Assertions.assertEquals(EditDistance.CONFIG.getInteger(Configuration.COST_CHANGE_CASE), 25 | EditDistance.getDistance("test", "tEst")); 26 | } 27 | 28 | @Test 29 | void testGetDistance_differentWords() { 30 | int expectedDistance = EditDistance.CONFIG.getInteger(Configuration.COST_SUBST_CHARS); 31 | Assertions.assertEquals(expectedDistance, EditDistance.getDistance("test", "tent")); 32 | } 33 | 34 | @Test 35 | void testGetDistance_swappedCharacters() { 36 | int expectedDistance = EditDistance.CONFIG.getInteger(Configuration.COST_SWAP_CHARS); 37 | Assertions.assertEquals(expectedDistance, EditDistance.getDistance("abcd", "abdc")); 38 | } 39 | 40 | @Test 41 | void testGetDistance_insertCharacter() { 42 | int expectedDistance = EditDistance.CONFIG.getInteger(Configuration.COST_INSERT_CHAR); 43 | Assertions.assertEquals(expectedDistance, EditDistance.getDistance("test", "tests")); 44 | } 45 | 46 | @Test 47 | void testGetDistance_deleteCharacter() { 48 | int expectedDistance = EditDistance.CONFIG.getInteger(Configuration.COST_REMOVE_CHAR); 49 | Assertions.assertEquals(expectedDistance, EditDistance.getDistance("tests", "test")); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/engine/GenericTransformatorTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.spell.engine; 2 | 3 | import org.junit.jupiter.api.Assertions; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import java.io.BufferedReader; 7 | import java.io.File; 8 | import java.io.FileReader; 9 | import java.io.IOException; 10 | import java.nio.file.Files; 11 | 12 | /** 13 | * Unit tests for {@link GenericTransformator}. 14 | */ 15 | class GenericTransformatorTest { 16 | 17 | private static final String TEMP_FILE_PREFIX = "scUnitTests_genericTransformator"; 18 | 19 | @Test 20 | void testConstructor_oneArg_file() throws IOException { 21 | File file = File.createTempFile(TEMP_FILE_PREFIX, ".txt"); 22 | file.deleteOnExit(); 23 | Assertions.assertDoesNotThrow(() -> new GenericTransformator(file)); 24 | } 25 | 26 | @Test 27 | void testConstructor_oneArg_Reader() throws IOException { 28 | File file = File.createTempFile(TEMP_FILE_PREFIX, ".txt"); 29 | file.deleteOnExit(); 30 | try (BufferedReader r = new BufferedReader(new FileReader(file))) { 31 | Assertions.assertDoesNotThrow(() -> new GenericTransformator(r)); 32 | } 33 | } 34 | 35 | @Test 36 | void testConstructor_twoArg() throws IOException { 37 | File file = File.createTempFile(TEMP_FILE_PREFIX, ".txt"); 38 | file.deleteOnExit(); 39 | Assertions.assertDoesNotThrow(() -> new GenericTransformator(file, "UTF-8")); 40 | } 41 | 42 | @Test 43 | void testTransform_noRules() throws IOException { 44 | File file = File.createTempFile(TEMP_FILE_PREFIX, ".txt"); 45 | file.deleteOnExit(); 46 | GenericTransformator transformator = new GenericTransformator(file); 47 | String input = "wonderful"; 48 | Assertions.assertEquals("WONDERFUL", transformator.transform(input)); 49 | } 50 | 51 | @Test 52 | void testTransform_noRules_digits() throws IOException { 53 | File file = File.createTempFile(TEMP_FILE_PREFIX, ".txt"); 54 | file.deleteOnExit(); 55 | GenericTransformator transformator = new GenericTransformator(file); 56 | String input = "foo0123456789bar"; 57 | Assertions.assertEquals("FOO0000000000BAR", transformator.transform(input)); 58 | } 59 | 60 | @Test 61 | void testTransform_rules() throws IOException { 62 | File file = File.createTempFile(TEMP_FILE_PREFIX, ".txt"); 63 | file.deleteOnExit(); 64 | Files.writeString(file.toPath(), "version 1\n" + 65 | "# Comments are ignored\n" + 66 | "collapse_result 1 # This comment is ignored\n" + 67 | "alphabet[abcdefghijklmnopqrstuvwxyz]\n" + 68 | "ENOUGH^$ *NF\n" + 69 | "SCH(EOU)- SK\n" + 70 | "SC(IEY)- SI\n" + 71 | "XXX _\n" 72 | ); 73 | 74 | GenericTransformator transformator = new GenericTransformator(file); 75 | Assertions.assertEquals("*NF", transformator.transform("enough")); 76 | Assertions.assertEquals("SKEDULE", transformator.transform("schedule")); 77 | Assertions.assertEquals("SIIENCE", transformator.transform("science")); 78 | Assertions.assertEquals("FOOBAR", transformator.transform("fooxxxbar")); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/engine/PropertyConfigurationTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.spell.engine; 2 | 3 | import org.junit.jupiter.api.BeforeEach; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import static org.junit.jupiter.api.Assertions.*; 7 | 8 | /** 9 | * Unit tests for {@link PropertyConfiguration}. 10 | */ 11 | class PropertyConfigurationTest { 12 | 13 | private PropertyConfiguration config; 14 | 15 | @BeforeEach 16 | void setUp() { 17 | config = new PropertyConfiguration(); 18 | } 19 | 20 | @Test 21 | void testGetBoolean() { 22 | assertTrue(config.getBoolean(Configuration.SPELL_IGNOREUPPERCASE)); 23 | assertFalse(config.getBoolean(Configuration.SPELL_IGNOREMIXEDCASE)); 24 | } 25 | 26 | @Test 27 | void testGetInteger() { 28 | assertEquals(95, config.getInteger(Configuration.COST_REMOVE_CHAR)); 29 | assertEquals(95, config.getInteger(Configuration.COST_INSERT_CHAR)); 30 | } 31 | 32 | @Test 33 | void testSetBoolean() { 34 | config.setBoolean(Configuration.SPELL_IGNOREUPPERCASE, false); 35 | assertFalse(config.getBoolean(Configuration.SPELL_IGNOREUPPERCASE)); 36 | 37 | config.setBoolean(Configuration.SPELL_IGNOREMIXEDCASE, true); 38 | assertTrue(config.getBoolean(Configuration.SPELL_IGNOREMIXEDCASE)); 39 | } 40 | 41 | @Test 42 | void testSetInteger() { 43 | config.setInteger(Configuration.COST_REMOVE_CHAR, 5); 44 | assertEquals(5, config.getInteger(Configuration.COST_REMOVE_CHAR)); 45 | 46 | config.setInteger(Configuration.COST_INSERT_CHAR, 10); 47 | assertEquals(10, config.getInteger(Configuration.COST_INSERT_CHAR)); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/engine/SpellDictionaryDichoDiskTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.spell.engine; 2 | 3 | import org.junit.jupiter.api.Assertions; 4 | import org.junit.jupiter.api.Test; 5 | import org.junit.jupiter.params.ParameterizedTest; 6 | import org.junit.jupiter.params.provider.NullSource; 7 | import org.junit.jupiter.params.provider.ValueSource; 8 | 9 | import java.io.File; 10 | import java.io.IOException; 11 | import java.nio.file.Files; 12 | import java.util.List; 13 | 14 | /** 15 | * Unit tests for {@link SpellDictionaryDichoDisk}. 16 | */ 17 | class SpellDictionaryDichoDiskTest { 18 | 19 | private SpellDictionaryDichoDisk dictionary; 20 | 21 | private static final String TEST_DIR_PREFIX = "scUnitTests_dichoDisk"; 22 | private static final String[] CONTENT = { 23 | "ARTFRK*aardvark", "APL*apple", "PT*bat", "KT*cat", "TK*dog", "ALPNT*elephant" 24 | }; 25 | 26 | /** 27 | * Utility method for test setup. 28 | */ 29 | private static SpellDictionaryDichoDisk createDictionary(String[] content, String encoding) throws IOException { 30 | File wordsFile = File.createTempFile(TEST_DIR_PREFIX, ".txt"); 31 | Files.writeString(wordsFile.toPath(), String.join("\n", content)); 32 | return new SpellDictionaryDichoDisk(wordsFile, encoding); 33 | } 34 | 35 | @Test 36 | void testConstructor_oneArg() throws IOException { 37 | File wordsFile = File.createTempFile(TEST_DIR_PREFIX, ".txt"); 38 | Files.writeString(wordsFile.toPath(), String.join("\n", CONTENT)); 39 | Assertions.assertDoesNotThrow(() -> 40 | dictionary = new SpellDictionaryDichoDisk(wordsFile) 41 | ); 42 | } 43 | 44 | @Test 45 | void testConstructor_twoArg_encoding() throws IOException { 46 | File wordsFile = File.createTempFile(TEST_DIR_PREFIX, ".txt"); 47 | Files.writeString(wordsFile.toPath(), String.join("\n", CONTENT)); 48 | Assertions.assertDoesNotThrow(() -> 49 | dictionary = new SpellDictionaryDichoDisk(wordsFile, "UTF-8") 50 | ); 51 | } 52 | 53 | @Test 54 | void testConstructor_twoArg_phoneticFile() throws IOException { 55 | File wordsFile = File.createTempFile(TEST_DIR_PREFIX, ".txt"); 56 | Files.writeString(wordsFile.toPath(), String.join("\n", CONTENT)); 57 | Assertions.assertDoesNotThrow(() -> 58 | dictionary = new SpellDictionaryDichoDisk(wordsFile, (File)null) 59 | ); 60 | } 61 | 62 | @Test 63 | void testConstructor_threeArg() throws IOException { 64 | File wordsFile = File.createTempFile(TEST_DIR_PREFIX, ".txt"); 65 | Files.writeString(wordsFile.toPath(), String.join("\n", CONTENT)); 66 | Assertions.assertDoesNotThrow(() -> 67 | dictionary = new SpellDictionaryDichoDisk(wordsFile, null, "UTF-8") 68 | ); 69 | } 70 | 71 | @ParameterizedTest 72 | @NullSource 73 | @ValueSource(strings = "UTF-8") 74 | void testAddWord(String encoding) throws IOException { 75 | SpellDictionaryDichoDisk dictionary = createDictionary(CONTENT, encoding); 76 | Assertions.assertFalse(dictionary.addWord("newword")); 77 | } 78 | 79 | @ParameterizedTest 80 | @NullSource 81 | @ValueSource(strings = "UTF-8") 82 | void testGetWords_existingWord(String encoding) throws IOException { 83 | SpellDictionaryDichoDisk dictionary = createDictionary(CONTENT, encoding); 84 | List words = dictionary.getWords(dictionary.getCode("dog")); 85 | Assertions.assertEquals(1, words.size()); 86 | Assertions.assertTrue(words.contains("dog")); 87 | } 88 | 89 | @ParameterizedTest 90 | @NullSource 91 | @ValueSource(strings = "UTF-8") 92 | void testGetWords_nonExistingWord(String encoding) throws IOException { 93 | SpellDictionaryDichoDisk dictionary = createDictionary(CONTENT, encoding); 94 | List words = dictionary.getWords(dictionary.getCode("nonexistent")); 95 | Assertions.assertTrue(words.isEmpty()); 96 | } 97 | 98 | @ParameterizedTest 99 | @NullSource 100 | @ValueSource(strings = "UTF-8") 101 | void testIsCorrect_correctWord(String encoding) throws IOException { 102 | SpellDictionaryDichoDisk dictionary = createDictionary(CONTENT, encoding); 103 | Assertions.assertTrue(dictionary.isCorrect("cat")); 104 | } 105 | 106 | @ParameterizedTest 107 | @NullSource 108 | @ValueSource(strings = "UTF-8") 109 | void testIsCorrect_correctWord_caseInsensitive(String encoding) throws IOException { 110 | SpellDictionaryDichoDisk dictionary = createDictionary(CONTENT, encoding); 111 | Assertions.assertTrue(dictionary.isCorrect("Cat")); 112 | } 113 | 114 | @ParameterizedTest 115 | @NullSource 116 | @ValueSource(strings = "UTF-8") 117 | void testIsCorrect_incorrectWord(String encoding) throws IOException { 118 | SpellDictionaryDichoDisk dictionary = createDictionary(CONTENT, encoding); 119 | Assertions.assertFalse(dictionary.isCorrect("wrongword")); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/engine/WordTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.spell.engine; 2 | 3 | import org.junit.jupiter.api.Assertions; 4 | import org.junit.jupiter.api.Test; 5 | 6 | /** 7 | * Unit tests for {@link Word}. 8 | */ 9 | class WordTest { 10 | 11 | @Test 12 | void testConstructor_zeroArg() { 13 | Word word = new Word(); 14 | Assertions.assertEquals("", word.getWord()); 15 | Assertions.assertEquals(0, word.getCost()); 16 | } 17 | 18 | @Test 19 | void testConstructor_twoArg() { 20 | Word word = new Word("foo", 5); 21 | Assertions.assertEquals("foo", word.getWord()); 22 | Assertions.assertEquals(5, word.getCost()); 23 | } 24 | 25 | @Test 26 | void testCompare_lessThan() { 27 | Word word1 = new Word("foo", 5); 28 | Word word2 = new Word("bar", 10); 29 | Assertions.assertEquals(-1, word1.compare(word1, word2)); 30 | } 31 | 32 | @Test 33 | void testCompare_greaterThan() { 34 | Word word1 = new Word("foo", 5); 35 | Word word2 = new Word("bar", 10); 36 | Assertions.assertEquals(1, word1.compare(word2, word1)); 37 | } 38 | 39 | @Test 40 | void testCompare_equal() { 41 | Word word1 = new Word("foo", 5); 42 | Word word2 = new Word("bar", 5); 43 | Assertions.assertEquals(0, word1.compare(word1, word2)); 44 | } 45 | 46 | @Test 47 | void testEquals_sameWord() { 48 | Word word1 = new Word("foo", 5); 49 | Word word2 = new Word("foo", 6); 50 | Assertions.assertTrue(word1.equals(word2)); 51 | } 52 | 53 | @Test 54 | void testEquals_differentWord() { 55 | Word word1 = new Word("foo", 5); 56 | Word word2 = new Word("bar", 5); 57 | Assertions.assertFalse(word1.equals(word2)); 58 | } 59 | 60 | @Test 61 | void testEquals_differentType() { 62 | Word word = new Word("foo", 5); 63 | Assertions.assertFalse(word.equals("foo")); 64 | } 65 | 66 | @Test 67 | void testGetSetWord() { 68 | Word word = new Word("foo", 5); 69 | Assertions.assertEquals("foo", word.getWord()); 70 | word.setWord("bar"); 71 | Assertions.assertEquals("bar", word.getWord()); 72 | } 73 | 74 | @Test 75 | void testGetHashCode() { 76 | Word word = new Word("foo", 5); 77 | Assertions.assertEquals("foo".hashCode(), word.hashCode()); 78 | } 79 | 80 | @Test 81 | void testToString() { 82 | Word word = new Word("foo", 5); 83 | Assertions.assertEquals("foo", word.toString()); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/engine/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is distributed under a modified BSD license. See the included 3 | * LICENSE.md file for details. 4 | */ 5 | /** 6 | * Tests for this package. 7 | */ 8 | package org.fife.com.swabunga.spell.engine; 9 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/event/AbstractWordFinderTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.spell.event; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.assertThrows; 6 | 7 | /** 8 | * Unit tests for {@link AbstractWordFinder}. 9 | */ 10 | class AbstractWordFinderTest { 11 | 12 | @Test 13 | void testCurrent_throwsIfNoCurrentWord() { 14 | assertThrows(WordNotFoundException.class, () -> 15 | new BrokenWordFinder().current() 16 | ); 17 | } 18 | 19 | @Test 20 | void testReplace_throwsIfNoCurrentWord() { 21 | assertThrows(WordNotFoundException.class, () -> 22 | new BrokenWordFinder().replace("foo") 23 | ); 24 | } 25 | 26 | @Test 27 | void testStartsSentence_throwsIfNoCurrentWord() { 28 | assertThrows(WordNotFoundException.class, () -> 29 | new BrokenWordFinder().startsSentence() 30 | ); 31 | } 32 | 33 | private static final class BrokenWordFinder extends AbstractWordFinder { 34 | 35 | @Override 36 | public Word next() { 37 | currentWord = nextWord = null; 38 | return null; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/event/BasicSpellCheckEventTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.spell.event; 2 | 3 | import org.junit.jupiter.api.BeforeEach; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import static org.junit.jupiter.api.Assertions.*; 7 | 8 | /** 9 | * Unit tests for {@link BasicSpellCheckEvent}. 10 | */ 11 | class BasicSpellCheckEventTest { 12 | 13 | private BasicSpellCheckEvent event; 14 | private String invalidWord; 15 | 16 | @BeforeEach 17 | void setUp() { 18 | invalidWord = "mispelled"; 19 | event = new BasicSpellCheckEvent(invalidWord, 0); 20 | } 21 | 22 | @Test 23 | void testConstructor_wordTokenizer() { 24 | assertDoesNotThrow(() -> { 25 | StringWordTokenizer tokenizer = new StringWordTokenizer("This"); 26 | tokenizer.nextWord(); 27 | new BasicSpellCheckEvent(invalidWord, tokenizer); 28 | }); 29 | } 30 | 31 | @Test 32 | void testGetInvalidWord() { 33 | assertEquals(invalidWord, event.getInvalidWord()); 34 | } 35 | 36 | @Test 37 | void testGetWordContext() { 38 | assertNull(event.getWordContext()); 39 | } 40 | 41 | @Test 42 | void testGetWordContextPosition() { 43 | assertEquals(0, event.getWordContextPosition()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/event/DefaultWordFinderTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.spell.event; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.junit.jupiter.api.BeforeEach; 5 | 6 | import static org.junit.jupiter.api.Assertions.*; 7 | 8 | /** 9 | * Unit tests for {@link DefaultWordFinder}. 10 | */ 11 | class DefaultWordFinderTest { 12 | 13 | private DefaultWordFinder wordFinder; 14 | 15 | @BeforeEach 16 | void setUp() { 17 | wordFinder = new DefaultWordFinder("This is a test."); 18 | } 19 | 20 | @Test 21 | void testCurrent() { 22 | Word next = wordFinder.next(); 23 | assertEquals(next, wordFinder.current()); 24 | } 25 | 26 | @Test 27 | void testGetText() { 28 | assertEquals("This is a test.", wordFinder.getText()); 29 | } 30 | 31 | @Test 32 | void testIsWordChar_asciiLettersAndNumbers() { 33 | for (int i = 'a'; i <= 'z'; i++) { 34 | wordFinder = new DefaultWordFinder(String.valueOf((char)i)); 35 | assertTrue(wordFinder.isWordChar(0)); 36 | } 37 | for (int i = 'A'; i <= 'Z'; i++) { 38 | wordFinder = new DefaultWordFinder(String.valueOf((char)i)); 39 | assertTrue(wordFinder.isWordChar(0)); 40 | } 41 | for (int i = '0'; i <= '9'; i++) { 42 | wordFinder = new DefaultWordFinder(String.valueOf((char)i)); 43 | assertTrue(wordFinder.isWordChar(0)); 44 | } 45 | } 46 | 47 | @Test 48 | void testIsWordChar_apostrophe() { 49 | // By itself, it is not a word char 50 | wordFinder = new DefaultWordFinder("'"); 51 | assertFalse(wordFinder.isWordChar(0)); 52 | 53 | // In a contraction (in between letters), it is 54 | wordFinder = new DefaultWordFinder("can't"); 55 | for (int i = 0; i < wordFinder.getText().length(); i++) { 56 | assertTrue(wordFinder.isWordChar(i)); 57 | } 58 | 59 | // At the end of input, it isn't 60 | wordFinder = new DefaultWordFinder("can'"); 61 | assertFalse(wordFinder.isWordChar(wordFinder.getText().length() - 1)); 62 | 63 | // If in between a letter and a non-word char, it isn't 64 | wordFinder = new DefaultWordFinder("can'#"); 65 | assertTrue(wordFinder.isWordChar(0)); 66 | assertTrue(wordFinder.isWordChar(1)); 67 | assertTrue(wordFinder.isWordChar(2)); 68 | assertFalse(wordFinder.isWordChar(3)); 69 | assertFalse(wordFinder.isWordChar(4)); 70 | } 71 | 72 | @Test 73 | void testIsWordChar_nonWordChar() { 74 | wordFinder = new DefaultWordFinder("#"); 75 | assertFalse(wordFinder.isWordChar(0)); 76 | } 77 | 78 | @Test 79 | void testNextWord_oneArgConstructor() { 80 | Word word = wordFinder.next(); 81 | assertEquals("This", word.getText()); 82 | assertEquals(0, word.getStart()); 83 | assertEquals(4, word.getEnd()); 84 | 85 | word = wordFinder.next(); 86 | assertEquals("is", word.getText()); 87 | assertEquals(5, word.getStart()); 88 | assertEquals(7, word.getEnd()); 89 | 90 | word = wordFinder.next(); 91 | assertEquals("a", word.getText()); 92 | assertEquals(8, word.getStart()); 93 | assertEquals(9, word.getEnd()); 94 | 95 | word = wordFinder.next(); 96 | assertEquals("test", word.getText()); 97 | assertEquals(10, word.getStart()); 98 | assertEquals(14, word.getEnd()); 99 | } 100 | 101 | @Test 102 | void testNextWord_zeroArgConstructor() { 103 | wordFinder = new DefaultWordFinder(); 104 | assertThrows(WordNotFoundException.class, wordFinder::next); 105 | } 106 | 107 | @Test 108 | void testNextWord_noMoreWords() { 109 | wordFinder.next(); // "This" 110 | wordFinder.next(); // "is" 111 | wordFinder.next(); // "a" 112 | wordFinder.next(); // "test" 113 | assertThrows(WordNotFoundException.class, () -> wordFinder.next()); 114 | } 115 | 116 | @Test 117 | void testNextWord_emptyString() { 118 | DefaultWordFinder emptyFinder = new DefaultWordFinder(""); 119 | assertThrows(WordNotFoundException.class, emptyFinder::next); 120 | } 121 | 122 | @Test 123 | void testNextWord_url_carriageReturn() { 124 | DefaultWordFinder finder = new DefaultWordFinder("https://google.com\r\nfoo"); 125 | Word word = finder.next(); 126 | assertEquals("https://google.com", word.getText()); 127 | assertEquals(0, word.getStart()); 128 | assertEquals(18, word.getEnd()); 129 | } 130 | 131 | @Test 132 | void testNextWord_url_endOfInput() { 133 | DefaultWordFinder finder = new DefaultWordFinder("https://google.com"); 134 | Word word = finder.next(); 135 | assertEquals("https://google.com", word.getText()); 136 | assertEquals(0, word.getStart()); 137 | assertEquals(18, word.getEnd()); 138 | } 139 | 140 | @Test 141 | void testNextWord_url_lineFeed() { 142 | DefaultWordFinder finder = new DefaultWordFinder("https://google.com\nfoo"); 143 | Word word = finder.next(); 144 | assertEquals("https://google.com", word.getText()); 145 | assertEquals(0, word.getStart()); 146 | assertEquals(18, word.getEnd()); 147 | } 148 | 149 | @Test 150 | void testNextWord_url_whitespace() { 151 | DefaultWordFinder finder = new DefaultWordFinder("https://google.com foo"); 152 | Word word = finder.next(); 153 | assertEquals("https://google.com", word.getText()); 154 | assertEquals(0, word.getStart()); 155 | assertEquals(18, word.getEnd()); 156 | } 157 | 158 | @Test 159 | void testNextWord_url_commaAndWhitespace() { 160 | DefaultWordFinder finder = new DefaultWordFinder("https://google.com, foo"); 161 | Word word = finder.next(); 162 | assertEquals("https://google.com", word.getText()); 163 | assertEquals(0, word.getStart()); 164 | assertEquals(18, word.getEnd()); 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/event/DocumentWordTokenizerTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.spell.event; 2 | 3 | import org.junit.jupiter.api.BeforeEach; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import javax.swing.text.BadLocationException; 7 | import javax.swing.text.PlainDocument; 8 | 9 | import static org.junit.jupiter.api.Assertions.*; 10 | 11 | /** 12 | * Unit tests for {@code DocumentWordTokenizer}. 13 | */ 14 | class DocumentWordTokenizerTest { 15 | 16 | private DocumentWordTokenizer tokenizer; 17 | private PlainDocument doc; 18 | 19 | @BeforeEach 20 | void setUp() throws BadLocationException { 21 | doc = new PlainDocument(); 22 | doc.insertString(0, "This is a test document.", null); 23 | tokenizer = new DocumentWordTokenizer(doc); 24 | } 25 | 26 | @Test 27 | void testGetCurrentWordCount() { 28 | assertEquals(0, tokenizer.getCurrentWordCount()); 29 | assertEquals("This", tokenizer.nextWord()); 30 | assertEquals(1, tokenizer.getCurrentWordCount()); 31 | assertEquals("is", tokenizer.nextWord()); 32 | assertEquals(2, tokenizer.getCurrentWordCount()); 33 | assertEquals("a", tokenizer.nextWord()); 34 | assertEquals(3, tokenizer.getCurrentWordCount()); 35 | assertEquals("test", tokenizer.nextWord()); 36 | assertEquals(4, tokenizer.getCurrentWordCount()); 37 | assertEquals("document", tokenizer.nextWord()); 38 | assertEquals(5, tokenizer.getCurrentWordCount()); 39 | } 40 | 41 | @Test 42 | void testHasMoreWords_emptyDocument() { 43 | doc = new PlainDocument(); 44 | tokenizer = new DocumentWordTokenizer(doc); 45 | assertFalse(tokenizer.hasMoreWords()); 46 | } 47 | 48 | @Test 49 | void testHasMoreWords_initialState() { 50 | assertTrue(tokenizer.hasMoreWords()); 51 | } 52 | 53 | @Test 54 | void testNextWord() { 55 | assertEquals("This", tokenizer.nextWord()); 56 | assertEquals("is", tokenizer.nextWord()); 57 | assertEquals("a", tokenizer.nextWord()); 58 | assertEquals("test", tokenizer.nextWord()); 59 | assertEquals("document", tokenizer.nextWord()); 60 | assertFalse(tokenizer.hasMoreWords()); 61 | } 62 | 63 | @Test 64 | void testNextWord_hyphenatedWord() throws BadLocationException { 65 | doc.replace(0, doc.getLength(), "mid-level", null); 66 | tokenizer = new DocumentWordTokenizer(doc); 67 | assertEquals("mid-level", tokenizer.nextWord()); 68 | assertFalse(tokenizer.hasMoreWords()); 69 | } 70 | 71 | @Test 72 | void testNextWord_apostrophe() throws BadLocationException { 73 | doc.replace(0, doc.getLength(), "doesn't", null); 74 | tokenizer = new DocumentWordTokenizer(doc); 75 | assertEquals("doesn't", tokenizer.nextWord()); 76 | assertFalse(tokenizer.hasMoreWords()); 77 | } 78 | 79 | @Test 80 | void testNextWord_apostrophe_thenEndOfFile() throws BadLocationException { 81 | doc.replace(0, doc.getLength(), "doesn'", null); 82 | tokenizer = new DocumentWordTokenizer(doc); 83 | assertEquals("doesn", tokenizer.nextWord()); 84 | assertFalse(tokenizer.hasMoreWords()); 85 | } 86 | 87 | @Test 88 | void testNextWord_apostrophe_thenNonWordChar() throws BadLocationException { 89 | doc.replace(0, doc.getLength(), "doesn'+", null); 90 | tokenizer = new DocumentWordTokenizer(doc); 91 | assertEquals("doesn", tokenizer.nextWord()); 92 | assertFalse(tokenizer.hasMoreWords()); 93 | } 94 | 95 | @Test 96 | void testHasMoreWords_afterIteration() { 97 | while (tokenizer.hasMoreWords()) { 98 | tokenizer.nextWord(); 99 | } 100 | assertFalse(tokenizer.hasMoreWords()); 101 | } 102 | 103 | @Test 104 | void testReplaceWord() throws BadLocationException { 105 | tokenizer.nextWord(); // Move to "This" 106 | tokenizer.replaceWord("That"); 107 | assertEquals("That is a test document.", doc.getText(0, doc.getLength())); 108 | } 109 | 110 | @Test 111 | void testGetContext() { 112 | tokenizer.nextWord(); 113 | assertEquals("This is a test document.", tokenizer.getContext()); 114 | } 115 | 116 | @Test 117 | void testGetCurrentWordPosition() { 118 | tokenizer.nextWord(); // Move to "This" 119 | assertEquals(0, tokenizer.getCurrentWordPosition()); 120 | } 121 | 122 | @Test 123 | void testGetCurrentWordEnd() { 124 | tokenizer.nextWord(); // Move to "This" 125 | assertEquals(4, tokenizer.getCurrentWordEnd()); 126 | } 127 | 128 | @Test 129 | void testIsNewSentence() { 130 | assertTrue(tokenizer.isNewSentence()); 131 | tokenizer.nextWord(); // Move to "This" 132 | tokenizer.nextWord(); // Move to "is" 133 | assertFalse(tokenizer.isNewSentence()); 134 | } 135 | 136 | @Test 137 | void testPosStartFullWordFrom_offset0() { 138 | tokenizer.posStartFullWordFrom(0); 139 | assertEquals("This", tokenizer.nextWord()); 140 | } 141 | 142 | @Test 143 | void testPosStartFullWordFrom_nonZeroOffset() { 144 | tokenizer.posStartFullWordFrom(12); 145 | assertEquals("test", tokenizer.nextWord()); 146 | } 147 | 148 | @Test 149 | void testPosStartFullWordFrom_apostrophe() throws BadLocationException { 150 | doc.replace(0, doc.getLength(), "foo doesn't bar", null); 151 | tokenizer = new DocumentWordTokenizer(doc); 152 | tokenizer.posStartFullWordFrom(10); 153 | assertEquals("doesn't", tokenizer.nextWord()); 154 | } 155 | 156 | @Test 157 | void testPosStartFullWordFrom_hyphen() throws BadLocationException { 158 | doc.replace(0, doc.getLength(), "foo mid-level bar", null); 159 | tokenizer = new DocumentWordTokenizer(doc); 160 | tokenizer.posStartFullWordFrom(11); 161 | assertEquals("mid-level", tokenizer.nextWord()); 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/event/StringWordTokenizerTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.spell.event; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.junit.jupiter.api.BeforeEach; 5 | 6 | import static org.junit.jupiter.api.Assertions.*; 7 | 8 | /** 9 | * Unit tests for {@link StringWordTokenizer}. 10 | */ 11 | class StringWordTokenizerTest { 12 | 13 | private StringWordTokenizer tokenizer; 14 | 15 | @BeforeEach 16 | void setUp() { 17 | tokenizer = new StringWordTokenizer("This is a test."); 18 | } 19 | 20 | @Test 21 | void testConstructor_withString() { 22 | assertNotNull(tokenizer); 23 | assertEquals("This is a test.", tokenizer.getContext()); 24 | } 25 | 26 | @Test 27 | void testConstructor_withWordFinder() { 28 | WordFinder finder = new DefaultWordFinder("Another test."); 29 | tokenizer = new StringWordTokenizer(finder); 30 | assertNotNull(tokenizer); 31 | assertEquals("Another test.", tokenizer.getContext()); 32 | } 33 | 34 | @Test 35 | void testConstructor_withStringAndWordFinder() { 36 | WordFinder finder = new DefaultWordFinder(); 37 | tokenizer = new StringWordTokenizer("Yet another test.", finder); 38 | assertNotNull(tokenizer); 39 | assertEquals("Yet another test.", tokenizer.getContext()); 40 | } 41 | 42 | @Test 43 | void testGetCurrentWordCount() { 44 | assertEquals(0, tokenizer.getCurrentWordCount()); 45 | tokenizer.nextWord(); 46 | assertEquals(1, tokenizer.getCurrentWordCount()); 47 | tokenizer.nextWord(); 48 | assertEquals(2, tokenizer.getCurrentWordCount()); 49 | } 50 | 51 | @Test 52 | void testGetCurrentWordEnd() { 53 | tokenizer.nextWord(); 54 | assertEquals("This".length(), tokenizer.getCurrentWordEnd()); 55 | } 56 | 57 | @Test 58 | void testGetCurrentWordEnd_errorIfNoWord() { 59 | assertThrows(WordNotFoundException.class, () -> tokenizer.getCurrentWordEnd()); 60 | } 61 | 62 | @Test 63 | void testGetCurrentWordPosition() { 64 | tokenizer.nextWord(); 65 | assertEquals(0, tokenizer.getCurrentWordPosition()); 66 | } 67 | 68 | @Test 69 | void testGetCurrentWordPosition_errorIfNoWord() { 70 | assertThrows(WordNotFoundException.class, () -> tokenizer.getCurrentWordPosition()); 71 | } 72 | 73 | @Test 74 | void testGetFinalText() { 75 | assertEquals("This is a test.", tokenizer.getFinalText()); 76 | } 77 | 78 | @Test 79 | void testGetWordEnd() { 80 | WordFinder finder = new DefaultWordFinder(); 81 | tokenizer = new StringWordTokenizer("Yet another test.", finder); 82 | assertNotNull(tokenizer); 83 | assertEquals("Yet another test.", tokenizer.getContext()); 84 | } 85 | 86 | @Test 87 | void testReplaceWord_beforeAnyWords() { 88 | tokenizer.replaceWord("That"); 89 | assertEquals("ThatThis is a test.", tokenizer.getContext()); 90 | } 91 | 92 | @Test 93 | void testReplaceWord_onFirstWord() { 94 | tokenizer.nextWord(); // We're initially before any word 95 | tokenizer.replaceWord("That"); 96 | assertEquals("That is a test.", tokenizer.getContext()); 97 | } 98 | 99 | @Test 100 | void testReplaceWord_noCurrentWord() { 101 | assertThrows(WordNotFoundException.class, () -> { 102 | WordFinder wordFinder = new DefaultWordFinder(); 103 | wordFinder.next(); 104 | tokenizer = new StringWordTokenizer(wordFinder); 105 | tokenizer.replaceWord("That"); 106 | }); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/event/WordNotFoundExceptionTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.spell.event; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.*; 6 | 7 | /** 8 | * Unit tests for {@link WordNotFoundException}. 9 | */ 10 | class WordNotFoundExceptionTest { 11 | 12 | @Test 13 | void testDefaultConstructor() { 14 | WordNotFoundException e = new WordNotFoundException(); 15 | assertNull(e.getMessage()); 16 | } 17 | 18 | @Test 19 | void testConstructorWithMessage() { 20 | String message = "Word not found"; 21 | WordNotFoundException e = new WordNotFoundException(message); 22 | assertEquals(message, e.getMessage()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/event/WordTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.spell.event; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.*; 6 | 7 | /** 8 | * Unit tests for {@link Word}. 9 | */ 10 | class WordTest { 11 | 12 | @Test 13 | void testConstructor() { 14 | Word word = new Word("test", 0); 15 | assertEquals("test", word.getText()); 16 | assertEquals(0, word.getStart()); 17 | assertEquals(4, word.getEnd()); 18 | } 19 | 20 | @Test 21 | void testCopyConstructor() { 22 | Word original = new Word("test", 0); 23 | Word copy = new Word(original); 24 | assertEquals("test", copy.getText()); 25 | assertEquals(0, copy.getStart()); 26 | assertEquals(4, copy.getEnd()); 27 | } 28 | 29 | @Test 30 | void testSetText() { 31 | Word word = new Word("test", 0); 32 | word.setText("example"); 33 | assertEquals("example", word.getText()); 34 | assertEquals(0, word.getStart()); 35 | assertEquals(7, word.getEnd()); 36 | } 37 | 38 | @Test 39 | void testSetStart() { 40 | Word word = new Word("test", 0); 41 | word.setStart(5); 42 | assertEquals(5, word.getStart()); 43 | assertEquals(9, word.getEnd()); 44 | } 45 | 46 | @Test 47 | void testLength() { 48 | Word word = new Word("test", 0); 49 | assertEquals(4, word.length()); 50 | } 51 | 52 | @Test 53 | void testToString() { 54 | Word word = new Word("test", 0); 55 | assertEquals("test", word.toString()); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/event/XMLWordFinderTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.spell.event; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.*; 6 | 7 | /** 8 | * Unit tests for {@code XMLWordFinder}. 9 | */ 10 | class XMLWordFinderTest { 11 | 12 | @Test 13 | void testCurrent() { 14 | String xml = "word"; 15 | XMLWordFinder finder = new XMLWordFinder(xml); 16 | Word next = finder.next(); 17 | assertEquals(next, finder.current()); 18 | } 19 | 20 | @Test 21 | void testFindWords_validXML() { 22 | String xml = "word"; 23 | XMLWordFinder finder = new XMLWordFinder(xml); 24 | Word next = finder.next(); 25 | assertEquals("word", next.getText()); 26 | assertEquals(15, next.getStart()); 27 | assertEquals(19, next.getEnd()); 28 | assertFalse(finder.hasNext()); 29 | } 30 | 31 | @Test 32 | void testFindWords_emptyXML() { 33 | String xml = ""; 34 | XMLWordFinder finder = new XMLWordFinder(xml); 35 | assertFalse(finder.hasNext()); 36 | } 37 | 38 | @Test 39 | void testFindWords_invalidXML() { 40 | String xml = "word"; 41 | XMLWordFinder finder = new XMLWordFinder(xml); 42 | Word next = finder.next(); 43 | assertEquals("word", next.getText()); 44 | assertEquals(15, next.getStart()); 45 | assertEquals(19, next.getEnd()); 46 | assertFalse(finder.hasNext()); 47 | } 48 | 49 | @Test 50 | void testFindWords_multipleWords() { 51 | String xml = "word1word2"; 52 | XMLWordFinder finder = new XMLWordFinder(xml); 53 | Word next = finder.next(); 54 | assertEquals("word1", next.getText()); 55 | assertEquals(15, next.getStart()); 56 | assertEquals(20, next.getEnd()); 57 | next = finder.next(); 58 | assertEquals("word2", next.getText()); 59 | assertEquals(39, next.getStart()); 60 | assertEquals(44, next.getEnd()); 61 | assertFalse(finder.hasNext()); 62 | } 63 | 64 | @Test 65 | void testFindWords_noWordsThrows() { 66 | String xml = ""; 67 | XMLWordFinder finder = new XMLWordFinder(xml); 68 | assertThrows(WordNotFoundException.class, finder::next); 69 | } 70 | 71 | @Test 72 | void testFindWords_wordAtEnd() { 73 | String xml = "word"; 74 | XMLWordFinder finder = new XMLWordFinder(xml); 75 | Word next = finder.next(); 76 | assertEquals("word", next.getText()); 77 | assertEquals(6, next.getStart()); 78 | assertEquals(10, next.getEnd()); 79 | } 80 | 81 | @Test 82 | void testGetText() { 83 | String xml = "This is a test."; 84 | XMLWordFinder finder = new XMLWordFinder(xml); 85 | assertEquals(xml, finder.getText()); 86 | } 87 | 88 | @Test 89 | void testIsWordChar_asciiLettersAndNumbers() { 90 | for (int i = 'a'; i <= 'z'; i++) { 91 | XMLWordFinder finder = new XMLWordFinder(String.valueOf((char)i)); 92 | assertTrue(finder.isWordChar(0)); 93 | } 94 | for (int i = 'A'; i <= 'Z'; i++) { 95 | XMLWordFinder finder = new XMLWordFinder(String.valueOf((char)i)); 96 | assertTrue(finder.isWordChar(0)); 97 | } 98 | for (int i = '0'; i <= '9'; i++) { 99 | XMLWordFinder finder = new XMLWordFinder(String.valueOf((char)i)); 100 | assertTrue(finder.isWordChar(0)); 101 | } 102 | } 103 | 104 | @Test 105 | void testIsWordChar_apostrophe() { 106 | // By itself, it is not a word char 107 | XMLWordFinder finder = new XMLWordFinder("'"); 108 | assertFalse(finder.isWordChar(0)); 109 | 110 | // In a contraction (in between letters), it is 111 | finder = new XMLWordFinder("can't"); 112 | for (int i = 0; i < finder.getText().length(); i++) { 113 | assertTrue(finder.isWordChar(i)); 114 | } 115 | 116 | // At the end of input, it isn't 117 | finder = new XMLWordFinder("can'"); 118 | assertFalse(finder.isWordChar(finder.getText().length() - 1)); 119 | 120 | // If in between a letter and a non-word char, it isn't 121 | finder = new XMLWordFinder("can'#"); 122 | assertTrue(finder.isWordChar(0)); 123 | assertTrue(finder.isWordChar(1)); 124 | assertTrue(finder.isWordChar(2)); 125 | assertFalse(finder.isWordChar(3)); 126 | assertFalse(finder.isWordChar(4)); 127 | } 128 | 129 | @Test 130 | void testIsWordChar_nonWordChar() { 131 | XMLWordFinder finder = new XMLWordFinder("#"); 132 | assertFalse(finder.isWordChar(0)); 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/spell/event/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is distributed under a modified BSD license. See the included 3 | * LICENSE.md file for details. 4 | */ 5 | /** 6 | * Tests for this package. 7 | */ 8 | package org.fife.com.swabunga.spell.event; 9 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/util/ListUtilTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.com.swabunga.util; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import java.util.ArrayList; 6 | import java.util.Arrays; 7 | import java.util.List; 8 | 9 | import static org.junit.jupiter.api.Assertions.*; 10 | 11 | /** 12 | * Unit tests for {@link ListUtil}. 13 | */ 14 | class ListUtilTest { 15 | 16 | @Test 17 | void testAddAll() { 18 | List dest = new ArrayList<>(Arrays.asList("a", "b")); 19 | List src = Arrays.asList("b", "c", "d"); 20 | List result = ListUtil.addAllNoDuplicates(dest, src); 21 | assertEquals(Arrays.asList("a", "b", "c", "d"), result); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/com/swabunga/util/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is distributed under a modified BSD license. See the included 3 | * LICENSE.md file for details. 4 | */ 5 | /** 6 | * Tests for this package. 7 | */ 8 | package org.fife.com.swabunga.util; 9 | -------------------------------------------------------------------------------- /SpellChecker/src/test/java/org/fife/ui/rsyntaxtextarea/spell/DefaultSpellCheckableTokenIdentifierTest.java: -------------------------------------------------------------------------------- 1 | package org.fife.ui.rsyntaxtextarea.spell; 2 | 3 | import org.fife.ui.rsyntaxtextarea.*; 4 | import org.junit.jupiter.api.BeforeEach; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.*; 8 | 9 | /** 10 | * Unit tests for {@link DefaultSpellCheckableTokenIdentifier}. 11 | */ 12 | public class DefaultSpellCheckableTokenIdentifierTest { 13 | 14 | private DefaultSpellCheckableTokenIdentifier identifier; 15 | 16 | private static Token createToken(String text, int type) { 17 | char[] chars = text.toCharArray(); 18 | return new TokenImpl(chars, 0, chars.length, 0, type, 0); 19 | } 20 | 21 | @BeforeEach 22 | void setUp() { 23 | identifier = new DefaultSpellCheckableTokenIdentifier(); 24 | } 25 | 26 | @Test 27 | void testBegin() { 28 | identifier.begin(); 29 | // No state to verify, just ensure no exceptions are thrown 30 | } 31 | 32 | @Test 33 | void testEnd() { 34 | identifier.end(); 35 | // No state to verify, just ensure no exceptions are thrown 36 | } 37 | 38 | @Test 39 | void testIsSpellCheckable_docComment() { 40 | Token token = createToken("/** foo */", TokenTypes.COMMENT_DOCUMENTATION); 41 | assertTrue(identifier.isSpellCheckable(token)); 42 | } 43 | 44 | @Test 45 | void testIsSpellCheckable_eolComment() { 46 | Token token = createToken("// hello world", TokenTypes.COMMENT_EOL); 47 | assertTrue(identifier.isSpellCheckable(token)); 48 | } 49 | 50 | @Test 51 | void testIsSpellCheckable_multiLineComment() { 52 | Token token = createToken("/* foo */", TokenTypes.COMMENT_MULTILINE); 53 | assertTrue(identifier.isSpellCheckable(token)); 54 | } 55 | 56 | @Test 57 | void testIsSpellCheckable_commentMarkup() { 58 | Token token = createToken("
", TokenTypes.COMMENT_MARKUP);
59 |         assertFalse(identifier.isSpellCheckable(token));
60 |     }
61 | 
62 |     @Test
63 |     void testIsSpellCheckable_nonCommentToken() {
64 |         Token token = createToken("foo", TokenTypes.IDENTIFIER);
65 |         assertFalse(identifier.isSpellCheckable(token));
66 |     }
67 | }
68 | 


--------------------------------------------------------------------------------
/SpellChecker/src/test/java/org/fife/ui/rsyntaxtextarea/spell/SpellingErrorTooltipHtmlGeneratorTest.java:
--------------------------------------------------------------------------------
  1 | package org.fife.ui.rsyntaxtextarea.spell;
  2 | 
  3 | import org.fife.com.swabunga.spell.engine.SpellDictionary;
  4 | import org.fife.com.swabunga.spell.engine.SpellDictionaryHashMap;
  5 | import org.fife.com.swabunga.spell.event.SpellChecker;
  6 | import org.junit.jupiter.api.Assertions;
  7 | import org.junit.jupiter.api.BeforeEach;
  8 | import org.junit.jupiter.api.Test;
  9 | 
 10 | import java.io.IOException;
 11 | import java.util.Locale;
 12 | 
 13 | /**
 14 |  * Unit tests for {@link SpellingErrorTooltipHtmlGenerator}.
 15 |  */
 16 | class SpellingErrorTooltipHtmlGeneratorTest {
 17 | 
 18 |     private SpellDictionary dictionary;
 19 |     private SpellChecker sc;
 20 |     private SpellingParser parser;
 21 | 
 22 |     @BeforeEach
 23 |     void setUp() throws IOException {
 24 |         dictionary = new SpellDictionaryHashMap();
 25 |         sc = new SpellChecker(dictionary);
 26 |         parser = new SpellingParser(dictionary);
 27 |     }
 28 | 
 29 |     @Test
 30 |     void testGet_evenSuggestionCount() {
 31 |         dictionary.addWord("misspelled");
 32 |         dictionary.addWord("dispelled");
 33 |         SpellingParserNotice notice = new SpellingParserNotice(parser, "msg", 0, 4, "mispelled", sc);
 34 | 
 35 |         String html = new SpellingErrorTooltipHtmlGenerator().get(sc, notice);
 36 | 
 37 |         Assertions.assertTrue(html.contains("Incorrectly spelled word:"));
 38 |         Assertions.assertTrue(html.contains("mispelled"));
 39 |         Assertions.assertTrue(html.contains("Suggestions:"));
 40 |         Assertions.assertTrue(html.contains("misspelled"));
 41 |         Assertions.assertTrue(html.contains("dispelled"));
 42 |         Assertions.assertTrue(html.contains("Add to dictionary"));
 43 |         Assertions.assertTrue(html.contains("Ignore 'mispelled' for this session"));
 44 |     }
 45 | 
 46 |     @Test
 47 |     void testGet_noSuggestions() {
 48 |         SpellingParserNotice notice = new SpellingParserNotice(parser, "msg", 0, 4, "mispelled", sc);
 49 | 
 50 |         String html = new SpellingErrorTooltipHtmlGenerator().get(sc, notice);
 51 | 
 52 |         Assertions.assertTrue(html.contains("Incorrectly spelled word:"));
 53 |         Assertions.assertTrue(html.contains("mispelled"));
 54 |         Assertions.assertTrue(html.contains("Suggestions:"));
 55 |         Assertions.assertTrue(html.contains("None"));
 56 |         Assertions.assertTrue(html.contains("Add to dictionary"));
 57 |         Assertions.assertTrue(html.contains("Ignore 'mispelled' for this session"));
 58 |     }
 59 | 
 60 |     @Test
 61 |     void testGet_oddSuggestionCount() {
 62 |         dictionary.addWord("misspelled");
 63 |         SpellingParserNotice notice = new SpellingParserNotice(parser, "msg", 0, 4, "mispelled", sc);
 64 | 
 65 |         String html = new SpellingErrorTooltipHtmlGenerator().get(sc, notice);
 66 | 
 67 |         Assertions.assertTrue(html.contains("Incorrectly spelled word:"));
 68 |         Assertions.assertTrue(html.contains("mispelled"));
 69 |         Assertions.assertTrue(html.contains("Suggestions:"));
 70 |         Assertions.assertTrue(html.contains("misspelled"));
 71 |         Assertions.assertTrue(html.contains("Add to dictionary"));
 72 |         Assertions.assertTrue(html.contains("Ignore 'mispelled' for this session"));
 73 |     }
 74 | 
 75 |     @Test
 76 |     void testGet_options_disallowAdd() {
 77 |         dictionary.addWord("misspelled");
 78 |         dictionary.addWord("dispelled");
 79 |         SpellingParserNotice notice = new SpellingParserNotice(parser, "msg", 0, 4, "mispelled", sc);
 80 |         parser.setAllowAdd(false);
 81 | 
 82 |         String html = new SpellingErrorTooltipHtmlGenerator().get(sc, notice);
 83 | 
 84 |         Assertions.assertFalse(html.contains("Add to dictionary"));
 85 |     }
 86 | 
 87 |     @Test
 88 |     void testGet_options_disallowIgnore() {
 89 |         dictionary.addWord("misspelled");
 90 |         dictionary.addWord("dispelled");
 91 |         SpellingParserNotice notice = new SpellingParserNotice(parser, "msg", 0, 4, "mispelled", sc);
 92 |         parser.setAllowIgnore(false);
 93 | 
 94 |         String html = new SpellingErrorTooltipHtmlGenerator().get(sc, notice);
 95 | 
 96 |         Assertions.assertFalse(html.contains("Ignore 'mispelled' for this session"));
 97 |     }
 98 | 
 99 |     @Test
100 |     void testGet_rtl() {
101 |         Locale origDefault = Locale.getDefault();
102 |         try {
103 |             Locale.setDefault(Locale.CHINA);
104 |             SpellingParserNotice notice = new SpellingParserNotice(parser, "msg", 0, 4, "mispelled", sc);
105 |             String html = new SpellingErrorTooltipHtmlGenerator().get(sc, notice);
106 |             Assertions.assertFalse(html.contains("dir=\"rtl\""));
107 |         } finally {
108 |             Locale.setDefault(origDefault);
109 |         }
110 |     }
111 | }
112 | 


--------------------------------------------------------------------------------
/SpellChecker/src/test/java/org/fife/ui/rsyntaxtextarea/spell/SpellingParserNoticeTest.java:
--------------------------------------------------------------------------------
 1 | /*
 2 |  * This library is distributed under the LGPL.  See the included
 3 |  * LICENSE.md file for details.
 4 |  */
 5 | package org.fife.ui.rsyntaxtextarea.spell;
 6 | 
 7 | import org.fife.com.swabunga.spell.engine.SpellDictionaryHashMap;
 8 | import org.fife.com.swabunga.spell.event.SpellChecker;
 9 | import org.junit.jupiter.api.BeforeEach;
10 | import org.junit.jupiter.api.Test;
11 | 
12 | import java.io.IOException;
13 | 
14 | import static org.junit.jupiter.api.Assertions.*;
15 | 
16 | /**
17 |  * Unit tests for {@link SpellingParserNotice}.
18 |  */
19 | class SpellingParserNoticeTest {
20 | 
21 |     private SpellingParser parser;
22 |     private SpellChecker sc;
23 | 
24 |     @BeforeEach
25 |     void setUp() throws IOException {
26 |         SpellDictionaryHashMap dictionary = new SpellDictionaryHashMap();
27 |         parser = new SpellingParser(dictionary);
28 |         sc = new SpellChecker(dictionary);
29 |     }
30 | 
31 |     @Test
32 |     void testConstructor() {
33 |         assertDoesNotThrow(() -> new SpellingParserNotice(parser, "msg", 0, 4, "word", sc));
34 |     }
35 | 
36 |     @Test
37 |     void testGetColor() {
38 |         SpellingParserNotice notice = new SpellingParserNotice(parser, "msg", 0, 4, "word", sc);
39 |         assertNotNull(notice.getColor());
40 |     }
41 | 
42 |     @Test
43 |     void testGetToolTipText() {
44 |         SpellingParserNotice notice = new SpellingParserNotice(parser, "msg", 0, 4, "word", sc);
45 |         assertNotNull(notice.getToolTipText());
46 |     }
47 | 
48 |     @Test
49 |     void testGetWord() {
50 |         SpellingParserNotice notice = new SpellingParserNotice(parser, "msg", 0, 4, "word", sc);
51 |         assertEquals("word", notice.getWord());
52 |     }
53 | 
54 |     @Test
55 |     void testToString() {
56 |         SpellingParserNotice notice = new SpellingParserNotice(parser, "msg", 0, 4, "word", sc);
57 |         assertEquals("[SpellingParserNotice: word]", notice.toString());
58 |     }
59 | 
60 |     @Test
61 |     void testSpellingParserNoticeEquality() {
62 |         SpellingParserNotice notice1 = new SpellingParserNotice(parser, "msg", 0, 4, "word", sc);
63 |         SpellingParserNotice notice2 = new SpellingParserNotice(parser, "msg", 0, 4, "word", sc);
64 |         assertEquals(notice1, notice2);
65 |     }
66 | 
67 |     @Test
68 |     void testSpellingParserNoticeInequality() {
69 |         SpellingParserNotice notice1 = new SpellingParserNotice(parser, "msg", 0, 4, "word", sc);
70 |         SpellingParserNotice notice2 = new SpellingParserNotice(parser, "msg", 1, 4, "word", sc);
71 |         assertNotEquals(notice1, notice2);
72 |     }
73 | 
74 | }
75 | 


--------------------------------------------------------------------------------
/SpellChecker/src/test/java/org/fife/ui/rsyntaxtextarea/spell/event/SpellingParserEventTest.java:
--------------------------------------------------------------------------------
 1 | package org.fife.ui.rsyntaxtextarea.spell.event;
 2 | 
 3 | import org.fife.com.swabunga.spell.engine.SpellDictionaryHashMap;
 4 | import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
 5 | import org.fife.ui.rsyntaxtextarea.spell.SpellingParser;
 6 | import org.junit.jupiter.api.BeforeEach;
 7 | import org.junit.jupiter.api.Test;
 8 | 
 9 | import java.io.IOException;
10 | 
11 | import static org.junit.jupiter.api.Assertions.*;
12 | 
13 | /**
14 |  * Unit tests for {@code SpellingParserEvent}.
15 |  */
16 | public class SpellingParserEventTest {
17 | 
18 |     private SpellingParser parser;
19 |     private RSyntaxTextArea textArea;
20 | 
21 |     @BeforeEach
22 |     void setUp() throws IOException {
23 |         parser = new SpellingParser(new SpellDictionaryHashMap());
24 |         textArea = new RSyntaxTextArea();
25 |     }
26 | 
27 |     @Test
28 |     void testConstructor_wordAdded() {
29 |         SpellingParserEvent e = new SpellingParserEvent(parser, textArea, SpellingParserEvent.WORD_ADDED, "test");
30 |         assertNotNull(e);
31 |     }
32 | 
33 |     @Test
34 |     void testConstructor_wordIgnored() {
35 |         SpellingParserEvent e = new SpellingParserEvent(parser, textArea, SpellingParserEvent.WORD_IGNORED, "test");
36 |         assertNotNull(e);
37 |     }
38 | 
39 |     @Test
40 |     void testConstructor_error_invalidEventType() {
41 |         assertThrows(IllegalArgumentException.class, () -> new SpellingParserEvent(parser, textArea, -1, "test"));
42 |     }
43 | 
44 |     @Test
45 |     void testGetParser() {
46 |         SpellingParserEvent e = new SpellingParserEvent(parser, textArea, SpellingParserEvent.WORD_ADDED, "test");
47 |         assertEquals(parser, e.getParser());
48 |     }
49 | 
50 |     @Test
51 |     void testGetTextArea() {
52 |         SpellingParserEvent e = new SpellingParserEvent(parser, textArea, SpellingParserEvent.WORD_ADDED, "test");
53 |         assertEquals(textArea, e.getTextArea());
54 |     }
55 | 
56 |     @Test
57 |     void testGetType() {
58 |         SpellingParserEvent e = new SpellingParserEvent(parser, textArea, SpellingParserEvent.WORD_ADDED, "test");
59 |         assertEquals(SpellingParserEvent.WORD_ADDED, e.getType());
60 |     }
61 | 
62 |     @Test
63 |     void testGetWord() {
64 |         SpellingParserEvent e = new SpellingParserEvent(parser, textArea, SpellingParserEvent.WORD_ADDED, "test");
65 |         assertEquals("test", e.getWord());
66 |     }
67 | }
68 | 


--------------------------------------------------------------------------------
/SpellChecker/src/test/java/org/fife/ui/rsyntaxtextarea/spell/event/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 |  * This library is distributed under a modified BSD license.  See the included
3 |  * LICENSE.md file for details.
4 |  */
5 | /**
6 |  * Tests for this package.
7 |  */
8 | package org.fife.ui.rsyntaxtextarea.spell.event;
9 | 


--------------------------------------------------------------------------------
/SpellChecker/src/test/java/org/fife/ui/rsyntaxtextarea/spell/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 |  * This library is distributed under a modified BSD license.  See the included
3 |  * LICENSE.md file for details.
4 |  */
5 | /**
6 |  * Tests for this package.
7 |  */
8 | package org.fife.ui.rsyntaxtextarea.spell;
9 | 


--------------------------------------------------------------------------------
/SpellCheckerDemo/README.md:
--------------------------------------------------------------------------------
1 | # SpellCheckerDemo
2 | A demo application showing off some features of the SpellChecker library.
3 | 


--------------------------------------------------------------------------------
/SpellCheckerDemo/build.gradle:
--------------------------------------------------------------------------------
 1 | plugins {
 2 |     id 'base'
 3 | }
 4 | 
 5 | base {
 6 |     archivesName = 'spellcheckerdemo'
 7 | }
 8 | 
 9 | dependencies {
10 |     implementation project(':SpellChecker')
11 | }
12 | 
13 | jar {
14 |     manifest {
15 |         attributes('Class-Path': 'rsyntaxtextarea.jar',
16 |                 'Specification-Title': 'SpellCheckerDemo',
17 |                 'Specification-Version': archiveVersion,
18 |                 'Implementation-Title': 'org.fife.ui',
19 |                 'Implementation-Version': archiveVersion,
20 |                 'Main-Class': 'org.fife.rsta.ui.demo.RSTAUIDemoApp')
21 |     }
22 | }
23 | 


--------------------------------------------------------------------------------
/SpellCheckerDemo/src/main/java/org/fife/ui/rsyntaxtextarea/spell/demo/DemoRootPane.java:
--------------------------------------------------------------------------------
  1 | /*
  2 |  * 07/21/2009
  3 |  *
  4 |  * DemoRootPane.java - Root pane for the demo.
  5 |  *
  6 |  * This library is distributed under the LGPL.  See the included
  7 |  * LICENSE.md file for details.
  8 |  */
  9 | package org.fife.ui.rsyntaxtextarea.spell.demo;
 10 | 
 11 | import java.awt.*;
 12 | import java.awt.event.ActionEvent;
 13 | import java.io.BufferedReader;
 14 | import java.io.File;
 15 | import java.io.FileReader;
 16 | import java.io.IOException;
 17 | import java.io.InputStream;
 18 | import java.io.InputStreamReader;
 19 | import java.net.URL;
 20 | import javax.swing.*;
 21 | import javax.swing.event.*;
 22 | 
 23 | import org.fife.ui.rsyntaxtextarea.ErrorStrip;
 24 | import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
 25 | import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
 26 | import org.fife.ui.rsyntaxtextarea.TokenTypes;
 27 | import org.fife.ui.rsyntaxtextarea.spell.SpellingParser;
 28 | import org.fife.ui.rtextarea.RTextScrollPane;
 29 | 
 30 | 
 31 | /**
 32 |  * The root pane used by the demo.  This allows both the applet and the
 33 |  * stand-alone application to share the same UI.
 34 |  *
 35 |  * @author Robert Futrell
 36 |  * @version 1.0
 37 |  */
 38 | public class DemoRootPane extends JRootPane implements HyperlinkListener,
 39 | 											SyntaxConstants {
 40 | 
 41 |     private RSyntaxTextArea textArea;
 42 | 	private SpellingParser parser;
 43 | 	private ToggleSpellCheckingAction toggleAction;
 44 | 
 45 | 	private static final String INPUT_FILE	= "Input.java";
 46 | 
 47 | 
 48 | 	public DemoRootPane() {
 49 | 		textArea = createTextArea();
 50 |         RTextScrollPane scrollPane = new RTextScrollPane(textArea, true);
 51 | 		ErrorStrip es = new ErrorStrip(textArea);
 52 | 		JPanel temp = new JPanel(new BorderLayout());
 53 | 		temp.add(scrollPane);
 54 | 		temp.add(es, BorderLayout.LINE_END);
 55 | 		getContentPane().add(temp);
 56 | 		setJMenuBar(createMenuBar());
 57 | 
 58 | 	}
 59 | 
 60 | 
 61 | 	/**
 62 | 	 * Starts a thread to load the spell checker when the app is made visible,
 63 | 	 * since the dictionary is somewhat large (takes 0.9 seconds to load on
 64 | 	 * a 3.0 GHz Core 2 Duo).

65 | * This assumes the app will only be made visible once, which is certainly 66 | * true for our demo. 67 | */ 68 | @Override 69 | public void addNotify() { 70 | super.addNotify(); 71 | new Thread(() -> { 72 | parser = createSpellingParser(); 73 | if (parser!=null) { 74 | try { 75 | File userDict = File.createTempFile("spellDemo", ".txt"); 76 | parser.setUserDictionary(userDict); 77 | System.out.println("User dictionary: " + 78 | userDict.getAbsolutePath()); 79 | } catch (IOException | SecurityException e) { 80 | System.err.println("Can't open user dictionary: " + 81 | e.getMessage()); 82 | } 83 | 84 | SwingUtilities.invokeLater(() -> { 85 | textArea.addParser(parser); 86 | toggleAction.setEnabled(true); 87 | }); 88 | } 89 | }).start(); 90 | } 91 | 92 | 93 | private JMenuBar createMenuBar() { 94 | 95 | JMenuBar mb = new JMenuBar(); 96 | 97 | JMenu menu = new JMenu("Options"); 98 | toggleAction = new ToggleSpellCheckingAction(); 99 | toggleAction.setEnabled(false); 100 | JCheckBoxMenuItem cbItem = new JCheckBoxMenuItem(toggleAction); 101 | cbItem.setSelected(true); 102 | menu.add(cbItem); 103 | menu.addSeparator(); 104 | JMenuItem item = new JMenuItem(new AboutAction()); 105 | menu.add(item); 106 | mb.add(menu); 107 | 108 | return mb; 109 | 110 | } 111 | 112 | 113 | private SpellingParser createSpellingParser() { 114 | 115 | // Allow for different starting directories when running through an IDE 116 | File zip = new File("./SpellChecker/src/main/dist/english_dic.zip"); 117 | if (!zip.isFile()) { 118 | zip = new File("../SpellChecker/src/main/dist/english_dic.zip"); 119 | if (!zip.isFile()) { 120 | zip = new File("./SpellChecker/SpellChecker/src/main/dist/english_dic.zip"); 121 | } 122 | } 123 | 124 | try { 125 | return SpellingParser.createEnglishSpellingParser(zip, true); 126 | } catch (IOException ioe) { 127 | ioe.printStackTrace(); 128 | } 129 | return null; 130 | } 131 | 132 | 133 | private RSyntaxTextArea createTextArea() { 134 | RSyntaxTextArea textArea = new RSyntaxTextArea(25, 70); 135 | textArea.setSyntaxEditingStyle(SYNTAX_STYLE_JAVA); 136 | ClassLoader cl = getClass().getClassLoader(); 137 | InputStream in = cl.getResourceAsStream(INPUT_FILE); 138 | try { 139 | BufferedReader r; 140 | if (in!=null) { 141 | r = new BufferedReader(new InputStreamReader(in)); 142 | } 143 | else { 144 | r = new BufferedReader(new FileReader(INPUT_FILE)); 145 | } 146 | textArea.read(r, null); 147 | r.close(); 148 | } catch (IOException ioe) { 149 | textArea.setText("// Type Java source. Comments are spell checked."); 150 | } 151 | textArea.setCaretPosition(0); 152 | textArea.discardAllEdits(); 153 | textArea.addHyperlinkListener(this); 154 | textArea.requestFocusInWindow(); 155 | textArea.setMarkOccurrences(true); 156 | textArea.getSyntaxScheme().getStyle(TokenTypes.COMMENT_DOCUMENTATION).background = new Color(255, 240, 240); 157 | //textArea.setUseSelectedTextColor(true); 158 | //textArea.setSelectionColor(SystemColor.textHighlight); 159 | //textArea.setSelectedTextColor(SystemColor.textHighlightText); 160 | textArea.setLineWrap(true); 161 | textArea.setWrapStyleWord(true); 162 | return textArea; 163 | } 164 | 165 | 166 | @Override 167 | public void hyperlinkUpdate(HyperlinkEvent e) { 168 | if (e.getEventType()==HyperlinkEvent.EventType.ACTIVATED) { 169 | URL url = e.getURL(); 170 | if (url==null) { 171 | UIManager.getLookAndFeel().provideErrorFeedback(null); 172 | } 173 | else { 174 | JOptionPane.showMessageDialog(this, 175 | "URL clicked:\n" + url); 176 | } 177 | } 178 | } 179 | 180 | 181 | private class AboutAction extends AbstractAction { 182 | 183 | AboutAction() { 184 | putValue(NAME, "About Spell Checker..."); 185 | } 186 | 187 | @Override 188 | public void actionPerformed(ActionEvent e) { 189 | JOptionPane.showMessageDialog(DemoRootPane.this, 190 | "Spell Checker - An add-on for RSyntaxTextArea" + 191 | "
that does spell checking in code comments." + 192 | "
Version 3.0.3" + 193 | "
Licensed under the LGPL", 194 | "About Spell Checker", 195 | JOptionPane.INFORMATION_MESSAGE); 196 | } 197 | 198 | } 199 | 200 | 201 | private class ToggleSpellCheckingAction extends AbstractAction { 202 | 203 | private boolean enabled; 204 | 205 | ToggleSpellCheckingAction() { 206 | putValue(NAME, "Toggle Spell Checking"); 207 | enabled = true; 208 | } 209 | 210 | @Override 211 | public void actionPerformed(ActionEvent e) { 212 | enabled = !enabled; 213 | if (enabled) { 214 | textArea.addParser(parser); 215 | } 216 | else { 217 | textArea.removeParser(parser); 218 | } 219 | } 220 | 221 | } 222 | 223 | 224 | } 225 | -------------------------------------------------------------------------------- /SpellCheckerDemo/src/main/java/org/fife/ui/rsyntaxtextarea/spell/demo/SpellingParserDemo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 07/21/2009 3 | * 4 | * SpellingParserDemo.java - Demo of the spell-checker for RSyntaxTextArea. 5 | * 6 | * This library is distributed under the LGPL. See the included 7 | * LICENSE.md file for details. 8 | */ 9 | package org.fife.ui.rsyntaxtextarea.spell.demo; 10 | 11 | import javax.swing.*; 12 | 13 | 14 | /** 15 | * Demo application for the SpellingParser add-on to RSTA. 16 | * 17 | * @author Robert Futrell 18 | * @version 1.0 19 | */ 20 | public final class SpellingParserDemo extends JFrame { 21 | 22 | 23 | /** 24 | * Constructor. 25 | */ 26 | private SpellingParserDemo() { 27 | setRootPane(new DemoRootPane()); 28 | setTitle("Spelling Parser Demo"); 29 | setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); 30 | pack(); 31 | setLocationRelativeTo(null); 32 | } 33 | 34 | 35 | /** 36 | * Program entry point. 37 | * 38 | * @param args Command line arguments. 39 | */ 40 | public static void main(String[] args) { 41 | 42 | SwingUtilities.invokeLater(() -> { 43 | try { 44 | String laf = UIManager.getSystemLookAndFeelClassName(); 45 | //laf = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"; 46 | UIManager.setLookAndFeel(laf); 47 | } catch (RuntimeException re) { // FindBugs 48 | throw re; 49 | } catch (Exception e) { 50 | e.printStackTrace(); 51 | } 52 | new SpellingParserDemo().setVisible(true); 53 | }); 54 | 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /SpellCheckerDemo/src/main/java/org/fife/ui/rsyntaxtextarea/spell/demo/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is distributed under a modified BSD license. See the included 3 | * LICENSE.md file for details. 4 | */ 5 | /** 6 | * A demo application. 7 | */ 8 | package org.fife.ui.rsyntaxtextarea.spell.demo; 9 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | //plugins { 2 | // id 'com.github.spotbugs' version '5.0.12' 3 | //} 4 | 5 | // We require building with JDK 17 or later. Built artifact compatibility 6 | // is controlled by javaLanguageVersion 7 | assert JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17) 8 | 9 | group = 'com.fifesoft' 10 | // NOTE: Local Java 17: /Library/Java/JavaVirtualMachines/jdk-17.0.13+11/Contents/Home 11 | 12 | allprojects { 13 | 14 | repositories { 15 | mavenCentral() 16 | maven { 17 | url = 'https://oss.sonatype.org/content/repositories/snapshots' 18 | } 19 | } 20 | 21 | wrapper { 22 | gradleVersion = '8.13' 23 | } 24 | 25 | tasks.withType(Javadoc) { 26 | options.addStringOption('Xdoclint:none', '-quiet') 27 | } 28 | } 29 | 30 | subprojects { 31 | 32 | apply plugin: 'java' 33 | apply plugin: 'checkstyle' 34 | // apply plugin: 'com.github.spotbugs' 35 | 36 | test { 37 | useJUnitPlatform() 38 | } 39 | 40 | checkstyle { 41 | toolVersion = '10.21.4' 42 | configDirectory = file("$rootProject.projectDir/config/checkstyle") 43 | } 44 | 45 | // spotbugsMain { 46 | // reports { 47 | // html { 48 | // required = true 49 | // } 50 | // xml { 51 | // required = false 52 | // } 53 | // } 54 | // } 55 | // spotbugsTest { 56 | // reports { 57 | // html { 58 | // required = true 59 | // } 60 | // xml { 61 | // required = false 62 | // } 63 | // } 64 | // } 65 | 66 | compileJava { 67 | options.release = Integer.parseInt(javaLanguageVersion) 68 | options.debug = true 69 | options.debugOptions.debugLevel = 'source,vars,lines' 70 | options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked' 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /config/checkstyle/scSuppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Note that Maven- and signing-related properties are in /gradle.properties 2 | javaLanguageVersion=8 3 | version=3.4.1-SNAPSHOT 4 | 5 | # Ugh, see https://github.com/gradle/gradle/issues/11308 6 | systemProp.org.gradle.internal.publish.checksums.insecure=true 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobbylight/SpellChecker/b4a1b3238725d50ebfb39279e6860b1643163a48/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'SpellChecker' 2 | 3 | include 'SpellChecker', 'SpellCheckerDemo' 4 | --------------------------------------------------------------------------------