Skip to content

Commit

Permalink
replaced scan() with readChar() in load.corpus.R
Browse files Browse the repository at this point in the history
  • Loading branch information
adunmore committed Feb 26, 2020
1 parent 1cefae3 commit a8bf057
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions R/load.corpus.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ load.corpus = function(files = "all", corpus.dir = "", encoding = "UTF-8") {
message("!\n")
message("\"", file, "\"? no such a file -- check your directory!\n")
} else {
message("loading ", file, "\t", "...")
#message("loading ", file, "\t", "...")
# loading the next file from the list "corpus.filenames";
# if an error occurred, ignore it and send a message on the screen
current.file = tryCatch(scan(file, what = "char", encoding = encoding,
sep = "\n", quiet = TRUE),
current.file = tryCatch(readChar(file, file.info(file)$size),
error = function(e) NULL)
# if successful, append the scanned file into the corpus,
# otherwise send a message
Expand Down

2 comments on commit a8bf057

@adunmore
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Investigating #36

@adunmore
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this approach is compatible with the two downstream functions that care about the shape of its output (delete.markup and txt.to.words). I think this is ready to be merged into the main branch.

Please sign in to comment.