{"id":20313588,"url":"https://github.com/moosetechnology/labelcontractor","last_synced_at":"2025-09-06T09:42:42.351Z","repository":{"id":44780284,"uuid":"357465649","full_name":"moosetechnology/LabelContractor","owner":"moosetechnology","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-24T14:03:26.000Z","size":1365,"stargazers_count":2,"open_issues_count":10,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T17:16:45.849Z","etag":null,"topics":["pharo"],"latest_commit_sha":null,"homepage":"","language":"Smalltalk","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moosetechnology.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-13T07:40:48.000Z","updated_at":"2024-05-24T14:03:30.000Z","dependencies_parsed_at":"2025-04-11T17:25:46.650Z","dependency_job_id":null,"html_url":"https://github.com/moosetechnology/LabelContractor","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/moosetechnology/LabelContractor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosetechnology%2FLabelContractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosetechnology%2FLabelContractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosetechnology%2FLabelContractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosetechnology%2FLabelContractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moosetechnology","download_url":"https://codeload.github.com/moosetechnology/LabelContractor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moosetechnology%2FLabelContractor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273886630,"owners_count":25185509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pharo"],"created_at":"2024-11-14T18:11:55.251Z","updated_at":"2025-09-06T09:42:42.285Z","avatar_url":"https://github.com/moosetechnology.png","language":"Smalltalk","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Label Contractor\n\n## **Installation**\nIn order to install this project, on a Pharo 9.0/Moose Suite 9.0 image execute the following script in the Playground:\n```Smalltalk\nMetacello new\n  baseline: 'LabelContractor';\n  repository: 'github://moosetechnology/LabelContractor/src';\n  load\n```  \nThe full project including examples of the application of LabelContractor on visualizations and [Spec2](https://github.com/pharo-spec/Spec) can be obtained with:\n```Smalltalk\nMetacello new\n  baseline: 'LabelContractor';\n  repository: 'github://moosetechnology/LabelContractor/src';\n  load: 'full'\n``` \n## **LabelContractor description**\nThe LabelContractor is a tool will allow reducing labels on visualizations using different strategies. Currently, the Contractor provides 13 different contraction strategies and 2 ways to combine them.\n\n## **Contents:**\n- [Description of each strategy](#strategies-description)\n- [How to combine strategies](#how-to-combine-strategies)\n- [How to use the Contractor](#how-to-reduce-a-label-using-contractor)\n\n## The original images of the examples on which the different strategies are applied:\nThe first image represents an example of visualization which contains boxes with labels above and the second image is a list of all the classes of the system built by spec2.\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"images/roassalExamples/original_visualization.png\" width=\"1300\" /\u003e\n  \u003cimg src=\"images/specListExamples/originalList.png\" width=\"450\" /\u003e \n\u003c/p\u003e\n\n## **Strategies description**\n\n*For each strategy, we show two examples, the top image represents the application of a strategy to a visualization and the one at the bottom is the application of a strategy to a list of all classes in the system generated by spec2.*\n\n**Note:** By default we remove 'path' if the string to be reduced represents a fully qualifed file name(but theres an option to keep it).  \nThere are 13 ways to reduce labels:\n\n### **1. LbCAbbreviateNamesStrategy**\nIt allows to keep only the initial letter of each name except the last one('ExampleSomething' -\u003e 'ESomething'). By default it takes the 1st letter of the first 3 names.\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"images/roassalExamples/abbreviateNamesStrategy.png\" width=\"800\" /\u003e\n  \u003cimg src=\"images/specListExamples/abbreviateNamesStrategy.png\" width=\"320\" /\u003e \n\u003c/p\u003e\n\n### **2. LbCRemoveFilenameExentsionStrategy** \nFor strings representing a fully qualified filename, only the name of the file is kept by removing its extension. (eg: 'example.txt' -\u003e 'example').\n\n### **3. LbCEllipsisStrategy** \nConsists in keeping a certain first and last letter of the string separated by a tiled ('\\~'). By default we reduce up to 8 characters (without counting '\\~'). ('anExample' -\u003e 'anEx~mple').\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"images/roassalExamples/ellipsisStrategy.png\" width=\"800\" /\u003e\n  \u003cimg src=\"images/specListExamples/ellipsisStrategy.png\" width=\"320\" /\u003e \n\u003c/p\u003e\n\n### **4. LbCPickFirstCharactersStrategy** \nAllows to keep some first letters of the string. By default, we keep the 8 first letters.\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"images/roassalExamples/pickFirstLettersStrategy.png\" width=\"800\" /\u003e\n  \u003cimg src=\"images/specListExamples/pickFirstLettersStrategy.png\" width=\"300\" /\u003e \n\u003c/p\u003e\n\n### **5. LbCRemoveFrequentLettersStrategy:** \nAllows you to remove frequent letters from a string until having the choosen size. By default we reduce until having a string of length 8.\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"images/roassalExamples/removeFrequentLettersStrategy.png\" width=\"800\" /\u003e\n  \u003cimg src=\"images/specListExamples/removeFrequentLettersStrategy.png\" width=\"300\" /\u003e \n\u003c/p\u003e\n\n### **6. LbCRemoveAnySubstringStrategy** \nAllows you to remove all the occurrences of each substring from the string you want to reduce.\n\n-\u003e on the following visualization(left picture) we have removed { 'Hashed'. 'Moose'. 'value'. 'Identity' } from labels.\n\n-\u003e on the spec list(right picture) we removed the following substrings { 'ast'. 'Test'. 'Abstract' }.\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"images/roassalExamples/removeAnySubstringStrategy.png\" width=\"900\" /\u003e\n  \u003cimg src=\"images/specListExamples/removeAnySubstringStrategy.png\" width=\"320\" /\u003e \n\u003c/p\u003e\n\n### **7. LbCRemovePrefixStrategy:** \nAllows you to remove a substring(s) which is the prefix of the string you want to reduce.\n\n-\u003e on the following visualization(left picture) we have removed { 'Hashed'. 'Moose'. 'Wide'. 'small'. 'Identity' } from labels.\n\n-\u003e on the spec list(right picture) we removed the following substrings { 'abstract'. 'ast' }.\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"images/roassalExamples/removePrefixStrategy.png\" width=\"900\" /\u003e\n  \u003cimg src=\"images/specListExamples/removePrefixStrategy.png\" width=\"300\" /\u003e \n\u003c/p\u003e\n\n### **8. LbCRemoveSuffixStrategy** \nAllows you to remove a substring(s) which is the suffix of the string that you want to reduce.\n\n-\u003e on the following visualization we removed { 'Storage'. 'Moose'. 'Bag'. 'Array'. 'set' } from labels\n\n-\u003e on the spec list(right picture) we removed { 'Test' }\n\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"images/roassalExamples/removeSuffixStrategy.png\" width=\"900\" /\u003e\n  \u003cimg src=\"images/specListExamples/removeSuffixStrategy.png\" width=\"300\" /\u003e \n\u003c/p\u003e\n\n### **9. LbCRemoveVowelsStrategy:** \nConsists in removing all the vowels (the letter 'y' is an exception in English, it's removed only when it represents a vowel) from the string.\n\u003cp float=\"left\"\u003e\n  \u003cimg src=\"images/roassalExamples/removeVowelsStrategy.png\" width=\"850\" /\u003e\n  \u003cimg src=\"images/specListExamples/removeVowelsStrategy.png\" width=\"320\" /\u003e \n\u003c/p\u003e\n\n### **10. LbCRemoveAnyWordsAtStrategy:** \nAllows you to remove some words(one or a group) specified by its indexes. In this strategy, we also avoid having an empty string after the reduction. That is to say that the strings composed of only one word are never reduced (otherwise, we completely lose the information).\n\n**Example: remove the 4th word(wich is 'Filename')**\n\nLbCRemoveFilenameExtensionStrategy \u003c/br\u003e\n--\u003e LbCRemoveExtensionStrategy\n\n**Explication:**\n\n    splitted string: Lb|C|Remove|Filename|Extension|Strategy \n    index of words : 1 |2|   3  |    4   |    5    |    6\n\n### **11. LbCRemoveFirstWordStrategy** \nThis is a specific case of the last strategy, it allows you to remove only the first word(word at index 1).\n\n### **12. LbCRemoveLastWordStrategy** \nThe same logic, it allows you to remove only the last word.\n\n### **13. LbCSubstituteSubstringsStrategy** \nIt is a strategy that makes it possible to replace an old substring with a new one.\n\n# **How to combine strategies**\n## The user provides an order of strategies\nThe user can provide an order of strategeis, and we apply them one by one.\n\n**Example:**\nClyMergedSuperclassesAndInheritedTraitsHierarchyTest \u003c/br\u003e\u003c/br\u003e\nRemovePrefixStrategy ('Cly') \u003c/br\u003e\nRemoveSuffixStrategy ('Test') \u003c/br\u003e\nRemoveVowelsStrategy \u003c/br\u003e\nAbbreviateNamesStrategy (4) \u003c/br\u003e\n---\u003e MSAITrtsHrrch \n\n## Combining following predefined priorities\nSometimes it is difficult to order the strategies on your own. This is why we are offering an “automatic” version that will apply the strategies according to their order of priority. Therefore, you only have to specify the strategies, regardless of the order.\n\n# **How to reduce a label using contractor**\nExample to use a \"remove vowels strategy\", you can type on the playground:\n\n```Smalltalk\nLbCContractor new\n  removeVowels;\n  reduce: 'LabelContractor/src/LbCContractor.st'. \n```    \n--\u003e LbCCntrctr.st\n\n**To keep path:**\n```Smalltalk\nLbCContractor new\n  keepPath;\n  removeVowels;\n  reduce: 'LabelContractor/src/LbCContractor.st'\n``` \n--\u003e LabelContractor/src/LbCCntrctr.st\n\n**Combining strategies following user-defined order**\n```Smalltalk\nLbCContractor new\n  removeVowels;\n  removePrefix: 'cly';\n  removeSuffix: 'test';\n  reduce: 'ClyMergedSuperclassesAndInheritedTraitsHierarchyTest'\n``` \n\n**Combining strategies following predefined priorities**\n```Smalltalk\nLbCContractor new\n  usingPriorities;\n  removeVowels;\n  removePrefix: 'cly';\n  removeSuffix: 'test';\n  reduce: 'ClyMergedSuperclassesAndInheritedTraitsHierarchyTest'\n``` \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoosetechnology%2Flabelcontractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoosetechnology%2Flabelcontractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoosetechnology%2Flabelcontractor/lists"}