Skip to content

Commit

Permalink
Some comments removed
Browse files Browse the repository at this point in the history
  • Loading branch information
mishal23 committed Aug 17, 2017
1 parent a5245ea commit 34043d5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- Compile it.
- Input a word in double quotes and check the recommendations given.
- For my system after heading to Erlang Shell, it is as follows
```
```erlang
1> cd("C:/Users/Mishal Shah/Desktop/Erlang").
C:/Users/Mishal Shah/Desktop/Erlang
ok
Expand Down
8 changes: 0 additions & 8 deletions check.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@
-define (FileName, "big.txt").

% Read the whole file and makes a list of each word.
%% 3rd Release:- Following code takes less time
readfile(Filename) ->
{ok,Binary} = file:read_file(Filename),
Words = string:tokens(binary_to_list(Binary), " \v\t\r\n\'\"\\`1234567890-=!@#$%^&*()_+[]{};,./<>?:|"),
lists:usort(lists:map(fun(Word) -> string:to_lower(Word) end, Words)).

%% 2nd Release:- Following code takes more time to read compared to the above one
%readfile(FileName) -> {ok,Binary} = file:read_file(FileName),
%% re:split(binary_to_list(Binary), "[^a-zA-Z]").
% lists:usort(lists:map(fun(X) -> string:to_lower(binary_to_list(X)) end,(re:split(binary_to_list(Binary),"[^a-zA-Z]")))).
letters() -> "abcdefghijklmnopqrstuvwxyz".

% Form list of words by deleting each letter from the word
Expand Down Expand Up @@ -63,10 +58,7 @@ known(Word) ->
FinalDictionary = readfile(?FileName),
% Always compare lowercase words
LowerWord = string:to_lower(Word),
% FinalDictionary = lists:map(fun(X) -> string:to_lower(binary_to_list(X)) end,Words_in_dictionary),
Error1_words = edits1(LowerWord),
% Error2_words = edits1(string:to_lower(Word)),
% AppendedList = lists:usort(lists:append(Error1_words,Error2_words)),
SuggestedList = words_in_list(FinalDictionary, Error1_words),
case lists:member(LowerWord,SuggestedList) of
true -> Word;
Expand Down

0 comments on commit 34043d5

Please sign in to comment.