Skip to content

Commit 88c7823

Browse files
committed
Use connect options for gutenberg, resolves #570
1 parent 0d5561b commit 88c7823

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

examples/generative/text_generator.exs

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ defmodule TextGenerator do
7272
end
7373

7474
def run do
75+
options = [transport_opts: [signature_algs_cert: :ssl.signature_algs(:default, :"tlsv1.3") ++ [sha: :rsa]]]
76+
7577
normalized_book_text =
76-
Req.get!(@download_url).body
78+
Req.get!(@download_url, connect_options: options).body
7779
|> String.downcase()
7880
|> String.replace(~r/[^a-z \.\n]/, "")
7981
|> String.to_charlist()

notebooks/text/lstm_generation.livemd

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ The one that we will use for this experiment is [Alice's Adventures in Wonderlan
2929
```elixir
3030
# Change the URL if you'd like to experiment with other books
3131
download_url = "https://www.gutenberg.org/files/11/11-0.txt"
32+
options = [transport_opts: [signature_algs_cert: :ssl.signature_algs(:default, :"tlsv1.3") ++ [sha: :rsa]]]
3233

33-
book_text = Req.get!(download_url).body
34+
book_text = Req.get!(download_url, connect_options: options).body
3435
```
3536

3637
First of all, we need to normalize the content of the book. We are only interested in the sequence of English characters, periods and new lines. Also currently we don't care about the capitalization and things like apostrophe so we can remove all other unknown characters and downcase everything. We can use a regular expression for that.

0 commit comments

Comments
 (0)