Skip to content

Commit

Permalink
Categorizing and bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
coledea committed Jul 25, 2018
1 parent ef0b2d1 commit 58f14d2
Show file tree
Hide file tree
Showing 73 changed files with 130 additions and 90 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
I am a user interface for handling spelling errors in whole texts.

Instance Variables
alternatives: <Array> The suggested alternatives for the current considered word
alternativeWords: <Array> The suggested alternatives for the current considered word
contextSentence: <String> The context sentence in which the current considered word is standing
inputText: <Text> The text which is checked for spelling errors
keyArray: <OrderedCollection> All the keys of 'wrongWords' in a collection for sorting and traversing them
parser: <SpellingTextParser> A parser for separating a text into its single words
parser: <SPCTextParser> A parser for separating a text into its single words
selectedAlternative: <String> The selected alternative for the current considered word
workspace: <Workspace> The workspace where the text to check is written in
wrongWords: <Dictionary> All the wrong words in the inputText stored in a dictionary as follows:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
displaying
clear

self inputText: '';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
select alternative
deselectAlternative

selectedAlternative := ''.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
displaying
dismissCurrentDisplayedWord

self inputText ifNotEmpty: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
displaying
displayCurrentWrongWord

| sentenceStart |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
parser: aParser
parser: aSPCParser

parser := aParser
parser := aSPCParser
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
select alternative
updateDictionaryAfter: index By: offset

| newAssociations |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
select alternative
updateKeyArrayAfter: index By: offset

