Skip to content

Commit 5976aaf

Browse files
committed
descriptions networks
1 parent 0040814 commit 5976aaf

13 files changed

Lines changed: 119 additions & 82 deletions

processors/networks/clarifai_bipartite_network.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Google Vision API co-label network
33
"""
4-
from backend.lib.processor import BasicProcessor
4+
from backend.lib.processor import BasicProcessor, ProcessorDescription
55
from common.lib.compatibility import Compatibility
66
from common.lib.outputs import Network
77
from common.lib.helpers import UserInput
@@ -19,15 +19,16 @@ class VisionTagBiPartiteNetworker(BasicProcessor):
1919
Google Vision API co-label network
2020
"""
2121
type = "clarifai-bipartite-network" # job type ID
22-
category = "Networks" # category
23-
title = "Clarifai Bipartite Annotation Network" # title displayed in UI
24-
description = "Create a GEXF network file comprised of all annotations returned by the Clarifai API. Labels " \
25-
"returned by the API, and image file names, are nodes. Edges are created between file names and " \
26-
"labels if the label occurs for the image with that file name."
22+
description = ProcessorDescription(
23+
title="Create Clarifai co-label network",
24+
category="Networks",
25+
tags=["network"],
26+
description="Build a bipartite network from Clarifai image annotations. Image file names and Clarifai labels are the nodes, and an edge connects a file name to a label when Clarifai assigned that label to that image. Use the minimum confidence option to drop low-confidence labels.",
27+
icon="circle-nodes",
28+
)
2729
extension = "gexf" # extension of result file, used internally and in UI
2830
# a graph file, no column table
2931
output = Network()
30-
icon = "circle-nodes"
3132

3233
# Allow processor to run on Clarifai API data
3334
compatibility = Compatibility(types={"clarifai-api"})

processors/networks/colink_urls.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import psutil
99

10-
from backend.lib.processor import BasicProcessor
10+
from backend.lib.processor import BasicProcessor, ProcessorDescription
1111
from common.lib.compatibility import Compatibility
1212
from common.lib.outputs import Network
1313
from common.lib.exceptions import ProcessorInterruptedException
@@ -29,14 +29,16 @@ class URLCoLinker(BasicProcessor):
2929
Generate URL co-link network
3030
"""
3131
type = "url-network" # job type ID
32-
category = "Networks" # category
33-
title = "URL co-occurence network" # title displayed in UI
34-
description = "Create a GEXF network file comprised of URLs appearing together (in a post or thread). " \
35-
"Edges are weighted by amount of co-links." # description displayed in UI
32+
description = ProcessorDescription(
33+
title="Create URL co-link network",
34+
category="Networks",
35+
tags=["urls", "network"],
36+
description="Build a network of URLs that appear together in the same post or thread. Each URL is a node, and edges connect URLs that co-occur. Choose whether to use full URLs or only domain names, and whether to count co-occurrence per post or per thread.",
37+
icon="circle-nodes",
38+
)
3639
extension = "gexf" # extension of result file, used internally and in UI
3740
# a graph file, no column table
3841
output = Network()
39-
icon = "circle-nodes"
4042

4143
# Allow on top-level CSV/NDJSON datasets
4244
compatibility = Compatibility(top_dataset_only=True, extensions={"csv", "ndjson"})

processors/networks/cotag_network.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
from backend.lib.preset import ProcessorPreset
6+
from backend.lib.processor import ProcessorDescription
67
from common.lib.helpers import UserInput
78
from common.lib.compatibility import Compatibility
89
from common.lib.outputs import Delegated
@@ -18,15 +19,16 @@ class CoTaggerPreset(ProcessorPreset):
1819
Generate co-tag network of co-occurring (hash)tags in items
1920
"""
2021
type = "preset-cotag-network" # job type ID
21-
category = "Networks" # category
22-
title = "Co-tag network" # title displayed in UI
23-
description = "Create a GEXF network file of tags co-occurring in a posts. " \
24-
"Edges are weighted by the amount of tag co-occurrences; nodes " \
25-
"are weighted by how often the tag appears in the dataset." # description displayed in UI
22+
description = ProcessorDescription(
23+
title="Co-tag network",
24+
category="Networks",
25+
tags=["hashtags", "network"],
26+
description="Create a network of tags co-occurring in items. Edges are weighted by how often two tags co-occur; nodes are weighted by how often a tag appears in the dataset.",
27+
icon="circle-nodes",
28+
)
2629
extension = "gexf" # extension of result file, used internally and in UI
2730
# a preset; its output is its last step's
2831
output = Delegated()
29-
icon = "circle-nodes"
3032

3133

3234
possible_tag_columns = {"tags", "hashtags", "groups"}

processors/networks/coword_network.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
from backend.lib.preset import ProcessorPreset
6+
from backend.lib.processor import ProcessorDescription
67
from common.lib.compatibility import Compatibility
78
from common.lib.outputs import Delegated
89

