maifeng commited on
Commit
cd125b5
·
verified ·
1 Parent(s): c3614a5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -19
README.md CHANGED
@@ -16,13 +16,13 @@ widget:
16
 
17
  # Boilerplate Detection for Financial Text
18
 
19
- This model identifies boilerplate (formulaic, repetitive) language in financial documents, distinguishing it from substantive business content. It was developed to preprocess analyst reports for research on corporate culture analysis.
20
 
21
  ## Model Description
22
 
23
- The model uses a frozen sentence transformer (all-mpnet-base-v2) combined with a lightweight classification head to identify boilerplate text segments. Training data consisted of analyst reports from 2000-2020, where boilerplate examples were identified as frequently repeated segments across reports from the same brokerage house.
24
 
25
- The architecture combines mean-pooled embeddings from the sentence transformer with a simple 3-layer neural network (768 → 16 → 8 → 2) for classification. This approach preserves semantic understanding while learning patterns specific to financial boilerplate language.
26
 
27
  ## Usage
28
 
@@ -49,12 +49,15 @@ model.eval()
49
 
50
  # Classify texts
51
  texts = [
52
- "The securities described herein may not be eligible for sale in all jurisdictions.",
53
- "Revenue increased by 15% this quarter due to strong market demand.",
54
- "This report contains forward-looking statements involving risks.",
55
- "Our new product line exceeded initial sales expectations significantly."
56
  ]
57
 
 
 
 
58
  results = []
59
  for text in texts:
60
  inputs = tokenizer(text, return_tensors='pt', truncation=True, max_length=512)
@@ -63,21 +66,19 @@ for text in texts:
63
  outputs = model(**inputs)
64
  probs = torch.nn.functional.softmax(outputs.logits, dim=-1)[0]
65
 
66
- label = 'BOILERPLATE' if probs[1] > 0.5 else 'NOT_BOILERPLATE'
67
- confidence = probs[1].item() if label == 'BOILERPLATE' else probs[0].item()
68
 
69
- results.append({'text': text, 'label': label, 'confidence': confidence})
70
 
71
  for result in results:
72
- print(f"{result['label']:>15}: {result['confidence']:.1%} - {result['text'][:60]}...")
73
  ```
74
 
75
- ## Model Limitations
76
-
77
- This model is specifically trained on financial analyst reports from 2000-2020 and performs best on similar English-language financial documents. It may not generalize well to other domains or document types. The model processes text segments up to 512 tokens and provides binary classification only.
78
-
79
  ## Citation
80
 
 
 
81
  ```bibtex
82
  @article{li2025dissecting,
83
  title={Dissecting Corporate Culture Using Generative AI},
@@ -86,7 +87,3 @@ This model is specifically trained on financial analyst reports from 2000-2020 a
86
  year={2025}
87
  }
88
  ```
89
-
90
- ## License
91
-
92
- Apache 2.0
 
16
 
17
  # Boilerplate Detection for Financial Text
18
 
19
+ This model identifies boilerplate (formulaic, repetitive) language in financial analyst reports and distinguishes it from substantive business content.
20
 
21
  ## Model Description
22
 
23
+ The model uses a frozen sentence transformer (all-mpnet-base-v2) combined with a lightweight classification head to identify boilerplate text segments. Training data consisted of analyst reports from 2000-2020, where boilerplate examples were identified as frequently repeated segments across reports from the same brokerage house. To construct the training dataset, we sampled reports to find the most frequently repeated segments. For a segment to be classified as a positive example, it must be among the top 10% most frequently repeated segments and appear at least five times by the same broker within the same year. Negative examples were identified by randomly selecting segments with no repetition in each broker-year sample.
24
 
25
+ The architecture combines mean-pooled embeddings from the sentence transformer with a simple 3-layer neural network (768 → 16 → 8 → 2) for classification.
26
 
27
  ## Usage
28
 
 
49
 
50
  # Classify texts
51
  texts = [
52
+ "The securities and related financial instruments described herein may not be eligible for sale in all jurisdictions or to certain categories of investors. This material is not intended as an offer or solicitation for the purchase or sale of any security or other financial instrument.",
53
+ "Morgan Stanley & Co. LLC and its affiliates disclaim any and all liability relating to these materials, including, without limitation, any express or implied representations or warranties for statements or errors contained in, or omissions from, these materials.",
54
+ "And while we acknowledge the company has made significant progress on the cost side, Harman will have to consistently execute on those cost cutting initiatives for the next several quarters to help prop-up its low-price and low-margin customized business.",
55
+ "Microsoft's Azure cloud revenue grew 29% year-over-year in constant currency, with particular strength in AI services where usage increased 180% quarter-over-quarter. The company signed 15 new enterprise AI contracts worth over $100 million each during the quarter."
56
  ]
57
 
58
+ # Classification threshold (default 0.5, can be adjusted based on precision/recall requirements)
59
+ threshold = 0.5
60
+
61
  results = []
62
  for text in texts:
63
  inputs = tokenizer(text, return_tensors='pt', truncation=True, max_length=512)
 
66
  outputs = model(**inputs)
67
  probs = torch.nn.functional.softmax(outputs.logits, dim=-1)[0]
68
 
69
+ boilerplate_prob = probs[1].item()
70
+ label = 'BOILERPLATE' if boilerplate_prob > threshold else 'NOT_BOILERPLATE'
71
 
72
+ results.append({'text': text, 'label': label, 'boilerplate_probability': boilerplate_prob})
73
 
74
  for result in results:
75
+ print(f"{result['label']:>15}: {result['boilerplate_probability']:.3f} - {result['text'][:80]}...")
76
  ```
77
 
 
 
 
 
78
  ## Citation
79
 
80
+ If you find the model useful, please cite:
81
+
82
  ```bibtex
83
  @article{li2025dissecting,
84
  title={Dissecting Corporate Culture Using Generative AI},
 
87
  year={2025}
88
  }
89
  ```