Upload 7 files
Browse files- Makefile +4 -0
- author_list.txt +50 -0
- complete.parquet +3 -0
- convert.py +52 -0
- test.parquet +3 -0
- test_labels.txt +0 -0
- train.parquet +3 -0
Makefile
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
download:
|
2 |
+
wget -O Gungor_2018_VictorianAuthorAttribution_readme.txt "https://dataworks.iupui.edu/bitstream/handle/11243/23/Gungor_2018_VictorianAuthorAttribution_readme.txt?sequence=5&isAllowed=y"
|
3 |
+
wget -O Gungor_2018_VictorianAuthorAttribution_data-train.csv "https://dataworks.iupui.edu/bitstream/handle/11243/23/Gungor_2018_VictorianAuthorAttribution_data-train.csv?sequence=2&isAllowed=y"
|
4 |
+
wget -O Gungor_2018_VictorianAuthorAttribution_data.csv "https://dataworks.iupui.edu/bitstream/handle/11243/23/Gungor_2018_VictorianAuthorAttribution_data.csv?sequence=3&isAllowed=y"
|
author_list.txt
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Arthur Conan Doyle
|
2 |
+
Charles Darwin
|
3 |
+
Charles Dickens
|
4 |
+
Edith Wharton
|
5 |
+
George Eliot
|
6 |
+
Horace Greeley
|
7 |
+
Jack London
|
8 |
+
James Baldwin
|
9 |
+
Jane Austen
|
10 |
+
John Muir
|
11 |
+
Joseph Conrad
|
12 |
+
Mark Twain
|
13 |
+
Nathaniel Hawthorne
|
14 |
+
Ralph Emerson
|
15 |
+
Robert Louis Stevenson
|
16 |
+
Rudyard Kipling
|
17 |
+
Sinclair Lewis
|
18 |
+
Theodore Dreiser
|
19 |
+
Thomas Hardy
|
20 |
+
Walt Whitman
|
21 |
+
Washington Irving
|
22 |
+
William Carleton
|
23 |
+
Albert Ross
|
24 |
+
Anne Manning
|
25 |
+
Arlo Bates
|
26 |
+
Bret Harte
|
27 |
+
Catharine Maria Sedgwick
|
28 |
+
Charles Reade
|
29 |
+
Edward Eggleston
|
30 |
+
Fergus Hume
|
31 |
+
Frances Hodgson Burnett
|
32 |
+
George Moore
|
33 |
+
George William Curtis
|
34 |
+
Helen Mathers
|
35 |
+
Henry Rider Haggard
|
36 |
+
Isabella Lucy Bird
|
37 |
+
Jacob Abbott
|
38 |
+
James Grant
|
39 |
+
James Payn
|
40 |
+
John Kendrick Bangs
|
41 |
+
John Pendleton Kennedy
|
42 |
+
John Strange Winter
|
43 |
+
Lucas Malet
|
44 |
+
Marie Corelli
|
45 |
+
Oliver Optic
|
46 |
+
Sarah Orne Jewett
|
47 |
+
Sarah Stickney Ellis
|
48 |
+
Thomas Anstey Guthrie
|
49 |
+
Thomas Nelson Page
|
50 |
+
William Black
|
complete.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7e64ec074cb45e05c15aa04d82e2763f6eaf9f02d49be0aadcd7b9ba63545287
|
3 |
+
size 275206181
|
convert.py
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import csv
|
2 |
+
import random
|
3 |
+
import pandas as pd
|
4 |
+
|
5 |
+
|
6 |
+
def read_train_data():
|
7 |
+
|
8 |
+
rows = []
|
9 |
+
|
10 |
+
with open(
|
11 |
+
"Gungor_2018_VictorianAuthorAttribution_data-train.csv", "r", encoding="latin1"
|
12 |
+
) as f:
|
13 |
+
csv_reader = csv.reader(f)
|
14 |
+
header = next(csv_reader)
|
15 |
+
|
16 |
+
for row in csv_reader:
|
17 |
+
rows.append({"text": row[0], "author": int(row[1]) - 1})
|
18 |
+
|
19 |
+
return rows
|
20 |
+
|
21 |
+
|
22 |
+
def read_test_data():
|
23 |
+
with open("test_labels.txt", "r") as f:
|
24 |
+
labels = [label.strip() for label in f.readlines()]
|
25 |
+
|
26 |
+
with open(
|
27 |
+
"Gungor_2018_VictorianAuthorAttribution_data.csv", "r", encoding="latin1"
|
28 |
+
) as f:
|
29 |
+
lines = f.readlines()
|
30 |
+
texts = [line.strip() for line in lines[1:]] # skip header
|
31 |
+
|
32 |
+
rows = []
|
33 |
+
|
34 |
+
for text, label in zip(texts, labels):
|
35 |
+
rows.append({"text": text, "author": int(label) - 1})
|
36 |
+
|
37 |
+
return rows
|
38 |
+
|
39 |
+
|
40 |
+
def run():
|
41 |
+
train_rows = read_train_data()
|
42 |
+
test_rows = read_test_data()
|
43 |
+
all_rows = train_rows + test_rows
|
44 |
+
random.shuffle(all_rows)
|
45 |
+
|
46 |
+
pd.DataFrame(train_rows).to_parquet("train.parquet")
|
47 |
+
pd.DataFrame(test_rows).to_parquet("test.parquet")
|
48 |
+
pd.DataFrame(all_rows).to_parquet("complete.parquet")
|
49 |
+
|
50 |
+
|
51 |
+
if __name__ == "__main__":
|
52 |
+
run()
|
test.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:15b6e7ab15ff17a3847e0da4f6c135616e2ab9f20a237922fc9a582f1c3bc0de
|
3 |
+
size 111081512
|
test_labels.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fa4bf2e73e2363bf83d25602e5d47afb4887d76814da23393ac788ec3d555120
|
3 |
+
size 153847205
|