@@ -17,13 +18,14 @@ class CowordNetworker(ProcessorPreset):
1718
Generate co-word network
1819
"""
1920
type = "preset-coword-network" # job type ID
20-
category = "Networks" # category
21-
title = "Co-word network" # title displayed in UI
22-
description = "Create a GEXF network file of word co-occurences. Edges denote " \
23-
"words that appear close to each other. Edges and nodes are weighted by the " \
24-
"amount of co-word occurrences." # description displayed in UI
21+
description = ProcessorDescription(
22+
title="Co-word network",
23+
category="Networks",
24+
tags=["network"],
25+
description="Create a network of word co-occurrences. Edges connect words that appear close to each other. Edges and nodes are weighted by how often the words co-occur.",
26+
icon="circle-nodes",
27+
)
2528
extension = "gexf" # extension of result file, used internally and in UI
26-
icon = "circle-nodes"
2729

2830
# a preset; its output is its last step's
2931
output = Delegated()

processors/networks/gexf_to_csv.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Convert a GEXF network file to a CSV file
33
"""
4-
from backend.lib.processor import BasicProcessor
4+
from backend.lib.processor import BasicProcessor, ProcessorDescription
55
from common.lib.compatibility import Compatibility
66
from common.lib.outputs import Table
77

@@ -20,13 +20,16 @@ class GexfToCsv(BasicProcessor):
2020
Convert a GEXF network file to a CSV file
2121
"""
2222
type = "gexf-to-csv"
23-
category = "Networks"
24-
title = "Export Network as CSV Spreadsheet"
25-
description = "Convert a GEXF network file to a CSV spreadsheet"
23+
description = ProcessorDescription(
24+
title="Convert network to CSV",
25+
category="Networks",
26+
tags=["convert format"],
27+
description="Convert a GEXF network file to a CSV file, with one row per edge. Each row lists the source and target nodes, their attributes, and the edge attributes. Edges are sorted by weight, from most to least frequent.",
28+
icon="file-csv",
29+
)
2630
extension = "csv"
2731
# a derived table
2832
output = Table()
29-
icon = "file-csv"
3033

3134
# Allow on GEXF datasets
3235
compatibility = Compatibility(extensions={"gexf"})

processors/networks/google_vision_bipartite_network.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Google Vision API co-label network
33
"""
4-
from backend.lib.processor import BasicProcessor
4+
from backend.lib.processor import BasicProcessor, ProcessorDescription
55
from common.lib.compatibility import Compatibility
66
from common.lib.outputs import Network
77
from common.lib.helpers import UserInput
@@ -20,15 +20,16 @@ class VisionTagBiPartiteNetworker(BasicProcessor):
2020
Google Vision API co-label network
2121
"""
2222
type = "vision-bipartite-network" # job type ID
23-
category = "Networks" # category
24-
title = "Google Vision bipartite annotation network" # title displayed in UI
25-
description = "Create a GEXF network file comprised of all annotations returned by the Google Vision API. Labels " \
26-
"returned by the API, and image file names, are nodes. Edges are created between file names and " \
27-
"labels if the label occurs for the image with that file name."
23+
description = ProcessorDescription(
24+
title="Google Vision bipartite annotation network",
25+
category="Networks",
26+
tags=["network"],
27+
description="Create a network from annotations returned by the Google Vision API. Image file names and the labels returned for them are nodes. An edge connects a file name to a label when that label occurs for that image.",
28+
icon="circle-nodes",
29+
)
2830
extension = "gexf" # extension of result file, used internally and in UI
2931
# a graph file, no column table
3032
output = Network()
31-
icon = "circle-nodes"
3233

3334
# Allow processor to run on Google Vision API data
3435
compatibility = Compatibility(types={"google-vision-api"})

processors/networks/google_vision_network.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Google Vision API co-label network
33
"""
4-
from backend.lib.processor import BasicProcessor
4+
from backend.lib.processor import BasicProcessor, ProcessorDescription
55
from common.lib.compatibility import Compatibility
66
from common.lib.outputs import Network
77
from common.lib.helpers import UserInput
@@ -20,15 +20,16 @@ class VisionTagNetworker(BasicProcessor):
2020
Google Vision API co-label network
2121
"""
2222
type = "vision-label-network" # job type ID
23-
category = "Networks" # category
24-
title = "Google Vision co-Label network" # title displayed in UI
25-
description = "Create a GEXF network file comprised of all annotations returned by the" \
26-
"Google Vision API. Labels returned by the API are nodes. Labels occurring on the same image form" \
27-
"edges."
23+
description = ProcessorDescription(
24+
title="Google Vision co-label network",
25+
category="Networks",
26+
tags=["network"],
27+
description="Create a network from annotations returned by the Google Vision API. Labels returned by the API are nodes. An edge connects two labels when they occur on the same image, weighted by how often they co-occur.",
28+
icon="circle-nodes",
29+
)
2830
extension = "gexf" # extension of result file, used internally and in UI
2931
# a graph file, no column table
3032
output = Network()
31-
icon = "circle-nodes"
3233

3334
# Allow processor to run on Google Vision API data
3435
compatibility = Compatibility(types={"google-vision-api"})

processors/networks/hash_similarity_network.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import networkx as nx
77
import numpy as np
88

9-
from backend.lib.processor import BasicProcessor
9+
from backend.lib.processor import BasicProcessor, ProcessorDescription
1010
from common.lib.compatibility import Compatibility
1111
from common.lib.outputs import Network
1212
from common.lib.exceptions import ProcessorException
@@ -24,13 +24,20 @@ class HashSimilarityNetworker(BasicProcessor):
2424
Compare hashes and generate a network based on similarity
2525
"""
2626
type = "hash-similarity-network"
27-
category = "Networks"
28-
title = "Hash similarity network"
29-
description = "Calculate similarity of hashes and create a GEXF network file. Can identify near duplicate hashes."
27+
description = ProcessorDescription(
28+
title="Hash similarity network",
29+
category="Networks",
30+
tags=["similarity", "network"],
31+
description="Compare bit hashes and create a network linking similar items. Each pair of hashes is compared bit by bit, and an edge is added when they are at least as similar as the chosen threshold. Useful for finding near-duplicate images or videos.",
32+
warnings=[
33+
"Only bit hashes are supported, such as those produced by the video hasher.",
34+
"Every pair of hashes is compared, so this can be slow on large datasets.",
35+
],
36+
icon="circle-nodes",
37+
)
3038
extension = "gexf"
3139
# a graph file, no column table
3240
output = Network()
33-
icon = "circle-nodes"
3441

