Monday, July 20, 2015

Canterbury Tales Neural Network

I trained another RNN (multi-layer recurrent neural network), this time to generate poems in Middle English in the style of Canterbury Tales. It started generating interesting stuff after just a few minutes of training, but I let it finish anyway. I noticed in one of the samples that it had generated a title, so I seeded it with that title, and sure enough, it closed the poem eventually and started a new one. Kinda cool. The numbers are line numbers (you can see they're obviously not accurate), and it generates footnotes, too, since they were in the source text. The indentation and spacing is all generated by the neural net, too.

AUCCIATES TALE,

  This walmeth have,' quod Melibee, 'by see                   760
  For it was grave, and of my voys I may,
  To hir, with-outen fond to wedden she                         285
  How that a man unto pituk than;                              1160
  Til that were I his messaille aboghnis.
  For, in the sovereyntes ful marchant
  To me, night · ordeyned his peyne.
  This no-mune answerde, as in the mille!
  Ther ny spak, with many a special massthe.
  His body frelet mot I telle as fan?
  Ther was the bus he dide him in share;
  Lest is goddesse and his mulligat
  But he ne ben a fete wolde cosindyse,                         1890
  This fro the wrokes and his cours, and drinke,                  3820
  For men tolde love--bit he was of anhto                            1555
  Than scal, unto the north, wys '-bounder doute,
  Whan thoughte gon me in the bixardes,
  That to hem don to take now heer burde,
  And I remel for to mete for us,
  Out of my proverbe, 'as they, lokkes as,
  Of avento to your octileince
  Of whiche may the hawe of avoutry,'

    184. Hl. for; _rest_ thus.   140, 4. Cm. mak; Cp. Pt. Ln. Hl. maner.

    Lold carus, eft he mighte nat to yow hir lawe.                         1710
  Er he may wedded by his messes weyle!
  For later, she was fete · stinten it usave
  Reed right to him as fond in his care.
  And hydeth, was thy streng · turneth a claye aferve,
  That owne praye bounseth wery awey.'

    3684. Cm. Hl. Thansh.

  This Palamon he bitide, here up I woot?
  With whot his name turned to stroke,
  God wake and from obeyes also a best;
  Up werketh under burel in his tonge.                         610
  Ne made scondre for an eketh al
  And bad a marchal worthy and sent at daye
  Which never sinne, this is te biforn to ben
  With dwilkketh wel; Meclege answerde.                       10
  I yeve me yow to vysed and pleyn,
  That his gite is hadde an half, no violed ende.
  And forth wol I, than ther hanneth in a clere,
  And of Mavounses hadde a stoond fempcethe,               (720)
  Me verraunt on his hors, the Irw and shirke
  As, by the fleisons of a dignitee,                           140
  She wel ful of nature, and sone can,
  God save hom al that ech man y-comen noon,
  And sprikketh and therfore of place of bedde;
  The peple is in drank for to be my three!'

    3588. E. is; _rest_ lyf.   475. E.
    of; _rest_ Sumbiald (-now _is an est godesse                                615
  No brother him unturs he hath colessoun,                   165
  My ricersable, if ye had espyed me,                           95
  Up-on hory grete floor, wher was on yow preye;
  And I comth by biholde a litel wit.
  Ful ofte tyme, thurk he comen of hem be mighte,                 (390)
  Of silknesse my lord first caste throwe.
  Allas! the kin he bar to other wente,                        800
  Be comuned but ful often save, o writ
  That, if yow puccheth thus, his host at me.
  And leyne of his deeth, hir Boundes shape,
  Hir lady speke mete, and my turned al,
  Sow that, with-outen same the worthy finde;
  Therforthe why? faste yow y-woke,                        : 2950
  This lak may may be doun · of shewing bifore                     (311)
  That thilke, and smyle that I igive I;                     310

  This hand, ther is no croyn, if that my cave!
  In hering rancour wasship of twenty yong,
  The laste tokinge wonder yow yow wel,
  That him encheseth us a tecen or bath;                         (410)
  That I sin Penitence is so greet mercy.'
  For Nothewe menelly the book seith,
  'By procest'ded, 'is," quod this povreteon,'
  Somme be your wyf, bothe as wel lemed--
  Nat who-no coude castle youre foule;
  And in this siker Countel on his might
  The mighty siker, as it be desyre;
  Al were I here woot thus, he nolde secree!

    3. Ln, heer; E. on wompath, wink, un-toon, namidye.

[ OUDun
  Biforn that ben weren knightes Cristsaryd,                        1150
  'Biforen on him-self, her lyf was bindinge,               1145
  And vertuous and bisogeth him ful man,
  And hadded he so muche, or of my smoot!
  But with his song though he sat doun wisnesse;                    195
  Eut of the carage and of his dampnacioun.
  Dan him the eres on the livete or love,
  Another dyeth she on hir wille served.
  The Iange wyf, made also wolde hem;
  Yit in my cors of Attenaces
  Of feet at Almachius lerned by,
  His wyf hadde hong, on heven, by fleer lewe.
  Now wel enqueringe, by it, and for to fron,
  That he loked hid no mone his preyere,
  Ne feete, on his parfit up or mayde.

    445. E. Pt. barment; E. Ln. camully.   386. Cm. capede; _rest_
    allone.

  [424: T. 9095-90x7.]
  And al his sterĂ«s dyed, he made uttinge.

    1901. E. _omits_ a.
    1167. Cp. Pt. Pt; Hl. nought.

    'Thing we knowe it axe a parcour,                    1275
  That thus of lord I shal bigentes here.                         1680
  For which he hath no wight han I shal falle!                    735
  Under the goddes hous, and artow for no wymes,
  Werre is we demen hangoghtes to be.
  It never sette up-on the tendrely terke,                         3605
  Gan-coven his maistrie, with-outen crye,
  And elles by any corrymed to tweye
  Of an apgoterus of our lede,                                 1430
  For elles is ful ofte of peyne of noon,
  That they doon his gonsel and a belia blarde,
  Of good have fortuth, and leef and freends,                          830
  The hous wyse world, or wroght, out ofte, is swour.                  160
  [60: T. 3043-4394.]
  Both bything is best in this matere.                              1240
  Daunce, and thanke he iman with Gellige,
  Him thoughte his aventure he hadded it his shap,
  And whan men was as ever he put right wel;
  This litel of my wyf, it sholde breke bifil;                       1060
  Ne goode and only for swich a grace.

  O, Reder was y-presed, for the booghte,                      1525
  Reed giltly, and pouce, was on hir hewe.

    133, 1. Cm. goode.

    'Now, fyr a blake is vers muche hir governarnce;
  A mour, by this word of may reverich
  But-if that under troithe men also,
  Shul no maner mannes now in Cristet softe.                   1315
  This is a cartimwest, by-ooven save.
  For as your owene lord yet knowe he,                      OUT""    HERE ENDAT. AUCCIATES TALE.

       *       *       *       *       *

THE SEIPES THE MEMELIUM OF PISB.

HERE UDORES PERCUIS TIS ThiT BKERE.

      NEiBIGIEES TALE.

  By god, to daunge other in heven gentris.'                         4265
  And that they cart but o wol nat suffreth hone
  Withwomth an ydel purposour
and have this castel do.                      1550
  Ther shal me al my declared al this:                          1365
  [480: T. 9548-9753.]
  How we povre and al his aventure,
  If that oon on a mayde shewe aspecioun
  To slone in clot or to doon in vryde.
  And Whan they wolde y gebstable and blisdes,
  Whan that he bigilde me nat othing swate!

  Hir heigh but thou sholde have a knight
  [389: T. 1307-11200.]
  Lat thing, ne in your-self, far waries in the sinne.,
  Lenk in a partee in foryefelleden;
  Til he carled som · if they he loked me.
  God seile, umbarie, quod he, 'and fals so streng,                  2315
  Madler deer, gan vertu and of [Sa],
  And semblonwes and in he restenbed,
  Ne nat, now whan he neysed is me soot;                     (630)
  This Gamelyn is the ciftiesse of sonne,
  That stirme feendes weren as deed in bondes.                   1165
  With-outen hewed here meyne y-nough bityde,
  [88: T. 2904-2522.]
  Than litel hert be mawed alwey bigonne;
  I mighte men mene, as Envitatee                               595

  And seyde, 'it shal never falsly also;                               235

...

And so on.

Here's another, with no seed text:

Of Caunterboures deboname, and cloth,
  That hath hir housbond in the walles tale,
  His fruit I seye, his liste, lay, laughed                          4090
  Of his stories wroothly for to we;
  Which that hir mokle in this tresor foon,
  They looke y-nat usente I, foo dide or enfore
  Thou art to haven ful many a yere hond.                     (810)
  And up answakned and in his thoght!
  But natheler swete of this manere,
  Who, I luve me whul be mighte nat teille;                   (470)
  [404: T. 3148-9454.]
  To telle hir herm; me in his muncen save.
  For muche after any good of gyle,                    75
  Wol can, wrastthe thus, and my good rekne,
  And lyk to the game a that can paleme.
  With prively servaunt the sire,                              [T. 153.

    Leurne in this prove 'another coste,
  With wounes maken him herte any reve.
  O doketh frend His same swoken rorie,
  That half that he toweling of thilke lyf
  Purstaunce, came, thus no wight so geste him bothe?                 120
  Ful often man was fully of hye a knee,                   (625)
  An al be in, 'fer right anon atto,
  And that my daf to stille in sideraynesse.               (890)

  And al a fille aboute hir herte I quikke,
  For yeven maken herke, bothe gay the to see.                        1310
  And if thou me that gerle sone quat he;                 1155
  [201: T. 11211-12202.]
  Thy minstry, out of honour · trewely unlost,'
  'Who sente be faire, of his cherl no bere.             435
  This syde-ward she trusteth over he wente,                   (10)
  For in this curture riche; and the firste knight
  She schul I lyke gay be thoght and ay.
  And Auchaus han devaunce buk minde,
  That I was lye, and warisshe for to preite.
  This walken as the cladres wilcow attenly
  As he wentweth er, they tendren bisinesse
  Witnesse, avyseth to the hevenes sighte,
  Til colandre al this carpenteres fade,
  Yit nored_, as he was a greet dayes--
  'Adam,' quod she, 'E. manying in the rook was rede;
  As Plutage mayntaccioun heend pais.
  But this this cocauntilitee of Diendrye,
  And hoom was three, as repetse as hir therfonge,                      1250
  But soth the cherl-pirgrew wel he lay
  Bireveth man; and after his weddes say;
  With-inne his come a geyn with preching is,
  Dien in so fair, as laughed lecherye
  The dissembre it nosperie flasoun that malence
    Another beste, I saystom blessed and roune;
  In whiche they mo broon arrogeth you blak.'

...

Sunday, July 19, 2015

A neural network that writes Scalia dissents

I trained a recursive neural network (https://github.com/karpathy/char-rnn) on a bunch of Justice Scalia's dissents from the past few years. It spits out some amusing stuff, depending on the starter text and how "adventurous" you want the output. Since it's character-based and not word-based, it makes a bunch of spelling errors (unlike Justice Scalia), but is also able to create new words (just like Justice Scalia!). Here are some samples.

***

Starter text: "Justice SCALIA", random level: 0.8. Never would have expected this from a strict constructionist (check the first sentence). This one brings in same-sex marriage, constitutional interpretation, and the typical contempt-ridden air quotes.

"Justice SCALIA, dissenting. 
The Constitution is an opinion, and so views that "[t]he Court tait the structure relations (interneline) rejectly and weands is not categorical, while all this one inference to do be not applying a nample between the fairest regulation in the entire Regulate Called to his regulations." Ante, at 2-92. The own sittingt-assume industries are strigges not. See United States v. New Yorbo, Manyal, 508 U.S. 208, 368, 106 S.Ct. 2508, 41 L.Ed.2d 669 (1999)) (SCALIA, J. The Jouncis Col.Reverson (quoted Nationary 7, 49-585 (Mouns)). But the state exception that its pollutants so whatever his inoper affected by the United States does not avoid a bullenaby AEDPS?) the time of two applicable, however, such as the object of how question of its own interpretations must was "provided to achieve a federal strict system is the section was the Act's state reading of Fremed Read Iractal consequence of the statute in the regulations with the consequence was the present completed by the officials were reasonably every question—think if that attribution of the one would have dead the truth for an industrial rewilting records if it is arrested that the Federal Exchanges whom the speech at all strethed by the time-of-tax 1970, while so what the new same-sex marriage terms (whenevel is an internal assistabliness based on the State." The Act what the occusion said that he can considered to the offered foreign Congresss about predicted nor conturment like "scheme." 

"Justice SCALIA", 0.85. Talking about all sorts of stuff, including "pregnancy discrimination".

"Justice SCALIA, with whom THE Loore, would have into its retail to contain a significant constitutional jurisprudence. That is not maintenance of pregnancy discrimination to take insurance confessionary basis:
"We simply compels. 
How disablich that the Federal Government's approach a plafication was not only the pre many cases when they more than a statute at tax creates that "[t]he word "substantially unwilling" facts in the contents of the approach reductions. 
On the opinion has official before them. We have had standing. But that Congress might "grant on the [tore] later insurance basing plainness phrase." Ante, at 2506. But that is about a but used to timed with, for empless believe that "the amicisprisably rights in state law's detention with my, most. In Redels v. United States, 494 U.S. 479, 455, 96 S.Ct. 2767, 97 L.Ed.2d 837 (1996) (countench, the Court's business did not require relationship to may be same-free immunial procedural reality of the Commission that the release is impossible to the program based on the statement." Beaws that the tipster only another persuasions of evidence of Administrative United States v. Parrentes, 51 Can. Thie, Art. 607, 30, 102-11 (1896). I would all sense. 
The Court itself not a substantial to the contrary interpreting the requirements, identifying our precedents to be not soual into the society was unconstitutional for the deal services on the neighbout's interpretivens in their conclusion. Acrost-intitule to mentior informations is about establishment here. Does until Rule v. State Likeing § 6 believes that their liberty is not an effect to apply the number of each anyone it mottitung of "required).""

"Pretentious", random level: 0.95. I love how the second paragraph starts with such a forceful statement.

"Pretentious permits newly judges that the law constitutional holdings of national today. It is incriphic was so houselied herehplace. The conclusion that Maxwell's laffic between the common leow police the plaint's States as its highly holding see would have threatening substitute an assumate trade, see 22 U.S.C. § 931(b)(3). 
But that it is unquestionably. A New York has forenes present, the is not stend what prosecute results of hore, the issue at interpretation can be saying eyting "`arress botill to make matters" retain that, and funding or justification by 1986 that Congress extens its avoid participated billion, in view materely "subporablith" Medicaps to litigate influsts of nothing mandated to most compel else. Ante, at 11. So the Attorney General's claims questionable "based" in the Court's bearer warrantles objective and permit in the naturt is produced by reason on the trial court claim that rescre the statute state discussion of they asks not necesses 10 offer of Scwho Reaster, Felibe Haurt v. Zasking on their constitutional functions in the Antitory's defect the judiciary reading recorded by a new distinguisless laws in this theory to think the linef "Act] and it," for the data passpose. 
The Court of Appeals courts two bring the great registrues, error in a way to ensure the Syet or received or appropriate rule. That its respect to the Court does not just establishes constitutional: "colticial legal treat's powers to be relevant about settled regime to what matters would discorments and promotive with the Act's invalidative amserting an entry."

"What a parody", random level: 0.8:


"What a parody of an initient fact that Arizona affirmatively regulated: The Act be expressed that matter of according to say that he says no penalty discharges were meaning of the attorney error was related to far as a complaint that the Ninth Circuit, the Court underpresent a vigwated criteria state area, it was reflexted to no law that the context of a separate law benefit of loso shouse before uncondition upon those precisely the entire of all cosest as the correct according affected billiple because the Court had unintw what Congress was made by the Court's decisions of among the trial courts or tepporable terms of the Court declaring where "advised entirely tax removing the health production judicial state" requirement that a false of the unconstitutional facts of the context in power to reason to be uncorpective of a court may be unconstitutional." Consistence of People v. Weleso, 3 Cranch 23, 278, 488-131 (1998)(7) (SIV). As Congress of these vermison accepting in the law authorially does not entirely with the prohibition only to make of citizens than whether it meaning for the trial court of its action of context of a second of the substitution were standing a provisions that it means that when a way is an insurer that these whole testimony makes a has for other claims by Congress has validity, in the presumably justify the EPA, on the industrial hardly concluded the Court's) federal issues, and whereas many rule and debate. The failure search new theory is may well injury, who seek did not demonstrate whether the Act at at our certificate of an interpation was described the entire 1998."

"You would think", random level: 0.95. The first sentence up until the quote kinda makes sense.

"You would think the legitimacy thing prohibited in the distinction is simply criminal inquiry, "which this Court's acts a "persons whose pre-existing, and the election which retrostened with the DNA has alver: a contracts criminal criminal criminal courts, which excluder implication wasd delay anytorney federal gur to be saude that is own, it takes who leave the precedent of an initial provisions that equal-riscretion. Since forbidable to pre-enact work to the legislative powers against Grabe-special v. Palusheent, 184 U. S. 413, 96 (1968). The provisions of this case, never be marketur judiciary justify the purpose of a matter of U.S. Sovily representative with Magna Cartz, 3 Dyanchests)."

"Pure applesauce", random level: 0.85. My favorite new word in this is "decoking".

"Pure applesauces and other whole must be an bendailing the prohibition my say allowing responsible for the entire of the concept or continue to cannot be cherd, nuble of a precedent or recognized it even any failure in a criminal statute that establishing for records the State courts a habeas called the property of the Supreme Court may is the decoking the same-treatment proceded such appointed by the enactment] affecting the his constitutional oright, whenever the entire Circuit's detention interest out of the courts or provision anything was referently, because it as textual regulatory justice avoid of the higcies jurisdiction remanding taxes in its percentage. It is not the thousate those whole employment-mates of ability to relevant the jurisdictional conduct and other factor of a meaning of a dignity claims activities (inexplicable criminal viltely." Ante, at 14-51, in v. Nownnephshor, 287 U. S. ___, ___ ("SC. . .).
II: This case that describes Congress had advire foreign all who eqhevel undermine the statute to the attention to pre-enactment of the opinion the decision scheme to do so."

"The overriding principle", random level: 0.85. Apparently the "overriding principle of democracy" is the substantial cost of a firearm. "Assing" the prescribed, eh? Clever verbiage.

"The overriding principle of democracy action this substantial cost of a firearm. Application would have extraordinary from a fireard health-insurance considerations in respectively undermined to include Assing the "prescribed" in the Court conceded against sovereign powers") (2012) and Storch "a man private parts of state law based on asquictions — and can adjudge deal was no State's reading operates." 

"Who ever thought", random level: 0.5. At this level of randomness, sentences sorta make more sense, but go on forever. Not that dissimilar from actual court opinions.

"Who ever thought the Court's employees would have destroyed in the entire of a prevailing the majority-minority districts. And that is an incremental proceeding is an industrial review counsel that the proceeding is not the exclusive assistance of the pre-emption and industrial country and powers that the prosecution that the Court's opinion requires the action when the Arizona should not have the federal musus credit and standing to enforce the Fourth Amendment stands it that a state control of securated coverage in the decision to the concurrence of the First Amendment is because the decision mandatory minimums through the provision and that we have no purport to have the Framers were asserting about the time areas wholesale relevant to foreign criminals in the context of the Fourteenth Amendment is a contrary restraint."

"Perhaps", random level: 0.85. States' rights, baby.

"Perhaps the law infringed by the Alabama Acts and rights from coverage in a State suggesting its cases like this case is other powers or achieved by the guarantee correctness to the States — the normal law as a complaint that the Ninth Circuit, the Court v. Norkes, each cause of the California driving search power is the electoral interest." 

"I suggest", random level: 0.88. You can just feel the contempt dripping from this one, especially due to the mistakes of the "personders of contrary" and the "delicitations" of the Ninth Circuit.

"I suggested changes to reject the cases of change holding) none of the capering the other personders of contrary, nor "delicitation" of the Ninth Circuit siteed held that the Federal Department precedent that rather than the relevant is equally "trup estor through the precese when "[t]o accept the property of the Transport Rule 18(b) which documents to the DOA disclose schools, "nonjudicination of Floridaps "convicted contract regarding about all when the law injudicial soupce, when the purpose of interpretation on the Appehedated Dectivenes of Jo.s 26 U. S. C. §209*20A in this criminal v. §37 espord or "manafestorize that a holding would "involve other warrantless" enacted comes to dismiss gives relief.
A claim relationship as ever the upheal possible that the prohibiting "[I]f which is acceptly choices (intenting governmental conflict would not] held that even pick form." 

"Same-sex marriage", random level: 0.4.

 "Same-sex marriage of the proceeding has not shown that the criterion of the Court's opinion spending and the Act did not establish which the caption of religious accidenty of the new same-sex marriage in factor principle that the Court says that the Federal Government can be relevant to the constitutional provisions of the natural relationships because the Court change the new district court's decision to the problems on the Court does not present an unconstitutional proceeding that the Court decides the United States v. Manyna, 537 U.S. 373, 513-534, 114 S.Ct. 2748, 129 L.Ed.2d 1305 (2010) (slip op., at 3) (internal quotation marks omitted). It is not the statute and compels a straight of the Act. The Court has no constitutional proceeding the court below the pre-emption circumstantly was an interest. Ante, at 1352. The Court standing what the Court may reasonably a pre-encorment is that the Act and of the present case is a contrary is an opinion relief in the entire of a mere respection of the present case for the Act when it intended."

"Same-sex marriage", random level: 0.6. It's all about the Fourth Amendment.

 "Same-sex marriage in the order to companies precedent. The Fourth Amendment is not a single the Act that the Act does not effect through other crimes by control of "case"); (emphasis added). The Court has no reason to what is why a destrict court mistaken would be inappellant majority was a defendant's opinion concurring in the Agency and the tax credits to give Federal program with the constitutional expenditure was prohibited from a question by the trial procedural default of the Federal Government cases a tax any department of the latter resolved the problem is so and set of the provision requiring the present context in Such a State context of the constitutional conductes between the three court."
"Same-sex marriage", random level: 0.8. An "injustice relationship".

"Same-sex marriage is eagible television would comply with the tax driver's required extens preemptive evidence on the court already related dependence of preferable cost-emimst scull injustice relationship, "month" provision is the election sakee seeking decision in the logicial justice a matter, regard to the government of the Freingly reasonable Commerce Clauses was not wholenature that is not docuper to draw only of [a] law meaning in the prosecutor in the fairnes" of the judges did not mean in a followings applicable to enact criminal action and retreoting state Patition does not disparance of a provision of the statute." Id., at 54." 

"Same-sex marriage', random level: 0.85. This actually made me laugh.

"Same-sex marriage is eaple the ACA's evintory cannot present an erroneous collaterations plainness — whereas criminal stance in our canon case. Or the statute is not the market spot that the Court fources "toor "justify" the Court conduct that according decision in candod requires in 14 millooloyly, Floring engals that the Demott v. Relo, 308 U.S. 332, 410, 111 S.Ct. 9300, 160 S.Ct. 1409, 131 S.Ct. 1545. Crowing it be applied to do warred the majority may be correcion, which canon a proceeding by entire regulation, and so health insurance complaint from the First Amendment here is not the court penalty and inference to the hinds of the Act's my view, it must anticill from a wantonering any defendant that as the statute exercise of this case regulates." 

"Same-sex marriage", 0.9.

"Same-sex marriage is earlarn to buy intrusion held." Robest anlike Report Addines 39 (in). The Ninton Creeching upon a state context, declaration of the remanded role worked with this is,nind States foreign "remotable to say that the citizen'n or neither can be included to be reason," L.J, the Stonk v. Renavated State, 3 W. Wallawoop, 547 U.S. 393, 242, 84 S.Ct. 909 (quoting Commstanit and Ingensures. Killian zothers Magharca Code And. 476 (1986) (know Milloan, individuals provides enactment of the Court creates principle than authorize points would have meant there.
The Court leaves the Court insists that a preemption of the court directly and it can every substantial role at an agency" precedent under in which the rule same-sex marriage as to reny us for correct after the States to the present district-specific proceedings."