aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorAdam Janovsky2021-05-19 19:33:57 +0200
committerAdam Janovsky2021-05-19 19:33:57 +0200
commit4b0aed7366f61c96ebd1f3df77746dbbd862092e (patch)
tree3490e43c75945844a54ff25baebc33c10a3c79ae /examples
parent646b4d2a82252998bd4e24edd5ee62fccebf3e19 (diff)
downloadsec-certs-4b0aed7366f61c96ebd1f3df77746dbbd862092e.tar.gz
sec-certs-4b0aed7366f61c96ebd1f3df77746dbbd862092e.tar.zst
sec-certs-4b0aed7366f61c96ebd1f3df77746dbbd862092e.zip
improve readme on labeling
Diffstat (limited to 'examples')
-rw-r--r--examples/readme.md36
1 files changed, 32 insertions, 4 deletions
diff --git a/examples/readme.md b/examples/readme.md
index e92de44f..6e97ecfb 100644
--- a/examples/readme.md
+++ b/examples/readme.md
@@ -1,13 +1,41 @@
## New CommonCriteria API
-New object oriented API. The old one should not be used, unless you explicitly want that. Demo of the tool's capabilities with CommonCriteria dataset can be found in [cc_oop_demo.py](https://github.com/crocs-muni/sec-certs/blob/master/examples/cc_oop_demo.py). Also, comments are provided on separate actions that may serve as a temprorary API documentation :).
-
-To download and build whole dataset can take up to several hours.
+The file [cc_oop_demo.py](cc_oop_demo.py) contains a rough overview of public methods available on `CCDataset`. The chain in which the methods are run roughly corresponds to running `cc-certs all` with CLI.
## Manual CPE labeling
-The tool contains a fuzzy procedure that attempts to map [CPE names](https://nvd.nist.gov/products/cpe) to CC certificates. Result is a list of potentially promising matchings that should be manually evaluated by an analyst to obtain ground truth labeling. The analyst should run the file [cc_cpe_labeling.py](https://github.com/crocs-muni/sec-certs/blob/master/examples/cc_cpe_labeling.py)
+The tool contains a fuzzy procedure that attempts to map [CPE names](https://nvd.nist.gov/products/cpe) to CC certificates. Result is a list of potentially promising matchings that should be manually evaluated by an analyst to obtain ground truth labeling. There are two ways of how one can manually evaluate the suggested matches:
+
+1. Exporting the matches into [label studio](https://labelstud.io/) format, label them there and import the acquired ground truth back into dataset
+2. Do the same thing using command line prompts (unrecommended, further unmaintained)
+
+We proceed with description of both methods.
+
+### Labeling in Label studio
+
+[Label studio](https://labelstud.io/) is a web UI for labeling of datasets. To label CPE dataset, one must do the following:
+
+1. Export the candidate matches into json that can be imported into label studio
+
+```python
+dset = CCDataset.from_json('path/to/your/dataset.json')
+dset.to_label_studio('./label_studio_input.json')
+```
+
+2. Label the instances in the label studio, choose the labeling interface according to example in [label_studio_interface.txt](label_studio_interface.txt) and export them using [JSON-MIN](https://labelstud.io/guide/export.html#JSON-MIN) option into a file, say `./label_studio_output.json`.
+3. Import them back into your dataset and save the updated version of the dataset
+
+```python
+dset = CCDataset.from_json('path/to/your/dataset.json')
+dset.load_label_studio_labels('./label_studio_output.json', update_json=True)
+```
+
+:tada you should now have your dataset labeled.
+
+### Manual labeling
+
+The analyst should run the file [cc_cpe_labeling.py](cc_cpe_labeling.py)
```python
dset = CCDataset({}, Path('./my_debug_datset'), 'cc_full_dataset', 'Full CC dataset')