Change e letters to i in words: Difference between revisions

m
Line 327:
set longWords to filteredLines("5 < length", s)
set eWords to longWords's ¬
filteredArrayUsingPredicate:(containsCharcontainsString("e"))
set lexicon to ca's NSSet's ¬
setWithArray:(longWords's ¬
filteredArrayUsingPredicate:(containsCharcontainsString("i")))
set possibles to (allReplaced("e", "i", ¬
Line 341:
-- Dictionary of possible words and their sources
set dict to ca'sdictFromZip(eWords, NSDictionary's ¬possibles)
dictionaryWithObjects:eWords forKeys:possibles
-- Listing of candidate words which are found in the dictionary
Line 379 ⟶ 378:
end allReplaced
 
 
-- containsCharcontainsString :: CharString -> NSPredicate
on containsChar(c)
on containsString(s)
tell current application
its (NSPredicate's ¬
predicateWithFormat:("self contains '" & cs & "'"))
end tell
end containsString
 
 
-- dictFromZip :: NSArray -> NSArray -> NSDictionary
on dictFromZip(xs, ys)
tell current application
its (NSDictionary's ¬
dictionaryWithObjects:eWordsxs forKeys:possiblesys)
end tell
end containsChardictFromZip
 
 
-- filteredLines :: String -> NStringNSString -> [a]
on filteredLines(predicateString, s)
-- A list of lines filtered by an NSPredicate string
9,655

edits