Some preliminary experimentation with the OCR files from the Field Code and with various text analysis packages.

library(magrittr)
library(RWeka)

First we need to load the codes into a useable format and clean them up. Load each code as a character vector with just words converted to lowercase into a list, with the filenames as the names of the list objects

files <- dir("txt", "*.txt")
raw <- file.path("txt", files) %>%
lapply(., scan, "character", sep = "\n")
names(raw) <- files
codes_texts <- lapply(raw, paste, collapse = " ") %>%
lapply(., tolower) %>%
lapply(., WordTokenizer) %>%
lapply(., paste, collapse = " ")

A helper function to create n-grams using the function provided in RWeka. Note that the documentation says that the maximum for an n-gram is 3, but apparently that is not the case.

ngrammify <- function(data, n) {
NGramTokenizer(data, Weka_control(min = n, max = n))
}

Create the n-grams, then create a list of all the unique n-grams. We’re going to create just 5-grams on the suspicion that that is a good length.

codes_grams <- lapply(codes_texts, ngrammify, 5)
every_grams <- codes_grams %>% unlist() %>% unique()

So far we have been comparing each code to the universe of codes, not one to another. How many unique n-grams are there in total, and how many in each code?

length_all_ngrams <- every_grams %>% length()
length_codes_ngrams <- codes_grams %>% lapply(., length)

How many fewer unique n-grams are there than the total of the n-grams in all the codes? I.e., how many matches are there?

length_codes_ngrams %>% unlist %>% sum - length_all_ngrams
## [1] 19065

The n-grams in each code comprise what percentage of the total?

length_codes_ngrams %>% lapply(., "/", length_all_ngrams)
## $MI1853.txt ## [1] 0.1936 ## ##$NC1868.txt
## [1] 0.4424
##
## $NY1850part2.txt ## [1] 0.4821 Up till now we have been comparing codes with the total universe of codes. Now let’s compare one code to another. The NC 1868 code is probably borrowed from the NY 1850 code. How many n-grams in the NC code are in the NY code? What is the percentage of matches to possible matches (i.e., the unique list of n-grams in both sets). What do these matches look like? (Save them to disk for Kellen to look at.) ny_to_nc_matches <- intersect(codes_grams$NC1868.txt, codes_grams$NY1850part2.txt) ny_to_nc_possible <- unique(c(codes_grams$NC1868.txt, codes_grams$NY1850part2.txt)) ny_to_nc_matches %>% length ## [1] 8643 ny_to_nc_matches %>% length / ny_to_nc_possible %>% length ## [1] 0.06539 ny_to_nc_matches %>% length / length_codes_ngrams$NC1868.txt
## [1] 0.1211
sample(ny_to_nc_matches, 10)
##  [1] "debtor or is indebted to"
##  [2] "the whole sum deposited and"
##  [3] "it be established by the"
##  [4] "such amendment substantial justice will"
##  [5] "the execution of the judgment"
##  [6] "of any paper to bring"
##  [7] "upon the trial of a"
##  [8] "this state or has departed"
##  [9] "names of the jurors who"
## [10] "have appeared in the action"
write.csv(ny_to_nc_matches, file = "out/ny_to_nc.matches.csv")

What if we do the same thing for New York to Michigan?

ny_to_mi_matches <- intersect(codes_grams$MI1853.txt, codes_grams$NY1850part2.txt)
ny_to_mi_possible <- unique(c(codes_grams$MI1853.txt, codes_grams$NY1850part2.txt))

