selfconstruct3d commited on
Commit
6508073
·
verified ·
1 Parent(s): c789033

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +51 -11
README.md CHANGED
@@ -1,24 +1,64 @@
1
- !pip install gliner
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  from gliner import GLiNER
4
 
5
- ### Load model directly from Hugging Face
6
  model = GLiNER.from_pretrained("selfconstruct3d/AITSecNER", load_tokenizer=True)
 
7
 
 
 
 
 
 
 
8
  text = """
9
- Upon opening Emotet maldocs , victims are greeted with fake Microsoft 365 prompt that states “ THIS DOCUMENT IS PROTECTED , ” and instructs victims on how to enable macros .
 
10
  """
11
 
12
- ### Labels for entity prediction
13
- labels = ['CLICommand/CodeSnippet','CON','DATE','GROUP','LOC','MALWARE','ORG','SECTOR','TACTIC','TECHNIQUE','TOOL']
 
 
 
14
 
15
- ### Perform entity prediction
16
  entities = model.predict_entities(text, labels, threshold=0.5)
17
 
18
- ### Display predicted entities and their labels
19
  for entity in entities:
20
- print(entity["text"], "=>", entity["label"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
- #### Output:
23
- #### Emotet => MALWARE
24
- #### Microsoft => ORG
 
1
+ # AITSecNER - Entity Recognition for Cybersecurity
2
 
3
+ This repository demonstrates how to use the **AITSecNER** model hosted on Hugging Face, based on the powerful GLiNER library, to extract cybersecurity-related entities from text.
4
+
5
+ ## Installation
6
+
7
+ Install GLiNER via pip:
8
+
9
+ ```bash
10
+ pip install gliner
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### Import and Load Model
16
+
17
+ Load the pretrained AITSecNER model directly from Hugging Face:
18
+
19
+ ```python
20
  from gliner import GLiNER
21
 
 
22
  model = GLiNER.from_pretrained("selfconstruct3d/AITSecNER", load_tokenizer=True)
23
+ ```
24
 
25
+ ### Predict Entities
26
+
27
+ Define the input text and entity labels you wish to extract:
28
+
29
+ ```python
30
+ # Example input text
31
  text = """
32
+ Upon opening Emotet maldocs, victims are greeted with fake Microsoft 365 prompt that states
33
+ “THIS DOCUMENT IS PROTECTED,” and instructs victims on how to enable macros.
34
  """
35
 
36
+ # Entity labels
37
+ labels = [
38
+ 'CLICommand/CodeSnippet', 'CON', 'DATE', 'GROUP', 'LOC',
39
+ 'MALWARE', 'ORG', 'SECTOR', 'TACTIC', 'TECHNIQUE', 'TOOL'
40
+ ]
41
 
42
+ # Predict entities
43
  entities = model.predict_entities(text, labels, threshold=0.5)
44
 
45
+ # Display results
46
  for entity in entities:
47
+ print(f"{entity['text']} => {entity['label']}")
48
+ ```
49
+
50
+ ### Sample Output
51
+
52
+ ```bash
53
+ Emotet => MALWARE
54
+ Microsoft => ORG
55
+ ```
56
+
57
+ ## About
58
+
59
+ **AITSecNER** leverages GLiNER to quickly and accurately extract cybersecurity-specific entities, making it highly suitable for tasks such as:
60
+
61
+ - Cyber threat intelligence analysis
62
+ - Incident response documentation
63
+ - Automated cybersecurity reporting
64