Download scripts/create_sample_docs.py from sahilfarib/Legal-Document-Intelligence: direct link, hf CLI and curl.
- Browser
- Download file 16.6 kB
-
https://huggingface.co/spaces/sahilfarib/Legal-Document-Intelligence/resolve/main/scripts/create_sample_docs.py
- Command line
-
hf download hf://spaces/sahilfarib/Legal-Document-Intelligence/scripts/create_sample_docs.py
-
curl -L -o create_sample_docs.py https://huggingface.co/spaces/sahilfarib/Legal-Document-Intelligence/resolve/main/scripts/create_sample_docs.py
16.6 kB
| """ | |
| scripts/create_sample_docs.py — Generate sample legal documents for testing | |
| Creates 4 sample input documents as text files that simulate the legal | |
| documents described in the plan. These can be used directly for testing | |
| the ingestion pipeline. | |
| Run: python scripts/create_sample_docs.py | |
| """ | |
| import sys | |
| from pathlib import Path | |
| PROJECT_ROOT = Path(__file__).parent.parent | |
| sys.path.insert(0, str(PROJECT_ROOT)) | |
| SAMPLE_DIR = PROJECT_ROOT / "data" / "sample_inputs" | |
| SAMPLE_DIR.mkdir(parents=True, exist_ok=True) | |
| def create_contract_messy(): | |
| """3-page service agreement with some OCR-like artifacts.""" | |
| text = """SERVICE AGREEMENT | |
| This Service Agreement ("Agreement") is entered into as of January 15, 2024, | |
| by and between TechCorp Solutions Inc., a Delaware corporation with principal | |
| offices at 500 Technology Drive, Suite 200, Wilmington, DE 19801 ("Provider"), | |
| and Greenfield Properties LLC, a New York limited liability company with | |
| principal offices at 245 Park Avenue, New York, NY 10167 ("Client"). | |
| RECITALS | |
| WHEREAS, Provider is engaged in the business of providing technology | |
| consulting and cloud migration services; and | |
| WHEREAS, Client desires to engage Provider to perform certain technology | |
| consulting services as more fully described herein; | |
| NOW, THEREFORE, in consideration of the mutual covenants and agreements | |
| hereinafter set forth, and for other good and valuable consideration, the | |
| receipt and sufficiency of which are hereby acknowledged, the parties agree | |
| as follows: | |
| ARTICLE 1 — SCOPE OF SERVICES | |
| 1.1 Provider shall deliver cloud migration consulting services as described | |
| in Exhibit A attached hereto and incorporated by reference ("Services"). | |
| 1.2 Services shall commence on February 1, 2024 and continue for a period | |
| of twelve (12) months ("Initial Term"), unless earlier terminated in | |
| accordance with Article 5. | |
| 1.3 The Initial Term shall automatically renew for successive twelve (12) | |
| month periods ("Renewal Terms") unless either party provides written | |
| notice of non-renewal at least ninety (90) days prior to the expiration | |
| of the then-current term. | |
| ARTICLE 2 — COMPENSATION AND PAYMENT | |
| 2.1 Client shall pay Provider a monthly fee of Twenty-Five Thousand Dollars | |
| ($25,000.00) for the Services ("Monthly Fee"), due and payable on the first | |
| business day of each calendar month during the Term. | |
| 2.2 Late payments shall accrue interest at the rate of one and one-half | |
| percent (1.5%) per month, or the maximum rate permitted by applicable law, | |
| whichever is less. | |
| 2.3 Provider shall submit monthly invoices detailing Services performed. | |
| Client shall pay all undisputed amounts within thirty (30) days of receipt | |
| of invoice. | |
| 2.4 In addition to the Monthly Fee, Client shall reimburse Provider for | |
| all reasonable out-of-pocket expenses incurred in connection with the | |
| Services, provided such expenses are pre-approved in writing by Client. | |
| ARTICLE 3 — CONFIDENTIALITY | |
| 3.1 Each party ("Receiving Party") agrees to hold in strict confidence all | |
| Confidential Information disclosed by the other party ("Disclosing Party") | |
| during the Term and for a period of three (3) years following termination | |
| or expiration of this Agreement. | |
| 3.2 "Confidential Information" means any non-public information, whether | |
| written, oral, or electronic, including but not limited to trade secrets, | |
| business plans, financial information, customer data, and technical | |
| specifications. | |
| 3.3 The obligations of confidentiality shall not apply to information that: | |
| (a) is or becomes publicly available through no fault of the Receiving Party; | |
| (b) was in the Receiving Party's possession prior to disclosure; | |
| (c) is independently developed by the Receiving Party; or | |
| (d) is disclosed pursuant to a court order or legal requirement. | |
| ARTICLE 4 — LIMITATION OF LIABILITY | |
| 4.1 IN NO EVENT SHALL PROVIDER'S TOTAL LIABILITY UNDER THIS AGREEMENT EXCEED | |
| THE AGGREGATE FEES PAID BY CLIENT DURING THE SIX (6) MONTHS IMMEDIATELY | |
| PRECEDING THE EVENT GIVING RISE TO THE CLAIM. | |
| 4.2 IN NO EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT, INCIDENTAL, | |
| SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, INCLUDING BUT NOT LIMITED TO | |
| LOSS OF PROFITS, LOSS OF DATA, OR BUSINESS INTERRUPTION. | |
| 4.3 The limitations set forth in this Article 4 shall not apply to: | |
| (a) breaches of Article 3 (Confidentiality); | |
| (b) willful misconduct or gross negligence; or | |
| (c) indemnification obligations under Article 6. | |
| ARTICLE 5 — TERMINATION | |
| 5.1 Either party may terminate this Agreement for convenience upon sixty | |
| (60) days prior written notice to the other party. | |
| 5.2 Either party may terminate this Agreement immediately upon written | |
| notice if the other party: | |
| (a) commits a material breach that remains uncured for thirty (30) days | |
| after written notice thereof; or | |
| (b) becomes insolvent, files for bankruptcy, or makes an assignment for | |
| the benefit of creditors. | |
| 5.3 Upon termination, Provider shall deliver to Client all work product | |
| completed through the date of termination. | |
| ARTICLE 6 — INDEMNIFICATION | |
| 6.1 Provider shall indemnify and hold harmless Client from any third-party | |
| claims arising from Provider's negligence or willful misconduct in | |
| performing the Services. | |
| ARTICLE 7 — GOVERNING LAW | |
| 7.1 This Agreement shall be governed by and construed in accordance with | |
| the laws of the State of New York, without regard to its conflict of | |
| laws principles. | |
| 7.2 Any disputes arising under this Agreement shall be submitted to binding | |
| arbitration in New York City under the rules of the American Arbitration | |
| Association. | |
| IN WITNESS WHEREOF, the parties have executed this Agreement as of the | |
| date first written above. | |
| TECHCORP SOLUTIONS INC. | |
| By: ________________________ | |
| Name: John Smith | |
| Title: Chief Executive Officer | |
| Date: January 15, 2024 | |
| GREENFIELD PROPERTIES LLC | |
| By: ________________________ | |
| Name: Sarah Johnson | |
| Title: Managing Partner | |
| Date: January 15, 2024 | |
| """ | |
| path = SAMPLE_DIR / "contract_messy.txt" | |
| path.write_text(text, encoding="utf-8") | |
| print(f"Created: {path}") | |
| def create_litigation_memo(): | |
| """Internal litigation memo with inconsistent formatting.""" | |
| text = """PRIVILEGED AND CONFIDENTIAL | |
| ATTORNEY WORK PRODUCT | |
| INTERNAL MEMORANDUM | |
| TO: Harvey Specter, Senior Partner | |
| FROM: Mike Ross, Associate | |
| DATE: March 10, 2024 | |
| RE: Greenfield Properties LLC v. TechCorp Solutions Inc. | |
| Case No. 2024-CV-3847 (S.D.N.Y.) | |
| I. EXECUTIVE SUMMARY | |
| This memorandum addresses the breach of contract claim filed by our client, | |
| Greenfield Properties LLC ("Greenfield"), against TechCorp Solutions Inc. | |
| ("TechCorp") in connection with the Service Agreement dated January 15, 2024 | |
| (the "Agreement"). Based on my analysis, Greenfield has strong grounds for | |
| both breach of contract and potential fraud claims. | |
| II. FACTUAL BACKGROUND | |
| A. The Agreement | |
| On January 15, 2024, Greenfield entered into a twelve-month Service Agreement | |
| with TechCorp for cloud migration consulting services at a monthly rate of | |
| $25,000. The Agreement specified detailed deliverables in Exhibit A, including: | |
| - Phase 1: Infrastructure assessment (Feb 1 - Mar 15, 2024) | |
| - Phase 2: Database migration (Mar 16 - May 31, 2024) | |
| - Phase 3: Application migration (Jun 1 - Aug 31, 2024) | |
| - Phase 4: Security audit and compliance (Sep 1 - Oct 31, 2024) | |
| - Phase 5: Testing and go-live (Nov 1 - Jan 15, 2025) | |
| B. Performance Failures | |
| TechCorp commenced work on February 1, 2024 as scheduled. Phase 1 was | |
| completed on time. However, beginning in April 2024, significant problems | |
| emerged: | |
| 1. Database migration (Phase 2) fell 45 days behind schedule | |
| 2. Two senior consultants — James Chen and Maria Garcia — were reassigned | |
| to another client project without notice on April 15, 2024 | |
| 3. Replacement consultants lacked necessary cloud certification | |
| 4. The security audit deliverable (Phase 4) was never initiated | |
| 5. TechCorp failed to respond to three formal written complaints | |
| dated May 1, June 15, and July 20, 2024 | |
| C. Financial Impact | |
| Greenfield has incurred the following damages: | |
| - Fees paid to TechCorp: $175,000 (7 months x $25,000) | |
| - Cost of emergency replacement vendor: $120,000 | |
| - Lost revenue from delayed platform launch: $155,000 (estimated) | |
| - Regulatory penalties for missed compliance deadline: $50,000 | |
| Total estimated damages: $500,000 | |
| III. LEGAL ANALYSIS | |
| A. Breach of Contract | |
| TechCorp materially breached the Agreement by: | |
| 1. Failing to meet Phase 2 deliverable timeline | |
| 2. Reassigning key personnel without consent (violation of implied duty) | |
| 3. Failing to complete Phase 4 security audit | |
| 4. Non-response to formal breach notices | |
| The Agreement's termination clause (Section 5.2(a)) requires 30 days to | |
| cure after written notice. Greenfield sent three notices over 80+ days | |
| with no cure. Termination was proper. | |
| B. Limitation of Liability Challenge | |
| The Agreement contains a limitation of liability clause (Article 4) capping | |
| damages at six months of fees ($150,000). However, we have strong grounds | |
| to argue this clause should not apply: | |
| 1. UNCONSCIONABILITY: The clause was presented on a take-it-or-leave-it | |
| basis with no opportunity for negotiation. Greenfield was not | |
| represented by counsel at signing. | |
| 2. WILLFUL MISCONDUCT EXCEPTION: Article 4.3(b) excludes "willful | |
| misconduct or gross negligence." TechCorp's deliberate reassignment | |
| of key personnel and failure to respond to breach notices arguably | |
| constitutes willful misconduct. | |
| 3. PUBLIC POLICY: Enforcing the cap would leave Greenfield unable to | |
| recover regulatory penalties caused by TechCorp's failure to complete | |
| the security audit. | |
| C. Potential Fraud Claim | |
| Discovery may reveal that TechCorp knew at the time of contracting that | |
| it lacked sufficient staff to perform the services. The reassignment of | |
| Chen and Garcia just 10 weeks into the engagement suggests pre-existing | |
| resource constraints. If proven, this would support a fraudulent | |
| inducement claim and potentially void the limitation clause entirely. | |
| RED FLAGS IDENTIFIED: | |
| - TechCorp's 10-K filing shows 30% headcount reduction in Q4 2023 | |
| - Two other clients have filed similar breach claims (public records) | |
| - TechCorp's CFO resigned unexpectedly in March 2024 | |
| - The limitation clause may violate NY General Obligations Law § 5-323 | |
| IV. RECOMMENDED STRATEGY | |
| 1. File motion to invalidate the limitation of liability clause based on | |
| unconscionability and the willful misconduct exception. | |
| 2. Seek total damages of $500,000 plus attorneys' fees. | |
| 3. Propound targeted discovery on: | |
| - TechCorp's staffing levels at time of contracting | |
| - Internal communications regarding personnel reassignment | |
| - Other pending breach claims against TechCorp | |
| 4. Consider moving for preliminary injunction to preserve TechCorp's | |
| financial records given recent CFO departure. | |
| V. OPEN QUESTIONS | |
| - Need client confirmation on exact lost revenue calculations | |
| - Should we pursue arbitration (per Section 7.2) or challenge the | |
| arbitration clause as part of the unconscionability argument? | |
| - Timeline for motion practice if we proceed in court | |
| Please advise on preferred strategy by March 20, 2024. | |
| Respectfully submitted, | |
| Mike Ross | |
| Associate, Litigation Department | |
| """ | |
| path = SAMPLE_DIR / "litigation_memo.txt" | |
| path.write_text(text, encoding="utf-8") | |
| print(f"Created: {path}") | |
| def create_legal_notice(): | |
| """Eviction notice - would be low-res scan in production.""" | |
| text = """NOTICE TO QUIT AND VACATE | |
| Date: February 28, 2024 | |
| TO: Robert Williams | |
| Apartment 4B | |
| 1247 Riverside Drive | |
| New York, NY 10033 | |
| FROM: Riverside Management Corp. | |
| Property Manager for Riverside Towers | |
| 1247 Riverside Drive | |
| New York, NY 10033 | |
| NOTICE IS HEREBY GIVEN that you are required to quit and vacate the | |
| above-described premises within THIRTY (30) DAYS of the date of this | |
| notice, specifically by March 30, 2024. | |
| GROUNDS FOR EVICTION: | |
| This notice is issued pursuant to New York Real Property Law § 232-a | |
| and New York City Rent Stabilization Code § 2524.3 for the following | |
| reasons: | |
| 1. NON-PAYMENT OF RENT: You have failed to pay rent for the months | |
| of December 2023, January 2024, and February 2024, totaling | |
| $7,500.00 (3 months x $2,500.00/month). | |
| 2. LEASE VIOLATIONS: Multiple complaints have been received from | |
| neighboring tenants regarding: | |
| (a) Excessive noise after 10:00 PM on multiple occasions | |
| (b) Unauthorized occupants residing in the premises | |
| (c) Failure to maintain premises in clean and sanitary condition | |
| CURE PERIOD: | |
| You may cure the non-payment default by paying all outstanding rent | |
| plus late fees totaling $7,725.00 within fourteen (14) days of this | |
| notice. Payment must be made by certified check or money order. | |
| FAILURE TO COMPLY: | |
| If you fail to vacate the premises or cure the default within the | |
| specified period, legal proceedings will be commenced to obtain a | |
| judgment of possession and a warrant of eviction. | |
| YOUR RIGHTS: | |
| You have the right to: | |
| - Contest this notice in Housing Court | |
| - Request a hearing before a judge | |
| - Seek legal assistance from Legal Aid Society | |
| - Contact 311 for tenant rights information | |
| This notice is being served by personal delivery and certified mail, | |
| return receipt requested. | |
| _________________________ | |
| Margaret Chen | |
| Property Manager | |
| Riverside Management Corp. | |
| Tel: (212) 555-0147 | |
| """ | |
| path = SAMPLE_DIR / "legal_notice_scan.txt" | |
| path.write_text(text, encoding="utf-8") | |
| print(f"Created: {path}") | |
| def create_deed_with_notes(): | |
| """Property deed — in production this would be an image with handwriting.""" | |
| text = """QUITCLAIM DEED | |
| STATE OF NEW YORK | |
| COUNTY OF MANHATTAN | |
| KNOW ALL MEN BY THESE PRESENTS: | |
| That JAMES R. MORRISON and PATRICIA A. MORRISON, husband and wife, | |
| residing at 892 West End Avenue, New York, NY 10025, ("Grantors"), | |
| for and in consideration of the sum of ONE MILLION TWO HUNDRED | |
| THOUSAND DOLLARS ($1,200,000.00) and other good and valuable | |
| consideration, receipt of which is hereby acknowledged, | |
| do hereby REMISE, RELEASE, AND QUITCLAIM unto: | |
| DAVID L. CHEN and JENNIFER S. CHEN, husband and wife, as tenants | |
| by the entirety, residing at 156 East 72nd Street, New York, NY | |
| 10021, ("Grantees"), | |
| all right, title, interest, claim and demand which the Grantors | |
| have or may have in and to the following described property: | |
| PROPERTY DESCRIPTION: | |
| ALL that certain lot, piece or parcel of land, with the buildings | |
| and improvements thereon, situate, lying and being in the Borough | |
| of Manhattan, City of New York, County of New York, State of New | |
| York, bounded and described as follows: | |
| Block: 1847 | |
| Lot: 42 | |
| Address: 892 West End Avenue, Unit 12A | |
| New York, NY 10025 | |
| Together with the appurtenances and all the estate and rights of | |
| the Grantors in and to said premises. | |
| SUBJECT TO: | |
| - All covenants, restrictions, and easements of record | |
| - Building and zoning regulations | |
| - Current real estate taxes not yet due and payable | |
| - Mortgage held by First National Bank, dated June 1, 2019, | |
| in the original amount of $800,000.00 | |
| [Handwritten note in margin: "Verify mortgage payoff amount with | |
| First National — may have been partially paid down. Check title | |
| insurance requirements. — JRM 11/15/2023"] | |
| TO HAVE AND TO HOLD the same together with all and singular the | |
| rights, privileges, and appurtenances thereunto belonging, unto | |
| the Grantees, their heirs and assigns forever. | |
| IN WITNESS WHEREOF, the Grantors have hereunto set their hands | |
| and seals this 5th day of December, 2023. | |
| _________________________ _________________________ | |
| James R. Morrison Patricia A. Morrison | |
| (Seal) (Seal) | |
| STATE OF NEW YORK ) | |
| ) ss.: | |
| COUNTY OF NEW YORK ) | |
| On December 5, 2023, before me personally appeared JAMES R. MORRISON | |
| and PATRICIA A. MORRISON, known to me to be the persons described in | |
| and who executed the foregoing instrument, and acknowledged that they | |
| executed the same as their free act and deed. | |
| _________________________ | |
| Notary Public | |
| Commission Expires: March 15, 2025 | |
| [Handwritten note at bottom: "Filed with NYC Register 12/20/2023. | |
| Recording #2023-NY-847291. Transfer tax paid: $21,000. — Office"] | |
| """ | |
| path = SAMPLE_DIR / "deed_with_notes.txt" | |
| path.write_text(text, encoding="utf-8") | |
| print(f"Created: {path}") | |
| if __name__ == "__main__": | |
| print("Creating sample legal documents...") | |
| create_contract_messy() | |
| create_litigation_memo() | |
| create_legal_notice() | |
| create_deed_with_notes() | |
| print(f"\nAll documents created in: {SAMPLE_DIR}") | |