From a6c2dc1b7d1634717c1ddff58b3bb70330d69db4 Mon Sep 17 00:00:00 2001 From: mdragaschnig <47592782+mdragaschnig@users.noreply.github.com> Date: Wed, 22 Feb 2023 09:22:54 +0000 Subject: [PATCH] Revert "Add actor suggestion" --- README.md | 15 --------------- src/tagpack/cli.py | 31 ------------------------------- src/tagpack/tagstore.py | 11 ----------- 3 files changed, 57 deletions(-) diff --git a/README.md b/README.md index 5bbb828..4a712e2 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ This repository provides a command line tool for managing [GraphSense TagPacks](https://github.com/graphsense/graphsense-tagpacks/wiki/GraphSense-TagPacks). It can be used for 1. [validating TagPacks against the TagPack schema](#validation) -2. finding suitable actors for tags 2. [validating ActorPacks against the ActorPack schema](#actorpack_validation) 3. [handling taxonomies and concepts](#taxonomies) 4. [ingesting TagPacks and related data into a TagStore](#tagstore) @@ -31,20 +30,6 @@ Tagpacks are validated against the [tagpack schema](src/tagpack/conf/tagpack_sch Confidence settings are validated against a set of acceptable [confidence](src/tagpack/db/confidence.csv) values. -## Actors for tags and TagPacks - -[Actors](https://github.com/graphsense/graphsense-tagpacks/wiki/Actors) are defined in a curated actor tagpack. - -It is encouraged to add actors to Tagpacks whenever possible. - -Finding suitable actors is supported by the tagpack-tool. For a specific lable, actor suggestions can be retrieved by calling - - tagpack-tool tagpack suggest_actors - -and if desired, the number of results can be restricted by adding the ``--max`` parameter - - tagpack-tool tagpack suggest_actors --max 1 - ## Validate an ActorPack Validate a single ActorPack file diff --git a/src/tagpack/cli.py b/src/tagpack/cli.py index cd8934e..84a9e2b 100644 --- a/src/tagpack/cli.py +++ b/src/tagpack/cli.py @@ -323,14 +323,6 @@ def validate_tagpack(args): ) -def suggest_actors(args): - print_line(f"Searching suitable actors for {args.label} in TagStore") - - tagstore = TagStore(args.url, args.schema) - candidates = tagstore.find_actors_for(args.label, args.max) - print(f"Found {len(candidates)} matches: {candidates}") - - def insert_tagpack(args): t0 = time.time() print_line("TagPack insert starts") @@ -865,29 +857,6 @@ def main(): ) ptp_i.set_defaults(func=insert_tagpack, url=def_url) - # parser for suggest_actor - ptp_actor = ptp.add_parser("suggest_actors", help="suggest actors ") - ptp_actor.add_argument( - "label", - nargs="?", - help="label string to find actor suggestions for", - ) - ptp_actor.add_argument( - "--schema", - default=_DEFAULT_SCHEMA, - metavar="DB_SCHEMA", - help="PostgreSQL schema for tagpack tables", - ) - ptp_actor.add_argument( - "-u", "--url", help="postgresql://user:password@db_host:port/database" - ) - ptp_actor.add_argument( - "--max", - default=3, - help="Limits the number of results", - ) - ptp_actor.set_defaults(func=suggest_actors, url=def_url) - # parsers for actorpack command parser_ap = subparsers.add_parser("actorpack", help="actorpack commands") diff --git a/src/tagpack/tagstore.py b/src/tagpack/tagstore.py index 0f98929..eac2e84 100644 --- a/src/tagpack/tagstore.py +++ b/src/tagpack/tagstore.py @@ -179,17 +179,6 @@ def insert_actorpack( self.conn.commit() - def find_actors_for(self, label, max_results): - similarity = f"similarity(id, '{label}') > 0.2" - - self.cursor.execute( - f"SELECT id FROM actor WHERE {similarity} " - f"ORDER BY {similarity} DESC " - f"LIMIT {max_results}" - ) - matches = [x[0] for x in self.cursor.fetchall()] - return matches - def low_quality_address_labels(self, th=0.25, currency="", category="") -> dict: """ This function returns a list of addresses having a quality meassure