self keyArray: (self keyArray collect: [:k |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
select alternative
updateWrongWordsAfter: index By: offset

self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"keyArray:" : "ow 7/14/2018 14:50",
"open" : "pz 5/29/2018 21:55:12",
"parser" : "ow 7/14/2018 14:35",
"parser:" : "ow 7/14/2018 14:35",
"parser:" : "ow 7/25/2018 20:15",
"replaceTextWithAlternative" : "RS 7/25/2018 16:32",
"selectedAlternative" : "RS 6/27/2018 15:19:24",
"selectedAlternative:" : "ow 7/23/2018 17:19",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"classvars" : [
],
"commentStamp" : "ow 7/21/2018 18:11",
"commentStamp" : "ow 7/25/2018 19:57",
"instvars" : [
"inputText",
"wrongWords",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
I style the texts in the SpellcheckCorrectionUI in that way that wrong written words are highlighted and the current considered word in the SpellcheckCorrectionUI is highlight even more.

Instance Variables
spellChecker: <SpellChecker> The spellchecker for getting all wrong words in a text
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"classvars" : [
],
"commentStamp" : "ow 7/21/2018 18:01",
"commentStamp" : "ow 7/25/2018 20:03",
"instvars" : [
],
"name" : "SPCCorrectionUIStyler",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ I am a user interface for managing (modifying and changing) the loaded dictionar
Instance Variables
selectedLanguage: <String> The currently selected language of the loaded dictionary
selectedWord: <String> The currently selected word of the words added to the dictionary by the user
spellchecker: <SPCSpellChecker> The current spellchecker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
constants
defaultDictionaryDirectoryPath

^ FileDirectory default directoryNamed: 'dictionaries'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
initialize-release
initialize

self registerInWorldMenu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
toolbuilder
open

^ ToolBuilder default open: self new
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
registering
registerInWorldMenu

TheWorldMenu registerOpenCommand: {'Dictionary Settings'. {self. #open}}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
registering
unregisterInWorldMenu

(TheWorldMenu respondsTo: #unregisterOpenCommand:)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
paths
affixFileName

^ (self selectedLanguageDirectoryPath fileNamesMatching: '*.aff') first
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
paths
affixPath

^ self selectedLanguageDirectoryPath fileNamed: self affixFileName
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
toolbuilder
buildWith: builder

| windowSpec ignoredWordsListSpec removeButtonSpec languageListSpec |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
paths
dictionaryFileName

^ (self selectedLanguageDirectoryPath fileNamesMatching: '*.dic') first
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
paths
dictionaryPath

^ self selectedLanguageDirectoryPath fileNamed: self dictionaryFileName
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
as yet unclassified
ignored words
ignoredWords

^ SPCSpellChecker instance addedWords asOrderedCollection
^ self spellchecker addedWords asOrderedCollection
sort: [:a :b | a asLowercase < b asLowercase]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
as yet unclassified
initialize-release
initialize

self spellchecker: SPCSpellChecker instance.
self selectUsedLanguage
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
as yet unclassified
dictionary loading
loadLanguage

SPCSpellChecker instance
self spellchecker
dictionaryPath: self dictionaryPath name;
affixPath: self affixPath name;
reloadHunspellHandle;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
dictionary loading
loadedLanguages

^ (FileDirectory default directoryNamed: 'dictionaries') directoryNames
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
toolbuilder
open

^ ToolBuilder default open: self
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
as yet unclassified
ignored words
removeFromIgnoredWords

self selectedWord ifNotNil:
[SPCSpellChecker instance removeWordFromDictionary: self selectedWord.
[self spellchecker removeWordFromDictionary: self selectedWord.
self changed: #ignoredWords]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
dictionary loading
selectUsedLanguage

self selectedLanguage: self usedLanguage
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
paths
selectedLanguageDirectoryPath

^ self class defaultDictionaryDirectoryPath directoryNamed: self selectedLanguage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
spellchecker: aSPCSpellChecker

spellchecker := aSPCSpellChecker
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
spellchecker

^ spellchecker
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ usedLanguage

| pathSegments indexOfLanguageName |

pathSegments := SPCSpellChecker instance dictionaryPath subStrings: FileDirectory slash.
pathSegments := self spellchecker dictionaryPath subStrings: FileDirectory slash.
indexOfLanguageName := pathSegments size -1.
^ pathSegments at: indexOfLanguageName
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@
"buildWith:" : "pz 7/25/2018 19:38",
"dictionaryFileName" : "ow 7/12/2018 16:53",
"dictionaryPath" : "ow 7/12/2018 17:03",
"ignoredWords" : "RS 7/25/2018 17:40",
"initialize" : "RS 7/22/2018 22:00",
"loadLanguage" : "II 7/25/2018 19:29",
"ignoredWords" : "ow 7/25/2018 20:12",
"initialize" : "ow 7/25/2018 20:12",
"loadLanguage" : "ow 7/25/2018 21:02",
"loadedLanguages" : "ow 7/12/2018 16:41",
"open" : "RS 7/22/2018 20:56",
"removeFromIgnoredWords" : "RS 7/25/2018 17:40",
"removeFromIgnoredWords" : "ow 7/25/2018 20:12",
"selectUsedLanguage" : "RS 7/22/2018 21:17",
"selectedLanguage" : "ow 7/12/2018 09:35",
"selectedLanguage:" : "II 7/25/2018 19:29",
"selectedLanguage:" : "ow 7/23/2018 17:25",
"selectedLanguageDirectoryPath" : "ow 7/12/2018 16:56",
"selectedWord" : "ow 7/5/2018 17:05",
"selectedWord:" : "RS 7/22/2018 20:52",
"usedLanguage" : "RS 7/25/2018 17:40" } }
"spellchecker" : "ow 7/25/2018 20:11",
"spellchecker:" : "ow 7/25/2018 20:11",
"usedLanguage" : "ow 7/25/2018 20:11" } }
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
],
"classvars" : [
],
"commentStamp" : "ow 7/21/2018 18:12",
"commentStamp" : "ow 7/25/2018 20:14",
"instvars" : [
"selectedWord",
"selectedLanguage" ],
"selectedLanguage",
"spellchecker" ],
"name" : "SPCDictionaryManagementUI",
"pools" : [
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
library
moduleName

^(Smalltalk os platformName asLowercase caseOf: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
datatypes
fields

^ #(nil 'ulong')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ I provide spellchecking functionalities such as checking single words, getting a
Instance Variables
affixPath: <FilePath> The path to the current loaded affix file
dictionaryPath: <FilePath> The path to the current loaded dictionary file
hunspell: <HunspellAPI> Used for making calls into the hunspell library
parser: <SpellingTextParser> Used for separating a string into its single words
hunspell: <SPCHunspellAPI> Used for making calls into the hunspell library
parser: <SPCTextParser> Used for separating a string into its single words


Class Variables
AddedWords <Set> Stores all the words that were added to the dictionary
Instance <SPCSpellChecker> Holds the current instance (this class is a singleton)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
constants
defaultAffixPath

^(SPCSpellChecker defaultLanguageDirectory fileNamed:'en_US.aff' ) name
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
constants
defaultDictionaryPath

^ (SPCSpellChecker defaultLanguageDirectory fileNamed:'en_US.dic') name
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
constants
defaultLanguageDirectory

^ FileDirectory default directoryNamed: 'dictionaries', FileDirectory slash, 'english'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
initialize-release
initialize

Smalltalk addToStartUpList: SPCSpellChecker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
accessing
instance: aSpellChecker

Instance := aSpellChecker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
accessing
instance

^ Instance ifNil: [Instance := self basicNew initialize; yourself]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
system startup
startUp: resuming

resuming ifTrue: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
dictionary and ignore list
addWordToDictionary: aString

self addedWords add: aString.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
dictionary and ignore list
addWordToIgnoreList: aString

self hunspell addWordToDictionary: aString
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
dictionary and ignore list
clearIgnoredWords

self addedWords do: [:each | self hunspell removeWordFromDictionary: each].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
hunspell: aHunspellAPI
hunspell: aSPCHunspellAPI

hunspell := aHunspellAPI
hunspell := aSPCHunspellAPI
Loading

0 comments on commit 58f14d2

Please sign in to comment.