3542
# Runs on the video hasher's output (like the other video-hash networks); any
3643
# dataset of bit-hash rows would work.

processors/networks/image-network.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
import json
55

6-
from backend.lib.processor import BasicProcessor
6+
from backend.lib.processor import BasicProcessor, ProcessorDescription
77
from common.lib.helpers import hash_file
88

99
import networkx as nx
@@ -27,16 +27,19 @@ class ImageGrapher(BasicProcessor):
2727
images were sourced from
2828
"""
2929
type = "image-bipartite-network" # job type ID
30-
category = "Networks"
31-
title = "Bipartite image-item network" # title displayed in UI
32-
description = ("Create a GEXF network file with a bipartite network of "
33-
"images and some data field (e.g. author) of the dataset "
34-
"the images were sourced from. Suitable for use with Gephi's "
35-
"'Image Preview' plugin.")
30+
description = ProcessorDescription(
31+
title="Bipartite image-item network",
32+
category="Networks",
33+
tags=["network", "authors"],
34+
description="Create a network with a bipartite network of images and a data field (for example author) of the dataset the images were sourced from. Suitable for use with Gephi's Image Preview plugin.",
35+
info=[
36+
"Optionally merge similar images into a single node using file hashing or perceptual hashing.",
37+
],
38+
icon="circle-nodes",
39+
)
3640
extension = "gexf" # extension of result file, used internally and in UI
3741
# a graph file, no column table
3842
output = Network()
39-
icon = "circle-nodes"
4043

4144
# coarse map spec; is_compatible_with (below) is the runtime truth -- it also walks the
4245
# genealogy to find an image-downloader root (get_root_dataset)

processors/networks/quote_network.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
import re
55

6-
from backend.lib.processor import BasicProcessor
6+
from backend.lib.processor import BasicProcessor, ProcessorDescription
77
from common.lib.compatibility import Compatibility
88
from common.lib.outputs import Network
99

@@ -21,14 +21,16 @@ class QuoteNetworkGrapher(BasicProcessor):
2121
Creates a network of posts quoting each other
2222
"""
2323
type = "quote-network" # job type ID
24-
category = "Networks"
25-
title = "Reply network" # title displayed in UI
26-
description = "Create a GEXF network file of posts replying to each other. " \
27-
"Each reference to another post creates an edge between posts. " # description displayed in UI
24+
description = ProcessorDescription(
25+
title="Reply network",
26+
category="Networks",
27+
tags=["network"],
28+
description="Create a network of posts replying to each other. Each reference to another post creates an edge between the two posts.",
29+
icon="circle-nodes",
30+
)
2831
extension = "gexf" # extension of result file, used internally and in UI
2932
# a graph file, no column table
3033
output = Network()
31-
icon = "circle-nodes"
3234

3335
# chan datasets (posts reply to / quote each other)
3436
compatibility = Compatibility(datasources={"fourchan", "eightchan", "eightkun"})

0 commit comments

Comments
 (0)