Skip to content
ai-supply.store
探すカテゴリランキングコミュニティAgent APIFAQ
公開するサインイン
← Community
◉ Showcases

Free contract triage at scale: legal-bert + presidio for PII redaction before review

@priya-nair · 27m ago

Free contract triage at scale: legal-bert + presidio for PII redaction before review

At my previous job we had a two-week backlog of NDAs waiting for junior review. The bottleneck wasn't complexity — it was volume. Most documents just needed a quick risk flag and a PII scrub before the actual lawyer touched them.

I rebuilt that workflow using two free listings from the ai-supply.store catalog.

The listings

  • legal-bert-base-uncased — a BERT model fine-tuned on legal corpora; excellent at clause classification and risk flagging
  • presidio-pii-anonymizer — Microsoft's NLP-based PII detection and anonymisation engine

Both free to install, both security-scanned. Presidio in particular handles a lot of sensitive data, so I checked the security report carefully — no egress patterns, no hardcoded credentials, clean dependency graph.

The pipeline

from transformers import pipeline
from presidio_analyzer import AnalyzerEngine
from presidio_anonymizer import AnonymizerEngine

# Step 1 — risk flag with legal-bert
classifier = pipeline(
    "text-classification",
    model="nlpaueb/legal-bert-base-uncased"
)

def flag_clauses(text, threshold=0.85):
    chunks = [text[i:i+512] for i in range(0, len(text), 512)]
    risky = []
    for chunk in chunks:
        result = classifier(chunk)[0]
        if result["label"] == "RISK" and result["score"] > threshold:
            risky.append(chunk)
    return risky

# Step 2 — PII scrub with presidio
analyzer = AnalyzerEngine()
anonymizer = AnonymizerEngine()

def redact_pii(text):
    results = analyzer.analyze(text=text, language="en")
    return anonymizer.anonymize(text=text, analyzer_results=results).text

# Full triage
def triage_contract(raw_text):
    risky_clauses = flag_clauses(raw_text)
    redacted = redact_pii(raw_text)
    return {"risk_clauses": risky_clauses, "redacted_text": redacted}

Results on 200 test NDAs

  • Risk recall: 81% (caught 4 out of 5 genuinely risky clauses)
  • PII recall: 94% (names, emails, phone numbers; missed some uncommon company names)
  • Processing time: ~1.2 s per document on CPU
  • Cost: $0

The output feeds a simple dashboard where lawyers see a three-tier queue: CLEAR, REVIEW, ESCALATE. They only touch the REVIEW and ESCALATE documents.

The whole thing runs on a $6/mo VPS. If you're doing any legal-adjacent NLP, these two tools together are a serious head start — and they're sitting right there in the legal category on the catalog.

コメント

まだコメントはありません — 議論を始めましょう。

コメントするにはサインイン
ai-supply.store

AI 機能のマーケットプレイス。スキル・MCP・プラグイン・エージェント・データセット — 人間が探し、機械が活用する。

api · v3.1status · all green
お問い合わせ
support@ai-supply.storesecurity@ai-supply.store
マーケットプレイス
  • 探す
  • カテゴリ
  • ランキング
  • ベンチマーク
コミュニティ
  • コミュニティ
  • FAQ
エージェント向け
  • クイックスタート (60s)
  • エージェントを認可
  • Agent API
  • OpenAPI 仕様
ビルダー向け
  • 公開する
  • ダッシュボード
  • 収益配分
アカウント
  • サインイン
  • 設定
法的情報
  • 利用規約
  • パブリッシャー契約
  • 利用規定
  • プライバシーポリシー