ny_to_mi_matches %>% length
## [1] 411
ny_to_mi_matches %>% length / ny_to_nc_possible %>% length
## [1] 0.00311
ny_to_mi_matches %>% length / length_codes_ngrams$MI1853.txt ## [1] 0.01315 sample(ny_to_mi_matches, 10) ## [1] "to be fixed by the" "by the oath of the" ## [3] "between the hours of six" "of the defendant may be" ## [5] "may at any time within" "material to the action and" ## [7] "same manner and with the" "the property of the defendant" ## [9] "in the following cases 1" "service may be made by" write.csv(ny_to_mi_matches, file = "out/ny_to_mi.matches.csv") That kind of analysis might be generally useful, so let’s turn it into a function. First a helper function that removes elements from the list of n-grams. A lot of the n-grams contain non-word characters, numbers, or gibberish from the OCR. We want to know the proportion of matches that could be reasonably matched, so we’ll exclude n-grams containing any of those characters. #' Remove unreasonable n-grams containing characters other than letters and spaces #' @param ngrams A list of n-grams #' @return Returns a list of filtered n-grams filter_unreasonable_ngrams <- function(ngrams) { require(stringr) ngrams[!str_detect(ngrams, "[^a-z ]")] } Now the main function for comparing two codes: #' Compare two codes using their list of n-grams. #' @param orig_code A vector of n-grams representing a code. #' @param dest_code A vectory of n-grams representing a code. #' @return A list containing data that might help to identify whether codes #' match up. compare_codes_by_shared_ngrams <- function(orig_code, dest_code) { require(magrittr) matches <- intersect(orig_code, dest_code) shared_ngrams <- unique(c(orig_code, dest_code)) ratio_matches_to_possible <- length(matches) / length(filter_unreasonable_ngrams(shared_ngrams)) ratio_matches_to_destination <- length(matches) / length(filter_unreasonable_ngrams(dest_code)) list(matches = matches, shared_ngrams = shared_ngrams, ratio_matches_to_possible = ratio_matches_to_possible, ratio_matches_to_destination = ratio_matches_to_destination) } It sure would be nice to be able to take an n-gram that we know is a match and to find the context in two codes. I’m going to assume that you’ve found a interesting match elsewhere, probably using the compare_codes_by_shared_ngrams() function, and want to investigate it further. This function takes the n-gram as a string and the two codes to look for it in. (Technically, I suppose, we’re just implementing a generic search function.) kwic_ngram_match <- function(ngram, code_1, code_2, disp_chars = 100) { require(stringr) # The fixed() function from stringr indicates that we are using literal # characters rather than a regex. match_code_1 <- str_locate_all(code_1, fixed(ngram))[[1]] match_code_2 <- str_locate_all(code_2, fixed(ngram))[[1]] match_code_1[,1] <- match_code_1[,1] - disp_chars match_code_1[,2] <- match_code_1[,2] + disp_chars match_code_2[,1] <- match_code_2[,1] - disp_chars match_code_2[,2] <- match_code_2[,2] + disp_chars extract_code_1 <- str_sub(code_1, match_code_1[,1], match_code_1[,2]) extract_code_2 <- str_sub(code_2, match_code_2[,1], match_code_2[,2]) data.frame(ngram = ngram, orig_code = extract_code_1, dest_code = extract_code_2) } Now that we’ve written a KWIC function, we can apply it to the comparison of the NY and NC sample codes. First we get a comparison of the two codes: cf_ny_nc <- compare_codes_by_shared_ngrams(codes_grams$NY1850part2.txt,
codes_grams$NC1868.txt) ## Loading required package: stringr str(cf_ny_nc) ## List of 4 ##$ matches                     : chr [1:8643] "law and suits in equity" "the distinction between actions at" "distinction between actions at law" "between actions at law and" ...
##  $shared_ngrams : chr [1:132173] "mm nncmnr ses part ii" "nncmnr ses part ii of" "ses part ii of civil" "part ii of civil actions" ... ##$ ratio_matches_to_possible   : num 0.0912
##  $ratio_matches_to_destination: num 0.16 Now let’s get a random sample of matches: sample_matches <- sample(cf_ny_nc$matches, 20)
sample_matches
##  [1] "a contract is made for"
##  [2] "if it be against real"
##  [3] "an appeal by giving the"
##  [4] "such private party and returned"
##  [5] "judgment and of the time"
##  [6] "or 4 a married woman"
##  [7] "for the recovery of the"
##  [8] "of the following causes of"
##  [9] "by this act or by"
## [10] "adjudged to be sold must"
## [11] "adding or striking out the"
## [12] "is made against such defendant"
## [13] "a defendant is equivalent to"
## [14] "dollars to each for every"
## [15] "may have claimed to hold"
## [16] "the county where the cause"
## [17] "the property a reasonable time"
## [18] "restraining the commission or continuance"
## [19] "fixed by a judge of"
## [20] "disobedience of order how punished"

