The following program is a basic proof-of-concept implementation of the program synthesis technique of Programming by Example, as included in Microsoft Excel FlashFill.
The data-set "features.csv" consists of extracted features from input/output examples, as a user would provide prior to beginning program synthesis. For example, to produce a program that extracts the first character of every input string, the user might give examples of strings as input with lengths of 1, 2, or 5 characters and an output example of a single character. We can guess the most likely program to select as a solution might be "firstCharacter". Similarly, if the input consists of numbers, we can guess the most likely program to select as a solution might be "addition".
In a true Programming by Example system, the data-set would consist of a massive number of stored programs and their corresponding features. However, for this proof-of-concept, we include a very limited set. This example also omits the creation of the feature set, which would involve logical reasoning over the input/output examples, prior to performing neural-guided heuristics for selecting a solution. That is, knowing to extract the first character versus the second character, or some other substring, requires much more feature transformation than is provided in this simple example.