File size: 3,025 Bytes
14a0518
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
```python

# ProBERT Quick Inference Example

# Zero dependencies beyond transformers + torch



from transformers import AutoModelForSequenceClassification, AutoTokenizer

import torch



# Load frozen model

model = AutoModelForSequenceClassification.from_pretrained("collapseindex/ProBERT-1.0")

tokenizer = AutoTokenizer.from_pretrained("collapseindex/ProBERT-1.0")



def score_text(text: str) -> dict:

    """Score text for rhetorical patterns"""

    inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)

    

    with torch.no_grad():

        outputs = model(**inputs)

    

    probs = torch.softmax(outputs.logits, dim=1)[0]

    

    labels = ["process_clarity", "rhetorical_confidence", "scope_blur"]

    scores_dict = {label: float(probs[i]) for i, label in enumerate(labels)}

    prediction = labels[torch.argmax(probs).item()]

    

    # Confidence: max probability

    confidence = float(probs.max())

    

    # Coherence: margin between top 2 predictions (lower = less clear decision)

    sorted_probs = torch.sort(probs, descending=True)[0]

    coherence = float(sorted_probs[0] - sorted_probs[1])

    

    return {

        **scores_dict,

        "prediction": prediction,

        "confidence": confidence,

        "coherence": coherence

    }



# Test examples

examples = [

    "This revolutionary AI will transform your business and guarantee results.",

    "To implement binary search: 1. Define left and right pointers. 2. Calculate mid. 3. Compare value. If less, move right pointer.",

    "Trust your intuition and embrace the cosmic energy flowing through all things.",

]



for text in examples:

    scores = score_text(text)

    print(f"\nText: {text[:60]}...")

    print(f"Prediction: {scores['prediction']}")

    print(f"  • Process Clarity:        {scores['process_clarity']:.1%}")

    print(f"  • Rhetorical Confidence:  {scores['rhetorical_confidence']:.1%}")

    print(f"  • Scope Blur:             {scores['scope_blur']:.1%}")

    print(f"Confidence: {scores['confidence']:.1%}")

    print(f"Coherence:  {scores['coherence']:.1%} (decision clarity)")

```

**Output Example:**
```

Text: This revolutionary AI will transform your business and guarantee r...

Prediction: rhetorical_confidence

  • Process Clarity:        11.5%

  • Rhetorical Confidence:  67.2%

  • Scope Blur:             21.3%

Confidence: 67.2%

Coherence:  45.9% (decision clarity)



Text: To implement binary search: 1. Define left and right pointers. 2....

Prediction: process_clarity

  • Process Clarity:        79.7%

  • Rhetorical Confidence:  12.3%

  • Scope Blur:             8.0%

Confidence: 79.7%

Coherence:  67.4% (decision clarity)



Text: Trust your intuition and embrace the cosmic energy flowing through all things.

Prediction: scope_blur

  • Process Clarity:        14.2%

  • Rhetorical Confidence:  25.3%

  • Scope Blur:             60.5%

Confidence: 60.5%

Coherence:  35.2% (decision clarity)

```