Now let’s apply our KWIC function to those sample matches and get a comparison of the two codes in tabular format. (If the length of this table is longer than the sample matches, it is because the match appears more than once in each code.)

comparison_of_matches <- sample_matches %>% lapply(., kwic_ngram_match,
codes_texts$NY1850part2.txt, codes_texts$NC1868.txt,
disp_chars = 300) %>%
do.call(rbind.data.frame, .)
comparison_of_matches
##                                        ngram
## 1                     a contract is made for
## 2                      if it be against real
## 3                    an appeal by giving the
## 4            such private party and returned
## 5                   judgment and of the time
## 6                       or 4 a married woman
## 7                       or 4 a married woman
## 8                    for the recovery of the
## 9                    for the recovery of the
## 10                of the following causes of
## 11                         by this act or by
## 12                  adjudged to be sold must
## 13                adding or striking out the
## 14            is made against such defendant
## 15              a defendant is equivalent to
## 16                 dollars to each for every
## 17                  may have claimed to hold
## 18                the county where the cause
## 19            the property a reasonable time
## 20 restraining the commission or continuance
## 21                       fixed by a judge of
## 22        disobedience of order how punished
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            orig_code
## 1                     aith and upon good con- siderations before due #mended code ig 112 § 599 an executor or administrator a trustee of an express trust or a person expressly authorised by statute may sue without joining with him the persons for whose benefit the action is prosecuted a person with whom or in whose name a contract is made for the beneit of another is a trustee of an express trust with- in the meaning of this section amended code § 113 the last sentence is added to re- move a doubt which has been expressed » § 600 when a married woman is a party her hus- band must be joined with her except that 1 when the action concerns
## 2                 rty then out of the real property be- longing to him on the day when the judgment was docketed in the county or at any time thereafter or \u0095 digitized by goo8 le mm noclnun 349 if the judgment be entered pursuant to the first subdi- vision of section 632 the execution must conform to such judgment 2 if it be against real or personal property in the hands of personal representatives heirs devisees lega- tees tenants of real property or trustees it must re- quire the sheriif to satisfy the judgment with interest out of such property 3 if it be against the person of the judgment debtor it must require the sheriff to a
## 3                    ections 691 and 692 with- in ten days thereafter the appeal must be regarded asif no such undertaking had been given the justification -must be upon a notice of not less than five days jimended code § 341 § 1183 in the cases not provided for in sections 1175 1176 1177 1178 and 1179 the perfectingof an appeal by giving the undertaking mentioned in section 1174 stays proceedings in the court below upon the judgment ap- digitized by goo8 le clvn rnocnonnn 501 pealed from except that where it directs the sale ofper- ishable property the court below may order the proper- fy to be sold and the proceeds thereof to be depos
## 4            the people are liable fer cqqstsin the same eases and to the some extent 49 private parties- if= a private person be joined with the people as p14-ip 135 he is liable in the first instance for the defendantln costs which cannot be recovered of the people 1814 after execution issued therefor against such private party and returned unsatisfied and when costa are awarded and recoverable against the people pay|t ¢| i thereof must be made by the comptmller upon the production of proper evidence thereof amended code §3l9 §88 4 in an acticn prqsgcntcd in the mme of the pqcple qf thjs§ta te fe fha r¢99>9ry qt 1n9n¢1 q pm- qw or to
## 5                   al to cause a copy of the judgment roll to be fonhwith filed in the ofiice of the secretary of state dmended code §-145 § 1062 such secretary must thereupon if the record relate to letters patent make an entry in the records of the commissioners of the land office of the substance and effect of the judgment and of the time when the record thereof was docketed and the real property granted by the letters patent may thereafter be dispo- sed of by such commissioners in the same manner asif the letters patent had never been issued dmmded code § 446 digitized by goo816 avn rnoclbuu 445 chapter x actions ur jnsrxcss oomvrs
## 6                        on the title to real property or to rents or services out of the same be at the time such title first descends or accrues either 1 within the age of twenty-one years or 2 insane or 3 imprisoned on a criminal charge or in execution upon conviction of a criminal offence for a term less than for life or 4 a married woman the time during which such disability continues is not deemed any portion of the time in this chapter lim- ited for the commencement of such action or the ma- king of such entry or defence except that the disabili- digitized by goo8 le cnm nommu 233 ities cannot extend the period of limitation so a
## 7                       nalty or for- feiwe or against a sheriffor other ofiicer for an escape be at the time the cause of action accrued either 1 within the age of twenty-one years or 2 insane or 3 imprisoned on a criminal charge or in execution under the sentence of a criminal court for a term less than his natural life or 4 a married woman the time of such disability is not a part of the time limited for the commencement of the action except digitized by goo8 le civil snocnnvam 239 that the period within which the action must be brought cannot be extended more than five years by any such disability except infancy nor can it be so ext
## 8                    roper- ty issued or made by the people of this state are de- clared void by the determination of a competent court rendered upon an allegation of a fraudulent suggestion concealment forfeiture or mistake or ignorance of a material fact or wrongful detaining or defective title in such case an action for the recovery of the property so conveyed may be brought either by the people of this state or by any subsequent patentee or grantee of the same property his heirs or assigns within twenty years afier such determination but not after that pe- riod hmended code § 77 § 561 no action for the recovery of real property or f
## 9                    e property so conveyed may be brought either by the people of this state or by any subsequent patentee or grantee of the same property his heirs or assigns within twenty years afier such determination but not after that pe- riod hmended code § 77 § 561 no action for the recovery of real property or for the recovery of the possession thereof can be main- tained unless it appear that the plaintiff his ancestor predecessor or grantor was seised or possessed of the property in question within twenty years before the commencement of the action amended code § 78 digitized by goo8 le cxvn rnoclnunr 229 § 562 no cause of ac
## 10                 understanding to know what is intended /imended code § 149 digitized bygoo3le crvu nocnuun 267 § 846 the counterclaim mentioned in the last sec- tion must be one existing in favor of a defendant and against plaintiff between whom a several judgment might be had in the action and arising out of one of the following causes of action 1 a cause of action arising out of the contract or transaction set forth in the complaint as the founda- tion of the plaintifl s claim or connected with the sub- ject of the action 2 in an action arising on obligation any other cause of action arising also on obligation and existing at the c
## 11                          respect or by inserting other allegations material to the case or when the amendment does not change substantially the claim or defence by conforming the pleading or proceeding to the facts proved the court may like- wise in its discretion allow an answer or reply to be made after the time limited by this act or by an order enlarging such time and may also at any time within one year after notice thereo£ relieve a party from~a judgment order or other proceeding taken against him through his mistake inadvertence surprise or excusa- ble neglect and may supply an omission in any pro- ceeding and whenever any pro
## 12                  r by its judgment to direct a sale of the property or any part of it the application of the proceeds to the payment of the amount due on the mortgage lien or incumbrance with costs and execu- tion for the balance against any party liable therefor as principal eurety or otherwise § 904 real property adjudged to be sold must be sold in the county where it lies by the sheriff of the county or by a referee appointed by the court for that purpose and thereupon the sheriff or referee must exe- cute a conveyance to the purchaser which conveyance passes the title of the parties to the action and upon the sale of property rea
## 13                 defendant to answer digitized by goo8 le civil nocmnnz ass upon suchterms as to trial by the cow or referees or as to costs or otherwise asmay be just dmended cude § 172 § 670 the court may at any time in furtherance of justice and on such terms as may be proper amend any pleading or proceeding by adding or striking out the name of any party or by correcting a mistake in the name of a party or a mistake in any other respect or by inserting other allegations material to the case or when the amendment does not change substantially the claim or defence by conforming the pleading or proceeding to the facts proved the cour
## 14             personal claim is made the plaintiff may deliver to him with the summons a notice subscribed by the plaintiff or his attorney setting forth the general object of the action a brief description of the property affected by it if it effect specific real or personal property and that no personal claim is made against such defendant flf a defendant on whom such notice is served unreasona- bly defend the action he must pay costs to the plaintiff hmended code § 130 changed so aa to embrace every action instead of confining it as before to actions for partition of real property or foreclosure of mortgages § 626 in an action affec
## 15              nded code § 138 § 634- from the time of the service of the summons* 4 in a civil action or the allowance of a provisional re- digitized by goo8 le 4 262 *ml oonn or medy the court is deemed to have acquired jurisdiction and to have control of all the subsequent proceedings a voluntary appearance of a defendant is equivalent to personal service of the summons upon him dmmdcd code § 139 enlarged so as to include a volun- tary appearance without service of process title vl of ti-ie ruzwmcs in crvu ac r1ons cxnnn i the pleadings in general ll the complaint iii the demun-er iv the answer v the reply vi generd rules of pleadin
## 16                  twenty-five cents including execution when issued heican s receive uno other féey ibn anya senioesr whhi- digitized by goo8 le 374 rm con or ever in a civil action except for copies of papers at the rate of live cents for every hundred words /imended code § 312 § 876 the fees of referees are three dollars to each for every day spent in the business of the reference but the parties may agree in writing upon any other rate of compensation and thereupon such rate must be allowed amended code §313 §877 when an application is made to a court or referees to postponea trial the payment to the adverse party of a sum not exce
## 17                  d until the expiration of twenty years from the terminag tion of the tenancy or where there has been no writ- ten lease until the expiration of twenty years from the digitized by goo8 le 232 rnmnnor time of the last payment of rent notwithstanding that such tenant may have acquired another title or may have claimed to hold adversely to his landlord but such presumption can not be made alter the periods herein limited ammdai code § 86 § 570 the right of a person to the possession of read property is not impaired or affected by a descent cast in consequence of the death of a person in possession of such property amende
## 18                 any form of such right or interest and for injuries to real property 2 for the partition ofreal property 3 for the foreclosure of a mortgage of real property 4 for the recovery of personal property distrained for any cause /imcnded code § 123 § 617 actions for the following causes must be tried in the county where the cause or some part thereof arose subject fo the like power of the court to change the place of trial as 1 for the recovery of a penalty or forfeiture imposed by statute except that when it is imposed for an ofl fence committed on a lake river or other stream of water situated in two or more counties the
## 19             the property as specified in the affidavit of the plaintiff and freeholders and house- holders of the county and no claim to such property by any other person than the defendant or his agent shall be valid against the sheriff unless so made and notwithstanding such claim when so made he may retain the property a reasonable time to demand such indemnity dmended code § 216 § 713 the sheriff mupt file the notice and aflidavit with his proceedings thereon with the clerk of the court in which the action is pending within twenty days afier taking the property mentioned therein dmended code §217 chapter ih injunction slcrlon 714
## 20 s prescribed in the digitized by goo8 le cxvu procedure 299 next section and when made by a judge may be en- forced as theorder of the court #mended code §218 §715 where it appears by the complaint that the plaintiff is entitled to the relief demanded and such relie£ or any part thereof consists in restraining the commission or continuance of some act the commis- sion or continuance of which during the litigation would produce great or irreparable injury to the plain- till or when during the litigation it appears that the defendant is doing or threatens or is about to do or is procuring or suffering to be done some act in violation o
## 21                       y thc appellant he will not commit or suffer to be committed any waste thereon and that if the judgment be aflirmed he will pay the vadue of the use and occupation of the property from the time of the appeal until the delivery of possession thereof pursuant to the judgment not exceeding a sum to be fixed by a judge of the court by which the judg- ment was rendered and which must be specified in the undertaking when the judgment is for the sale of mortgaged premises and the payment of a deficien- cy arising upon the sale the undertaking must also provide for the payment of such deficiency hmended code §a s8 § 1 1
## 22        ns when to be on oath aw judge may order property to be applied on execution sax judge may appoint receiver and prohibit transfer nc of property sez proc°edings upon claim of another party to property or on denial of indebtedness to judgment debtor sw reference by judge 864- costs of proceeding asc disobedience of order how punished §853 when an execution against property of the judgment debtor or of any one of several debtors in the same judgment issued to the sherilf of the county where he resides or if he do not reside in this state to the sheriff of the county where the judgment roll or a transcript of a justice s judgment
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            dest_code
## 1                     strator a trustee of an express trust or a person expressly authorized by statute may sue without joining with him the person for whose benefit the action is prosecuted a trustee of an express trust within the meaning of this section shall be construed to include u person with whom or in whose name a contract is made for the beneit of another 8as -nr-4 to appear by g-nlln when an infant is a party he must appear by guardian who may be a testamentary or general guardian appointed as is provided by law for the appointment of such guardians or a guardian for the prosecution or defence of the par- ticular action appoin
## 2                      uire the officer to satisfy the judgment out of the personal property of such debtor and if sufficient personal property cannot be found out of the real proper y belonging to him on the day when the judgment was docketed in the county or at any time thereafter 7 diginzed by c008 le 98 the code of 2 if it be against real or personal property in the hands of personal representatives heirs devisees legatees tenants of real property or trustees it shall require the oilicer to satisfy the judgment out of such property 3 if it be against the person of the judgment debtor it shall require the ollicer to arrest such debto
## 3                  tilication shall be upon a notice of not less than five dzi\\ s §\\3ll -existing snlts--porlsllable property may be sold notwithstanding appeal in the cases not provided for in sections three hundred and five three lrundred and six three hundred and seven and three hundred and eight the perfecting of an appeal by giving the undertaking mentioned in section three hundred and tbur shall stay proceedings in the court below upon the judgment appealed from except that whereit directs diginzed by c008 le civil procedure 119 the sale ot perishable property the court below may order fthe property to be sold and the proceeds t
## 4            e shall be liable for costs in the same cases and to the same extent as private parties if a private person be joined with the state as plaintiff he shall be liable in the first instance for the defendant s costs which shall not be recovered of the state till after execution issued therefor against such private party and returned unsatisfied §289 -gosts in action by the sum for a private person in an action prosecuted in the name of the state for the recovery of money or property or to establish a right or claim for the benefit of any county city town village cor- poration or person costs awarded against the plaintiff shall
## 5                   udgment-roll to be forthwith bled in the oflice of the secretary of state $380 -entry ofjndgment relating to letters patent such secretary shall thereupon if the ~record relates to letters patent make an entry in the records of the commis- sioners of the land 0mce of the substance and eeect of such judgment and of the time when the record thereof was docketed and the real property granted by such letters patent may thereafter be disposed of by such commissionem in the same manner as it such letters patent had never been q issued 9881 -4aetlous for farfelture of property to the state whenever by the provisions oflaw a ## 6 ake an entry or defence founded on the title to real property or to rents and services out of the same be at the time such title shall descend or accrue either 1 within the age of twenty-one years or 2 insane or 3 imprisoned on a criminal charge or in execution upon conviction of a criminal olfence or 4 a married woman then such person may notwithstanding the time of limita- tion prescribed in this title be expired commence his action or make his entry within three years next after full age com- ing of sound mind enlargement out of prison or discoverture and at no time thereafter 428 -gnmulatlvo disabilities when ## 7 ake an entry or defence founded on the title to real property or to rents and services out of the same be at the time such title shall descend or accrue either 1 within the age of twenty-one years or 2 insane or 3 imprisoned on a criminal charge or in execution upon conviction of a criminal olfence or 4 a married woman then such person may notwithstanding the time of limita- tion prescribed in this title be expired commence his action or make his entry within three years next after full age com- ing of sound mind enlargement out of prison or discoverture and at no time thereafter 428 -gnmulatlvo disabilities when ## 8 he revised mule applicable to actions of partition the provisions of the revised code relating to the parti- tion of lands tenements and hereditaments held or pos- sessed by joint tenants or tenants in common for the recov- diginzed by c008 le 144 the code of ery of widow s year provisions of dower for the recovery of the possession of real property of habeas corpus and manda- mus shall apply to actions for such purposes brought under this act so ihr as the same can be so applied to the sub- stance and subject-matter of the action without regard to its form chapter iv actions for waste and nuisance §383 -actions of ## 9 he revised mule applicable to actions of partition the provisions of the revised code relating to the parti- tion of lands tenements and hereditaments held or pos- sessed by joint tenants or tenants in common for the recov- diginzed by c008 le 144 the code of ery of widow s year provisions of dower for the recovery of the possession of real property of habeas corpus and manda- mus shall apply to actions for such purposes brought under this act so ihr as the same can be so applied to the sub- stance and subject-matter of the action without regard to its form chapter iv actions for waste and nuisance §383 -actions of ## 10 a defence or counter-claim in ordinary and concise language without repetition §lol -counter-claim t-he counter-claim mentioned in the last section must be one existing in favor of a defendant and against a plaintiff between whom a several judgment might be had in the action and arising out of one of the following causes of action 1 a cause of action arising out of the contract or trans- action set forth in the complaint as the foundation of the plaintiff s claim or connected with the subject of the action 2 in an action arising on contract any other cause of action arising also on contract and existing at the com- me ## 11 hange sub- staintially the claim or defence by conforming the pleading or proceedingto the facts proved <§l38 - -belle ln case of a mistake the judge may likewise in his discretion and upon such terms as may be just allow an answer or reply to be macle or other act to be done after the time limited by this act or by an order enlarge such time and may also in his discre- tion and upon such terms asmay be just at any time within one year after notice thereof relieve a party from a judg- ment order or other proceeding taken against him through his mistake inadvertence surprise or excusable neglect and may supply ## 12 ed to the sheriff of any county where the judgment is docketed \\vhen it requires the delivery of real or personal property it must be issued to the sheriif of the county where the property or some part thereof is situated executions may be issued at the same time to different counties real property adjudged to be sold must be sold in the county where it lies by the sheriff ot the county or by a referee appointed by the court for that purpose and there- diginzed by c008 le civil procedure 97 upon the sheriff or referee must execute a conveyance to the purchaser which conveyance shall be effectual to pass the rights an ## 13 d into as many actions as may be necessary to the proper determination of the causes of action therein mentioned §l82 -amendments by order the court may before and the judge may after judg- ment in furtherance of justice and on such terms as may be proper amend any pleading process or proceeding by adding or striking out the name of any party or by cor- recting a mistake in the name of a party or a mistake in any other respect or by inserting other allegations material to the case or when the amendment does not change sub- staintially the claim or defence by conforming the pleading or proceedingto the facts proved <§l3 ## 14 may deliver to such defendant with diginzed by c008 le 32 the code of the summons a notice subscribed by the plainbilfor his attorney setting forth the general object of the action a brief description of the property aifected by it if it affects real or personal property and that no personal claim is made against such defendant in which case no copy of the com- plaint need be served on such defendant unless withinthe time for answering he shall in writing demand the same if a defendant on whom such notice is served unreasonably defend the action he shall pay costs to the plaintiif §82 -manner nf service af summons the sum ## 15 ce of service 990 -jurisdlctlon-appearance--notlee of lls pendens ~from the time of the service of the summons in a civil action or the allowance of a provisional remedy the court is deemed to have acquired jurisdiction and to have control of all the subsequent proceedings a voluntary appearance ot a defendant is equivalent to personal service of the sum mons upon him in an action affecting the title to real property the plain tifi at the timo of bling the complaint or at any time after wards or whenever a warrant of attachment under chapter four of title ten of this code shall be issued or at any time afterwards the pla ## 16 rd or the court before which the same may be decided or pending or in such other manner as the judge or court may direct$284 -fees of clerks sherllfs te the fees of the clerk sheriffand other oiiicers of the court shall be as prescribed by law $285 -rcferces fee the fees of referees shall be three dollars to each for every day spent in the business of the reference but the parties may agree in writ-ing upon any other rate of compensatoin 286 --costs agdnst lnlant pl-umm when costs are adjudged against an infant plaintifil the guardian by whom he appeared in the action shall be responsible therefor and payment thereof ## 17 deemed the possession of the landlord until the expiration of twenty years from the termination of the tenancy or where there has been no written lease until the expiration of twenty years from the time of the last payment of rent notwithstand- ing that such tenantmay have acquired another title or may have claimed to hold adversely to his landlord but such pre sumptions shall not be made afterthe periods herein limited diginzed by c008 le s 14 the code of 927 -persons under dlsabllltlos if a person entitled to commence any action for the recovery of real property or to make an entry or defence founded on the title t ## 18 or interest and for injuries to real property 2 for the partition of real property 3 for the foreclosure of a mortgage of real property 4 for the recovery of personal property distrained for any cause 901|-lcllol lube tried whore alle olutlon arose actions for the following causes must be tried in the county where the cause or some part thereof arose subject to the like power of the court to change the place of trial in the cases provided in this code 1 for the recovery of a penalty or forfeiture imposed by statute except that when it is imposed for an oifence com- mitted on a sound bay river or other body of water si ## 19 rty as speciied in the afiidavit of the plaintiff and freeholders and house- holders of the county andvno claim to such property by any other person than the defendantor his agent shall be valid against the shcrili unless made as aforesaid and not- withstanding such claim when so made he may retain the property a reasonable time to demand such indemnity \\§i87 -naticc and mam when and where to be med the sheriff shall iile the notice and aifxdavit with his proceedings thereon with the clerkof the court in which the action is pending within twenty days after taking the property mentioned therein chapter 111 injunction §l88-i ## 20 rder of the court upon such order it shall be issued by the clerk of ihe court in which the action is required to be tried §l89--injunctions ln what cases [l] when it shall appear by the complaint that the plaintiff is entitled to the relief demanded and such relief or any part thereof] consists in restraining the commission or continuance of some act the commission or continuance of which during the litigation would produce injuryto the plaintiff or [2] when during the litigation it shall appear that the defendant is doing or threatens or is about to do or procuring or suifering some act to be done in violation of the plaintitl s ri ## 21 by the appellant he will not commit or suffer to be comitted any waste thereon and that if the judgment be affirmed he will pay the value of the use and occupation of the property from the time ot the appeal until the delivery of possession thereof pursuant to the judgment not exceeding a sum to be fixed by a judge of the court by which judgmet was rendered and which shall be speci ed in the undertaking when the judgment is for the sale of mortgaged premises and the payment of a deficiency arising upon the sale the undertaking shall also provide for the payment of such deficiency$308 -existing suits-stay of pro
## 22        sting suits judge may appoint reoeiver and forbid transfer dw of property-order dmc 271 existing suits proceedings upon claim of another par ty to- property or on denial of indebtedness to judgment debtor 272 existing suits refaence by judge 278 existing suits costs of proceeding 274 existing suits disobedience of order how punished title xii of the costs in clvn actions ssc 275 fee bill of attorney abolished 276 when allowed of course to the plaintiti several actions on one instrument 277 when allowed to defendant 278 when allowed to either party ln the discretion of the court 279 amount of costs allowed 280 additional allowa
write.csv(comparison_of_matches, file = "out/matches_ny_nc_kwic.csv")

Now let’s create a density map of where the matching n-grams are in a code. Interesting that the beginning and end of the code have fewer matches.

density_plot_color <- rgb(0.5, 0.5, 0.5, 0.1)
nc_matches <- codes_grams$NC1868.txt %in% cf_ny_nc$matches
nc_matches %>%
plot(type = "h",
col = density_plot_color,
ann = FALSE,
yaxt = "n",
xaxt = "n")
title("Places in NC 1868 Code with Matches in NY 1850 Code",
xlab = "Position in code",
ylab = "")

We can do the same thing with the MI 1853 code and find that it’s not a very good match to the NY 1850 code. The matches that are there are probably just noise or common legal terms and English phrases.

cf_ny_mi <- compare_codes_by_shared_ngrams(codes_grams$NY1850part2.txt, codes_grams$MI1853.txt)
mi_matches <- codes_grams$MI1853.txt %in% cf_ny_mi$matches
mi_matches %>%
plot(type = "h",
col = density_plot_color,
ann = FALSE,
yaxt = "n",
xaxt = "n")
title("Places in MI 1853 Code with Matches in NY 1850 Code",
xlab = "Position in code",
ylab = "")