├── .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 |  3 |  4 |  5 | [](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 characterconfiguration.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 | *
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
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
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 This class is now immutable.
29 | *
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 | *
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 | * An interface for objects which take a String as input, and iterates through
24 | * the words in the string.
25 | *
28 | * When the object is instantiated, and before the first call to A call to 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 | *
29 | * When the object is instantiated, and before the first call to A call to
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 | "
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 | * 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 | *
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 | * 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 | * next()
is made,
29 | * the following methods should throw a WordNotFoundException
:
30 | * current()
,
31 | * startsSentence()
and replace()
.
32 | * next()
when hasMoreWords()
returns false
35 | * should throw a WordNotFoundException
.next()
is made,
30 | * the following methods should throw a WordNotFoundException
:
31 | * getCurrentWordEnd()
, getCurrentWordPosition()
,
32 | * isNewSentence()
and replaceWord()
.
33 | * next()
when hasMoreWords()
returns false
36 | * should throw a WordNotFoundException
.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
");
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("");
54 | for (int i = 0; i < suggestions.size(); i++) {
55 | if ((i % 2) == 0) {
56 | sb.append("
");
78 | sb.append("");
57 | }
58 | sb.append(" ");
72 | }
73 | }
74 | if ((suggestions.size() % 2) == 0) {
75 | 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(" ");
70 | if ((i & 1) == 1) {
71 | sb.append("");
76 | }
77 | 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 | *
21 | *
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", 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).
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 |