(plan): created hollow interfaces, including todos

master
nicode3141 2026-11-11 20:50:23 +01:00
parent 7585687aef
commit fbe88f01b9
4 changed files with 152 additions and 47 deletions

View File

@ -1,2 +1,13 @@
# Genre Detector
A simple genre detection tool for any given text
A genre detection tool that categorizes text using a perceptron-based machine model.
This project was developed for a peer group and was inspired by Prof. Hummels MNIST Perceptron example.
Genres:
- adventure
- horror
- mystery
- romance
- scifi
Note: The text data used here was sourced from [Gutenberg](http://gutenberg.org/).

View File

@ -1,46 +1,61 @@
id,title,author,genre,split,chars,words,file
40840,"Ten Years Among the Mail Bags Or, Notes from the Diary of a Special Agent of the Post-Office Department","Holbrook, James, 1812-1864",mystery,test,830785,141311,data/test/mystery/40840_ten-years-among-the-mail-bags-or-notes-from-the-di.txt
73230,The thing on the door-step,"Lovecraft, H. P. (Howard Phillips), 1890-1937",horror,train,61778,10909,data/train/horror/73230_the-thing-on-the-door-step.txt
16959,"'Way Down East A Romance of New England Life","Grismer, Joseph Rhode, 1849-1922",romance,train,184693,33484,data/train/romance/16959_way-down-east-a-romance-of-new-england-life.txt
24124,"Down the Rhine; Or, Young America in Germany","Optic, Oliver, 1822-1897",adventure,train,498284,88201,data/train/adventure/24124_down-the-rhine-or-young-america-in-germany.txt
3071,"The Golden Slipper, and Other Problems for Violet Strange","Green, Anna Katharine, 1846-1935",mystery,train,500523,92708,data/train/mystery/3071_the-golden-slipper-and-other-problems-for-violet-s.txt
64152,The Strange Visitation,"Corelli, Marie, 1855-1924",horror,test,161428,29095,data/test/horror/64152_the-strange-visitation.txt
391,The Song of Roland,"Scott-Moncrieff, C. K. (Charles Kenneth), 1889-1930 [Translator]",romance,train,192262,32466,data/train/romance/391_the-song-of-roland.txt
29034,"Harper's Young People, July 13, 1880 An Illustrated Weekly",Various,adventure,train,96077,16490,data/train/adventure/29034_harper-s-young-people-july-13-1880-an-illustrated-.txt
79180,The range-boomer,"Tuttle, W. C. (Wilbur C.), 1883-1969",mystery,test,253150,47892,data/test/mystery/79180_the-range-boomer.txt
50775,Twenty Years' Experience as a Ghost Hunter,"O'Donnell, Elliott, 1872-1965",horror,train,407011,74166,data/train/horror/50775_twenty-years-experience-as-a-ghost-hunter.txt
56705,Mrs. Essington: The Romance of a House-party,"Chamberlain, Esther, -1908",romance,train,205565,36532,data/train/romance/56705_mrs-essington-the-romance-of-a-house-party.txt
24196,Victory,"Del Rey, Lester, 1915-1993",scifi,train,99837,17625,data/train/scifi/24196_victory.txt
21546,"Nero, the Circus Lion: His Many Adventures","Barnum, Richard",adventure,train,126730,24514,data/train/adventure/21546_nero-the-circus-lion-his-many-adventures.txt
42010,The Barrel Mystery,"Flynn, William J. (William James), 1867-1928",mystery,train,272354,49779,data/train/mystery/42010_the-barrel-mystery.txt
6995,Ghosts I Have Met and Some Others,"Bangs, John Kendrick, 1862-1922",horror,train,193947,36035,data/train/horror/6995_ghosts-i-have-met-and-some-others.txt
23745,Aladdin & Co.: A Romance of Yankee Magic,"Quick, Herbert, 1861-1925",romance,train,487474,87886,data/train/romance/23745_aladdin-co-a-romance-of-yankee-magic.txt
32128,The Enormous Room,"Gold, H. L. (Horace Leonard), 1914-1996",scifi,train,129246,23154,data/train/scifi/32128_the-enormous-room.txt
67135,"The Lives of Celebrated Travellers, Vol. 3 (of 3)","St. John, James Augustus, 1795-1875",adventure,train,741273,126459,data/train/adventure/67135_the-lives-of-celebrated-travellers-vol-3-of-3.txt
16692,Beyond The Rocks: A Love Story,"Glyn, Elinor, 1864-1943",romance,test,359192,65728,data/test/romance/16692_beyond-the-rocks-a-love-story.txt
51842,Beyond Bedlam,"Guin, Wyman, 1915-1989",scifi,train,124403,21719,data/train/scifi/51842_beyond-bedlam.txt
23036,"Dave Darrin After the Mine Layers; Or, Hitting the Enemy a Hard Naval Blow","Hancock, H. Irving (Harrie Irving), 1868-1922",adventure,train,292417,51301,data/train/adventure/23036_dave-darrin-after-the-mine-layers-or-hitting-the-e.txt
70996,The D'Arblay mystery,"Freeman, R. Austin (Richard Austin), 1862-1943",mystery,train,451536,83339,data/train/mystery/70996_the-d-arblay-mystery.txt
40823,Ghostly Phenomena,"O'Donnell, Elliott, 1872-1965",horror,train,205072,35689,data/train/horror/40823_ghostly-phenomena.txt
53157,Wood and Stone: A Romance,"Powys, John Cowper, 1872-1963",romance,train,1113358,198583,data/train/romance/53157_wood-and-stone-a-romance.txt
60632,"The Fortunate Island, and Other Stories","Clark, Charles Heber, 1841-1915",adventure,test,395265,70987,data/test/adventure/60632_the-fortunate-island-and-other-stories.txt
26651,The Flaming Jewel,"Chambers, Robert W. (Robert William), 1865-1933",mystery,train,378937,66643,data/train/mystery/26651_the-flaming-jewel.txt
16258,The Squire of Sandal-Side: A Pastoral Romance,"Barr, Amelia E., 1831-1919",romance,test,362113,66443,data/test/romance/16258_the-squire-of-sandal-side-a-pastoral-romance.txt
21449,With Axe and Rifle,"Kingston, William Henry Giles, 1814-1880",adventure,train,547218,101147,data/train/adventure/21449_with-axe-and-rifle.txt
17953,The Haunters & The Haunted Ghost Stories And Tales Of The Supernatural,"Rhys, Ernest, 1859-1946 [Editor]",horror,train,644570,116647,data/train/horror/17953_the-haunters-the-haunted-ghost-stories-and-tales-o.txt
35358,A Song of a Single Note: A Love Story,"Barr, Amelia E., 1831-1919",romance,test,494490,90388,data/test/romance/35358_a-song-of-a-single-note-a-love-story.txt
45802,Knock Three Times!,"Webb, Marion St. John, 1888-1930",adventure,train,287960,54159,data/train/adventure/45802_knock-three-times.txt
68140,"Nick Carter Stories No. 154, August 21, 1915: The mask of death; or, Nick Carter's curious case.","Carter, Nicholas (House name)",mystery,train,197157,34948,data/train/mystery/68140_nick-carter-stories-no-154-august-21-1915-the-mask.txt
39168,Sophia: A Romance,"Weyman, Stanley John, 1855-1928",romance,train,596891,109633,data/train/romance/39168_sophia-a-romance.txt
55950,A Madcap Cruise,"Bates, Oric, 1883-1918",adventure,train,372890,67011,data/train/adventure/55950_a-madcap-cruise.txt
4046,The Garden of Survival,"Blackwood, Algernon, 1869-1951",horror,train,126862,22438,data/train/horror/4046_the-garden-of-survival.txt
15738,Married life;,"Edginton, May, 1883-1957",romance,test,485353,88208,data/test/romance/15738_married-life.txt
51809,Survival Kit,"Pohl, Frederik, 1919-2013",scifi,train,66608,11872,data/train/scifi/51809_survival-kit.txt
16756,The Bobbsey Twins at the County Fair,"Hope, Laura Lee",adventure,test,192617,36060,data/test/adventure/16756_the-bobbsey-twins-at-the-county-fair.txt
40963,"Johnny Ludlow, Sixth Series","Wood, Henry, Mrs., 1814-1887",mystery,train,689942,127198,data/train/mystery/40963_johnny-ludlow-sixth-series.txt
54532,"The Night-Side of Nature; Or, Ghosts and Ghost-Seers","Crowe, Catherine, 1790-1876",horror,train,967242,170771,data/train/horror/54532_the-night-side-of-nature-or-ghosts-and-ghost-seers.txt
76361,The odyssey of a torpedoed tramp,"Larrouy, Maurice, 1882-1939",adventure,test,316253,60005,data/test/adventure/76361_the-odyssey-of-a-torpedoed-tramp.txt
78704,The bungalow mystery,"Keene, Carolyn",mystery,test,216367,39284,data/test/mystery/78704_the-bungalow-mystery.txt
7120,"Knock, Knock, Knock and Other Stories","Turgenev, Ivan Sergeevich, 1818-1883",horror,train,345932,63247,data/train/horror/7120_knock-knock-knock-and-other-stories.txt
44159,Penelope,"Scargill, William Pitt, 1787-1836",romance,train,304947,53003,data/train/romance/44159_penelope.txt
2154,Around the World in Eighty Days. Junior Deluxe Edition,"Verne, Jules, 1828-1905",adventure,train,367395,63562,data/train/adventure/2154_around-the-world-in-eighty-days-junior-deluxe-edit.txt
id,title,author,genre,split,chars,words,file
522200,The Detective Case No. 0,"Author, Demo 0",mystery,test,73320,17000,data/test/mystery/522200_the-detective-case-no-0.txt
4762500,The Horror Case No. 0,"Author, Demo 0",horror,test,71426,17000,data/test/horror/4762500_the-horror-case-no-0.txt
3541900,The Love Stories Case No. 0,"Author, Demo 0",romance,test,72275,17000,data/test/romance/3541900_the-love-stories-case-no-0.txt
6814100,The Science Fiction Case No. 0,"Author, Demo 0",scifi,train,71280,17000,data/train/scifi/6814100_the-science-fiction-case-no-0.txt
5278300,The Adventure Case No. 0,"Author, Demo 0",adventure,train,71619,17000,data/train/adventure/5278300_the-adventure-case-no-0.txt
4254500,The Mystery Case No. 0,"Author, Demo 0",mystery,test,73001,17000,data/test/mystery/4254500_the-mystery-case-no-0.txt
816100,The Ghost Case No. 0,"Author, Demo 0",horror,test,71806,17000,data/test/horror/816100_the-ghost-case-no-0.txt
4857600,The Romance Case No. 0,"Author, Demo 0",romance,test,72510,17000,data/test/romance/4857600_the-romance-case-no-0.txt
6814101,The Science Fiction Case No. 1,"Author, Demo 1",scifi,train,71462,17000,data/train/scifi/6814101_the-science-fiction-case-no-1.txt
5278301,The Adventure Case No. 1,"Author, Demo 1",adventure,train,71780,17000,data/train/adventure/5278301_the-adventure-case-no-1.txt
522201,The Detective Case No. 1,"Author, Demo 1",mystery,train,72727,17000,data/train/mystery/522201_the-detective-case-no-1.txt
4762501,The Horror Case No. 1,"Author, Demo 1",horror,train,71394,17000,data/train/horror/4762501_the-horror-case-no-1.txt
3541901,The Love Stories Case No. 1,"Author, Demo 1",romance,train,72493,17000,data/train/romance/3541901_the-love-stories-case-no-1.txt
6814102,The Science Fiction Case No. 2,"Author, Demo 2",scifi,train,71419,17000,data/train/scifi/6814102_the-science-fiction-case-no-2.txt
5278302,The Adventure Case No. 2,"Author, Demo 2",adventure,train,71828,17000,data/train/adventure/5278302_the-adventure-case-no-2.txt
4254501,The Mystery Case No. 1,"Author, Demo 1",mystery,train,73133,17000,data/train/mystery/4254501_the-mystery-case-no-1.txt
816101,The Ghost Case No. 1,"Author, Demo 1",horror,train,71455,17000,data/train/horror/816101_the-ghost-case-no-1.txt
4857601,The Romance Case No. 1,"Author, Demo 1",romance,train,72413,17000,data/train/romance/4857601_the-romance-case-no-1.txt
6814103,The Science Fiction Case No. 3,"Author, Demo 3",scifi,train,71410,17000,data/train/scifi/6814103_the-science-fiction-case-no-3.txt
5278303,The Adventure Case No. 3,"Author, Demo 3",adventure,train,71633,17000,data/train/adventure/5278303_the-adventure-case-no-3.txt
522202,The Detective Case No. 2,"Author, Demo 2",mystery,train,73002,17000,data/train/mystery/522202_the-detective-case-no-2.txt
4762502,The Horror Case No. 2,"Author, Demo 2",horror,train,71787,17000,data/train/horror/4762502_the-horror-case-no-2.txt
3541902,The Love Stories Case No. 2,"Author, Demo 2",romance,train,72436,17000,data/train/romance/3541902_the-love-stories-case-no-2.txt
6814104,The Science Fiction Case No. 4,"Author, Demo 4",scifi,train,71695,17000,data/train/scifi/6814104_the-science-fiction-case-no-4.txt
5278304,The Adventure Case No. 4,"Author, Demo 4",adventure,train,71970,17000,data/train/adventure/5278304_the-adventure-case-no-4.txt
4254502,The Mystery Case No. 2,"Author, Demo 2",mystery,train,72894,17000,data/train/mystery/4254502_the-mystery-case-no-2.txt
816102,The Ghost Case No. 2,"Author, Demo 2",horror,train,71596,17000,data/train/horror/816102_the-ghost-case-no-2.txt
4857602,The Romance Case No. 2,"Author, Demo 2",romance,train,72816,17000,data/train/romance/4857602_the-romance-case-no-2.txt
6814105,The Science Fiction Case No. 5,"Author, Demo 5",scifi,test,71571,17000,data/test/scifi/6814105_the-science-fiction-case-no-5.txt
5278305,The Adventure Case No. 5,"Author, Demo 5",adventure,test,71590,17000,data/test/adventure/5278305_the-adventure-case-no-5.txt
522203,The Detective Case No. 3,"Author, Demo 3",mystery,train,72720,17000,data/train/mystery/522203_the-detective-case-no-3.txt
4762503,The Horror Case No. 3,"Author, Demo 3",horror,train,71510,17000,data/train/horror/4762503_the-horror-case-no-3.txt
3541903,The Love Stories Case No. 3,"Author, Demo 3",romance,train,71804,17000,data/train/romance/3541903_the-love-stories-case-no-3.txt
6814106,The Science Fiction Case No. 6,"Author, Demo 6",scifi,train,71280,17000,data/train/scifi/6814106_the-science-fiction-case-no-6.txt
5278306,The Adventure Case No. 6,"Author, Demo 6",adventure,train,71461,17000,data/train/adventure/5278306_the-adventure-case-no-6.txt
4254503,The Mystery Case No. 3,"Author, Demo 3",mystery,train,73083,17000,data/train/mystery/4254503_the-mystery-case-no-3.txt
816103,The Ghost Case No. 3,"Author, Demo 3",horror,train,71610,17000,data/train/horror/816103_the-ghost-case-no-3.txt
4857603,The Romance Case No. 3,"Author, Demo 3",romance,train,72434,17000,data/train/romance/4857603_the-romance-case-no-3.txt
6814107,The Science Fiction Case No. 7,"Author, Demo 7",scifi,train,71365,17000,data/train/scifi/6814107_the-science-fiction-case-no-7.txt
5278307,The Adventure Case No. 7,"Author, Demo 7",adventure,train,71686,17000,data/train/adventure/5278307_the-adventure-case-no-7.txt
522204,The Detective Case No. 4,"Author, Demo 4",mystery,train,73036,17000,data/train/mystery/522204_the-detective-case-no-4.txt
4762504,The Horror Case No. 4,"Author, Demo 4",horror,train,71768,17000,data/train/horror/4762504_the-horror-case-no-4.txt
3541904,The Love Stories Case No. 4,"Author, Demo 4",romance,train,72517,17000,data/train/romance/3541904_the-love-stories-case-no-4.txt
6814108,The Science Fiction Case No. 8,"Author, Demo 8",scifi,test,71914,17000,data/test/scifi/6814108_the-science-fiction-case-no-8.txt
5278308,The Adventure Case No. 8,"Author, Demo 8",adventure,test,71899,17000,data/test/adventure/5278308_the-adventure-case-no-8.txt
4254504,The Mystery Case No. 4,"Author, Demo 4",mystery,train,72811,17000,data/train/mystery/4254504_the-mystery-case-no-4.txt
816104,The Ghost Case No. 4,"Author, Demo 4",horror,train,71499,17000,data/train/horror/816104_the-ghost-case-no-4.txt
4857604,The Romance Case No. 4,"Author, Demo 4",romance,train,72587,17000,data/train/romance/4857604_the-romance-case-no-4.txt
6814109,The Science Fiction Case No. 9,"Author, Demo 0",scifi,train,71575,17000,data/train/scifi/6814109_the-science-fiction-case-no-9.txt
5278309,The Adventure Case No. 9,"Author, Demo 0",adventure,train,71973,17000,data/train/adventure/5278309_the-adventure-case-no-9.txt
522205,The Detective Case No. 5,"Author, Demo 5",mystery,test,72788,17000,data/test/mystery/522205_the-detective-case-no-5.txt
4762505,The Horror Case No. 5,"Author, Demo 5",horror,test,71454,17000,data/test/horror/4762505_the-horror-case-no-5.txt
3541905,The Love Stories Case No. 5,"Author, Demo 5",romance,test,72350,17000,data/test/romance/3541905_the-love-stories-case-no-5.txt
6814110,The Science Fiction Case No. 10,"Author, Demo 1",scifi,train,71680,17000,data/train/scifi/6814110_the-science-fiction-case-no-10.txt
5278310,The Adventure Case No. 10,"Author, Demo 1",adventure,train,72041,17000,data/train/adventure/5278310_the-adventure-case-no-10.txt
4254505,The Mystery Case No. 5,"Author, Demo 5",mystery,test,73258,17000,data/test/mystery/4254505_the-mystery-case-no-5.txt
816105,The Ghost Case No. 5,"Author, Demo 5",horror,test,71537,17000,data/test/horror/816105_the-ghost-case-no-5.txt
4857605,The Romance Case No. 5,"Author, Demo 5",romance,test,72392,17000,data/test/romance/4857605_the-romance-case-no-5.txt
6814111,The Science Fiction Case No. 11,"Author, Demo 2",scifi,train,71377,17000,data/train/scifi/6814111_the-science-fiction-case-no-11.txt
5278311,The Adventure Case No. 11,"Author, Demo 2",adventure,train,71341,17000,data/train/adventure/5278311_the-adventure-case-no-11.txt

1 id title author genre split chars words file
2 40840 522200 Ten Years Among the Mail Bags Or, Notes from the Diary of a Special Agent of the Post-Office Department The Detective Case No. 0 Holbrook, James, 1812-1864 Author, Demo 0 mystery test 830785 73320 141311 17000 data/test/mystery/40840_ten-years-among-the-mail-bags-or-notes-from-the-di.txt data/test/mystery/522200_the-detective-case-no-0.txt
3 73230 4762500 The thing on the door-step The Horror Case No. 0 Lovecraft, H. P. (Howard Phillips), 1890-1937 Author, Demo 0 horror train test 61778 71426 10909 17000 data/train/horror/73230_the-thing-on-the-door-step.txt data/test/horror/4762500_the-horror-case-no-0.txt
4 16959 3541900 'Way Down East A Romance of New England Life The Love Stories Case No. 0 Grismer, Joseph Rhode, 1849-1922 Author, Demo 0 romance train test 184693 72275 33484 17000 data/train/romance/16959_way-down-east-a-romance-of-new-england-life.txt data/test/romance/3541900_the-love-stories-case-no-0.txt
5 24124 6814100 Down the Rhine; Or, Young America in Germany The Science Fiction Case No. 0 Optic, Oliver, 1822-1897 Author, Demo 0 adventure scifi train 498284 71280 88201 17000 data/train/adventure/24124_down-the-rhine-or-young-america-in-germany.txt data/train/scifi/6814100_the-science-fiction-case-no-0.txt
6 3071 5278300 The Golden Slipper, and Other Problems for Violet Strange The Adventure Case No. 0 Green, Anna Katharine, 1846-1935 Author, Demo 0 mystery adventure train 500523 71619 92708 17000 data/train/mystery/3071_the-golden-slipper-and-other-problems-for-violet-s.txt data/train/adventure/5278300_the-adventure-case-no-0.txt
7 64152 4254500 The Strange Visitation The Mystery Case No. 0 Corelli, Marie, 1855-1924 Author, Demo 0 horror mystery test 161428 73001 29095 17000 data/test/horror/64152_the-strange-visitation.txt data/test/mystery/4254500_the-mystery-case-no-0.txt
8 391 816100 The Song of Roland The Ghost Case No. 0 Scott-Moncrieff, C. K. (Charles Kenneth), 1889-1930 [Translator] Author, Demo 0 romance horror train test 192262 71806 32466 17000 data/train/romance/391_the-song-of-roland.txt data/test/horror/816100_the-ghost-case-no-0.txt
9 29034 4857600 Harper's Young People, July 13, 1880 An Illustrated Weekly The Romance Case No. 0 Various Author, Demo 0 adventure romance train test 96077 72510 16490 17000 data/train/adventure/29034_harper-s-young-people-july-13-1880-an-illustrated-.txt data/test/romance/4857600_the-romance-case-no-0.txt
10 79180 6814101 The range-boomer The Science Fiction Case No. 1 Tuttle, W. C. (Wilbur C.), 1883-1969 Author, Demo 1 mystery scifi test train 253150 71462 47892 17000 data/test/mystery/79180_the-range-boomer.txt data/train/scifi/6814101_the-science-fiction-case-no-1.txt
11 50775 5278301 Twenty Years' Experience as a Ghost Hunter The Adventure Case No. 1 O'Donnell, Elliott, 1872-1965 Author, Demo 1 horror adventure train 407011 71780 74166 17000 data/train/horror/50775_twenty-years-experience-as-a-ghost-hunter.txt data/train/adventure/5278301_the-adventure-case-no-1.txt
12 56705 522201 Mrs. Essington: The Romance of a House-party The Detective Case No. 1 Chamberlain, Esther, -1908 Author, Demo 1 romance mystery train 205565 72727 36532 17000 data/train/romance/56705_mrs-essington-the-romance-of-a-house-party.txt data/train/mystery/522201_the-detective-case-no-1.txt
13 24196 4762501 Victory The Horror Case No. 1 Del Rey, Lester, 1915-1993 Author, Demo 1 scifi horror train 99837 71394 17625 17000 data/train/scifi/24196_victory.txt data/train/horror/4762501_the-horror-case-no-1.txt
14 21546 3541901 Nero, the Circus Lion: His Many Adventures The Love Stories Case No. 1 Barnum, Richard Author, Demo 1 adventure romance train 126730 72493 24514 17000 data/train/adventure/21546_nero-the-circus-lion-his-many-adventures.txt data/train/romance/3541901_the-love-stories-case-no-1.txt
15 42010 6814102 The Barrel Mystery The Science Fiction Case No. 2 Flynn, William J. (William James), 1867-1928 Author, Demo 2 mystery scifi train 272354 71419 49779 17000 data/train/mystery/42010_the-barrel-mystery.txt data/train/scifi/6814102_the-science-fiction-case-no-2.txt
16 6995 5278302 Ghosts I Have Met and Some Others The Adventure Case No. 2 Bangs, John Kendrick, 1862-1922 Author, Demo 2 horror adventure train 193947 71828 36035 17000 data/train/horror/6995_ghosts-i-have-met-and-some-others.txt data/train/adventure/5278302_the-adventure-case-no-2.txt
17 23745 4254501 Aladdin & Co.: A Romance of Yankee Magic The Mystery Case No. 1 Quick, Herbert, 1861-1925 Author, Demo 1 romance mystery train 487474 73133 87886 17000 data/train/romance/23745_aladdin-co-a-romance-of-yankee-magic.txt data/train/mystery/4254501_the-mystery-case-no-1.txt
18 32128 816101 The Enormous Room The Ghost Case No. 1 Gold, H. L. (Horace Leonard), 1914-1996 Author, Demo 1 scifi horror train 129246 71455 23154 17000 data/train/scifi/32128_the-enormous-room.txt data/train/horror/816101_the-ghost-case-no-1.txt
19 67135 4857601 The Lives of Celebrated Travellers, Vol. 3 (of 3) The Romance Case No. 1 St. John, James Augustus, 1795-1875 Author, Demo 1 adventure romance train 741273 72413 126459 17000 data/train/adventure/67135_the-lives-of-celebrated-travellers-vol-3-of-3.txt data/train/romance/4857601_the-romance-case-no-1.txt
20 16692 6814103 Beyond The Rocks: A Love Story The Science Fiction Case No. 3 Glyn, Elinor, 1864-1943 Author, Demo 3 romance scifi test train 359192 71410 65728 17000 data/test/romance/16692_beyond-the-rocks-a-love-story.txt data/train/scifi/6814103_the-science-fiction-case-no-3.txt
21 51842 5278303 Beyond Bedlam The Adventure Case No. 3 Guin, Wyman, 1915-1989 Author, Demo 3 scifi adventure train 124403 71633 21719 17000 data/train/scifi/51842_beyond-bedlam.txt data/train/adventure/5278303_the-adventure-case-no-3.txt
22 23036 522202 Dave Darrin After the Mine Layers; Or, Hitting the Enemy a Hard Naval Blow The Detective Case No. 2 Hancock, H. Irving (Harrie Irving), 1868-1922 Author, Demo 2 adventure mystery train 292417 73002 51301 17000 data/train/adventure/23036_dave-darrin-after-the-mine-layers-or-hitting-the-e.txt data/train/mystery/522202_the-detective-case-no-2.txt
23 70996 4762502 The D'Arblay mystery The Horror Case No. 2 Freeman, R. Austin (Richard Austin), 1862-1943 Author, Demo 2 mystery horror train 451536 71787 83339 17000 data/train/mystery/70996_the-d-arblay-mystery.txt data/train/horror/4762502_the-horror-case-no-2.txt
24 40823 3541902 Ghostly Phenomena The Love Stories Case No. 2 O'Donnell, Elliott, 1872-1965 Author, Demo 2 horror romance train 205072 72436 35689 17000 data/train/horror/40823_ghostly-phenomena.txt data/train/romance/3541902_the-love-stories-case-no-2.txt
25 53157 6814104 Wood and Stone: A Romance The Science Fiction Case No. 4 Powys, John Cowper, 1872-1963 Author, Demo 4 romance scifi train 1113358 71695 198583 17000 data/train/romance/53157_wood-and-stone-a-romance.txt data/train/scifi/6814104_the-science-fiction-case-no-4.txt
26 60632 5278304 The Fortunate Island, and Other Stories The Adventure Case No. 4 Clark, Charles Heber, 1841-1915 Author, Demo 4 adventure test train 395265 71970 70987 17000 data/test/adventure/60632_the-fortunate-island-and-other-stories.txt data/train/adventure/5278304_the-adventure-case-no-4.txt
27 26651 4254502 The Flaming Jewel The Mystery Case No. 2 Chambers, Robert W. (Robert William), 1865-1933 Author, Demo 2 mystery train 378937 72894 66643 17000 data/train/mystery/26651_the-flaming-jewel.txt data/train/mystery/4254502_the-mystery-case-no-2.txt
28 16258 816102 The Squire of Sandal-Side: A Pastoral Romance The Ghost Case No. 2 Barr, Amelia E., 1831-1919 Author, Demo 2 romance horror test train 362113 71596 66443 17000 data/test/romance/16258_the-squire-of-sandal-side-a-pastoral-romance.txt data/train/horror/816102_the-ghost-case-no-2.txt
29 21449 4857602 With Axe and Rifle The Romance Case No. 2 Kingston, William Henry Giles, 1814-1880 Author, Demo 2 adventure romance train 547218 72816 101147 17000 data/train/adventure/21449_with-axe-and-rifle.txt data/train/romance/4857602_the-romance-case-no-2.txt
30 17953 6814105 The Haunters & The Haunted Ghost Stories And Tales Of The Supernatural The Science Fiction Case No. 5 Rhys, Ernest, 1859-1946 [Editor] Author, Demo 5 horror scifi train test 644570 71571 116647 17000 data/train/horror/17953_the-haunters-the-haunted-ghost-stories-and-tales-o.txt data/test/scifi/6814105_the-science-fiction-case-no-5.txt
31 35358 5278305 A Song of a Single Note: A Love Story The Adventure Case No. 5 Barr, Amelia E., 1831-1919 Author, Demo 5 romance adventure test 494490 71590 90388 17000 data/test/romance/35358_a-song-of-a-single-note-a-love-story.txt data/test/adventure/5278305_the-adventure-case-no-5.txt
32 45802 522203 Knock Three Times! The Detective Case No. 3 Webb, Marion St. John, 1888-1930 Author, Demo 3 adventure mystery train 287960 72720 54159 17000 data/train/adventure/45802_knock-three-times.txt data/train/mystery/522203_the-detective-case-no-3.txt
33 68140 4762503 Nick Carter Stories No. 154, August 21, 1915: The mask of death; or, Nick Carter's curious case. The Horror Case No. 3 Carter, Nicholas (House name) Author, Demo 3 mystery horror train 197157 71510 34948 17000 data/train/mystery/68140_nick-carter-stories-no-154-august-21-1915-the-mask.txt data/train/horror/4762503_the-horror-case-no-3.txt
34 39168 3541903 Sophia: A Romance The Love Stories Case No. 3 Weyman, Stanley John, 1855-1928 Author, Demo 3 romance train 596891 71804 109633 17000 data/train/romance/39168_sophia-a-romance.txt data/train/romance/3541903_the-love-stories-case-no-3.txt
35 55950 6814106 A Madcap Cruise The Science Fiction Case No. 6 Bates, Oric, 1883-1918 Author, Demo 6 adventure scifi train 372890 71280 67011 17000 data/train/adventure/55950_a-madcap-cruise.txt data/train/scifi/6814106_the-science-fiction-case-no-6.txt
36 4046 5278306 The Garden of Survival The Adventure Case No. 6 Blackwood, Algernon, 1869-1951 Author, Demo 6 horror adventure train 126862 71461 22438 17000 data/train/horror/4046_the-garden-of-survival.txt data/train/adventure/5278306_the-adventure-case-no-6.txt
37 15738 4254503 Married life; The Mystery Case No. 3 Edginton, May, 1883-1957 Author, Demo 3 romance mystery test train 485353 73083 88208 17000 data/test/romance/15738_married-life.txt data/train/mystery/4254503_the-mystery-case-no-3.txt
38 51809 816103 Survival Kit The Ghost Case No. 3 Pohl, Frederik, 1919-2013 Author, Demo 3 scifi horror train 66608 71610 11872 17000 data/train/scifi/51809_survival-kit.txt data/train/horror/816103_the-ghost-case-no-3.txt
39 16756 4857603 The Bobbsey Twins at the County Fair The Romance Case No. 3 Hope, Laura Lee Author, Demo 3 adventure romance test train 192617 72434 36060 17000 data/test/adventure/16756_the-bobbsey-twins-at-the-county-fair.txt data/train/romance/4857603_the-romance-case-no-3.txt
40 40963 6814107 Johnny Ludlow, Sixth Series The Science Fiction Case No. 7 Wood, Henry, Mrs., 1814-1887 Author, Demo 7 mystery scifi train 689942 71365 127198 17000 data/train/mystery/40963_johnny-ludlow-sixth-series.txt data/train/scifi/6814107_the-science-fiction-case-no-7.txt
41 54532 5278307 The Night-Side of Nature; Or, Ghosts and Ghost-Seers The Adventure Case No. 7 Crowe, Catherine, 1790-1876 Author, Demo 7 horror adventure train 967242 71686 170771 17000 data/train/horror/54532_the-night-side-of-nature-or-ghosts-and-ghost-seers.txt data/train/adventure/5278307_the-adventure-case-no-7.txt
42 76361 522204 The odyssey of a torpedoed tramp The Detective Case No. 4 Larrouy, Maurice, 1882-1939 Author, Demo 4 adventure mystery test train 316253 73036 60005 17000 data/test/adventure/76361_the-odyssey-of-a-torpedoed-tramp.txt data/train/mystery/522204_the-detective-case-no-4.txt
43 78704 4762504 The bungalow mystery The Horror Case No. 4 Keene, Carolyn Author, Demo 4 mystery horror test train 216367 71768 39284 17000 data/test/mystery/78704_the-bungalow-mystery.txt data/train/horror/4762504_the-horror-case-no-4.txt
44 7120 3541904 Knock, Knock, Knock and Other Stories The Love Stories Case No. 4 Turgenev, Ivan Sergeevich, 1818-1883 Author, Demo 4 horror romance train 345932 72517 63247 17000 data/train/horror/7120_knock-knock-knock-and-other-stories.txt data/train/romance/3541904_the-love-stories-case-no-4.txt
45 44159 6814108 Penelope The Science Fiction Case No. 8 Scargill, William Pitt, 1787-1836 Author, Demo 8 romance scifi train test 304947 71914 53003 17000 data/train/romance/44159_penelope.txt data/test/scifi/6814108_the-science-fiction-case-no-8.txt
46 2154 5278308 Around the World in Eighty Days. Junior Deluxe Edition The Adventure Case No. 8 Verne, Jules, 1828-1905 Author, Demo 8 adventure train test 367395 71899 63562 17000 data/train/adventure/2154_around-the-world-in-eighty-days-junior-deluxe-edit.txt data/test/adventure/5278308_the-adventure-case-no-8.txt
47 4254504 The Mystery Case No. 4 Author, Demo 4 mystery train 72811 17000 data/train/mystery/4254504_the-mystery-case-no-4.txt
48 816104 The Ghost Case No. 4 Author, Demo 4 horror train 71499 17000 data/train/horror/816104_the-ghost-case-no-4.txt
49 4857604 The Romance Case No. 4 Author, Demo 4 romance train 72587 17000 data/train/romance/4857604_the-romance-case-no-4.txt
50 6814109 The Science Fiction Case No. 9 Author, Demo 0 scifi train 71575 17000 data/train/scifi/6814109_the-science-fiction-case-no-9.txt
51 5278309 The Adventure Case No. 9 Author, Demo 0 adventure train 71973 17000 data/train/adventure/5278309_the-adventure-case-no-9.txt
52 522205 The Detective Case No. 5 Author, Demo 5 mystery test 72788 17000 data/test/mystery/522205_the-detective-case-no-5.txt
53 4762505 The Horror Case No. 5 Author, Demo 5 horror test 71454 17000 data/test/horror/4762505_the-horror-case-no-5.txt
54 3541905 The Love Stories Case No. 5 Author, Demo 5 romance test 72350 17000 data/test/romance/3541905_the-love-stories-case-no-5.txt
55 6814110 The Science Fiction Case No. 10 Author, Demo 1 scifi train 71680 17000 data/train/scifi/6814110_the-science-fiction-case-no-10.txt
56 5278310 The Adventure Case No. 10 Author, Demo 1 adventure train 72041 17000 data/train/adventure/5278310_the-adventure-case-no-10.txt
57 4254505 The Mystery Case No. 5 Author, Demo 5 mystery test 73258 17000 data/test/mystery/4254505_the-mystery-case-no-5.txt
58 816105 The Ghost Case No. 5 Author, Demo 5 horror test 71537 17000 data/test/horror/816105_the-ghost-case-no-5.txt
59 4857605 The Romance Case No. 5 Author, Demo 5 romance test 72392 17000 data/test/romance/4857605_the-romance-case-no-5.txt
60 6814111 The Science Fiction Case No. 11 Author, Demo 2 scifi train 71377 17000 data/train/scifi/6814111_the-science-fiction-case-no-11.txt
61 5278311 The Adventure Case No. 11 Author, Demo 2 adventure train 71341 17000 data/train/adventure/5278311_the-adventure-case-no-11.txt

View File

@ -0,0 +1,46 @@
package de.nicode3141.genredct;
import java.util.Map;
public class Detector {
/**
* Calculates the sum of weighted word counts for a text
* @param inputText word count to the common vocabulary
* @param weights current weights for a label
* @param bias constant to adjust the perceptron
* @return sum of all weighted word counts
*/
double calcSum(Map<String, Integer> inputText, double[] weights, double bias){
// TODO: loop thru the map and add the (word count / total words) * weight to it
// After the loop, increment the sum by the bias
return 0.0d;
}
/**
* Adjust the weights of a genre for correct result
* @param inputText word count of all texts to the common vocabulary
* @param label 0 if text isn't part of current genre, 1 if it is
* @return final weights for a genre
*/
double[] trainModel(Map<String, Integer>[] inputText, int[] label){
// TODO: Start with all weights = 0.0, bias = 0.0
// Then loop thru multiple epochs:
// Loop thru all texts, calculate the sum
// If the sum is >= 0 -> means it belongs to the genre
// If the prediction was wrong, correct the weights
// (weights += learningRate * error * wordCount
return null;
}
/**
* Predicts which genre the text belongs to
* @param inputText word count of the text to test to the common vocabulary
* @return array with value for each genre, contains the calculated sum
*/
double[] predictGenre(Map<String, Integer> inputText){
// TODO: Fixed size array for each genre
// For each genre calcSum
return null;
}
}

View File

@ -0,0 +1,33 @@
package de.nicode3141.genredct;
import java.util.List;
import java.util.Map;
public class GenreData {
/**
* This method gets all books and their corresponding label
* @param csvPath Path of the labels.csv file
* @return Map key: genre, value: path
*/
public static Map<String, String> loadGenres(String csvPath){
// TODO: Loop thru all paths and return a Map of <label, path>
return null;
}
/**
* Counts top X words of a textfile
* @param path source plain textfile
* @param limit only counts the top (limit) words
* @return LinkedMap key: word, value: count
*/
public static Map<String, Integer> countWords(String path, int limit){
// TODO: Scan text line by line and count already added Words.
// If word was not present, add it to the Map.
// After that, sort the Map. Simple with ArrayList sort()
// The ArrayList could contain the entrySet of the Map
// Then loop thru the sorted ArrayList, maximum (limit) and create a new Map
// LinkedHashMap would make sense here, because of the ordering
return null;
}
}