CoolFace
Modelpublic

HelloImSteven/AppleScript-Summarizer

sourceHugging Facemitupdated 3y agoView on Hugging Face
1likes24downloads
README.md79 linesDownload Raw Back to root
1---2license: mit3datasets:4- HelloImSteven/applescript-lines-annotated5language:6- en7tags:8- applescript9- code10widget:11- text: "on openFile(filePath, permission)"12  example_title: "Handler Definition"13- text: "set myVar to 3"14  example_title: "Set Variable"15- text: "open location \"https://huggingface.co\""16  example_title: "open location"17- text: "do shell script \"echo 'Here are some numbers: 1, 5, 89, 156, 1053' | egrep -o '\\\\d*'\""18  example_title: "do shell script"19- text: "use framework \"CoreLocation\""20  example_title: "use framework"21- text: "tell application \"Notes\" to make new note"22  example_title: "Make New Note"23pipeline_tag: summarization24---25 26# Model Description27 28This model summarizes individual lines of AppleScript code and provides insights into their purpose and functionality. The model is trained on the [applescript-lines-annotated](https://huggingface.co/datasets/HelloImSteven/applescript-lines-annotated) dataset. 29 30# Usage31 32```python33from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, AutoConfig, pipeline34 35model_selector = "HelloImSteven/AppleScript-Summarizer"36tokenizer = AutoTokenizer.from_pretrained(model_selector)37 38model = AutoModelForSeq2SeqLM.from_pretrained(model_selector)39config = AutoConfig.from_pretrained(model_selector)40 41pipe = pipeline("summarization", model=model, config=config, tokenizer=tokenizer)42 43raw_code = [44    "if myThing is 0 then set success to true",45    "set numInputs to 5",46    "tell application \"System Events\" to click button \"OK\" of window 1 of application process \"Finder\""47]48 49res = pipe(raw_code)50for i in range(len(res)):51    print("\n\nInput: '" + raw_code[i] + "'")52    print("\nSummary: " + res[i]["summary_text"] + '\n')53```54 55The model performs best when given adequate context, such as meaningful variable and handler names. For example, it will perform better when provided the input "on makeDirectory(dirPath)" than it will for "on makeDir(x)".56 57# Example Outputs58 59| Input | Output |60| ----- | ----- |61| on makeDirectory(dirPath) | This line of AppleScript code begins the definition of a handler named "makeDirectory". Based on its name, the handler is likely used to create a directory path from the path stored in the variable "dirPath". |62| open location "https://huggingface.co" | This is a line of AppleScript code that calls the built-in "open location" handler, providing the URL "https://huggingface.co" as a parameter. This is likely used to open a web browser. |63| do shell script "open -a 'Google Chrome'" | This is a line of AppleScript code that calls the "open -a" handler of the "Google Chrome" command, providing the output as a shell command. When executed, this line will open the Chrome web browser. |64 65# Limitations66 67This model is a work in progress. It is trained on a small dataset of annotated AppleScript lines, but that dataset will grow in time. For now, however, this leads to several limitations of the model:68 691. There are concepts and line structures that are simply absent from the dataset, so the model will struggle with them. If you identify such a concept, please consider providing feedback (e.g. expected output).702. While the model is fine-tuned from Bart and thus has adequate knowledge of outside concepts, it is not able to give explanations of all possible concepts. For example, for inputs involving the `do shell script` command, it will be able to provide explanations of some shell scripts better than others. This is not an area of focus for this model, so do not expect significant improvements in future versions.713. This is not a conversational model.72 73# Validation Metrics74 75- Loss: 0.2062876- Rouge1: 0.6029977- Rouge2: 0.4111878- rougeL: 0.5218679- RougeLsum: 0.52207